boyesjs03 Posted April 18, 2013 Author Share Posted April 18, 2013 SO Im trying to add a resolution option to my options.ini file. Ive coded the option into ModDatabase and ModConsants but I get an error saying "Circular dependencies between modules".Im guessing this is due to my ModConstants looking like this:```Public Const MAX_MAPX As Byte = (Options.ResolutionH / 32 - 1)Public Const MAX_MAPY As Byte = (Options.ResolutionW / 32- 1)```Any ideas? Im trying to make it so the Max map x and y equals the resolution values in the options.ini file, these will be set by control boxes ( I can do that ). Link to comment Share on other sites More sharing options...
damian666 Posted April 18, 2013 Share Posted April 18, 2013 A user-defined type or constant in one module references a user-defined type or constant in a second module, which in turn references another user-defined type or constant in the first module. Remove the dependent references.no idea for the rest though O.o Link to comment Share on other sites More sharing options...
boyesjs03 Posted April 18, 2013 Author Share Posted April 18, 2013 I dont know where else to put the option though :L Because I could use an If or Select Case statement but I also get an error. Link to comment Share on other sites More sharing options...
abhi2011 Posted April 19, 2013 Share Posted April 19, 2013 Make the constants variables. (Global)Make a sub that manipulates them. (Call it from the Main() sub in modGeneral)Or you could change them in the Main sub. Your choice. Link to comment Share on other sites More sharing options...
boyesjs03 Posted April 19, 2013 Author Share Posted April 19, 2013 Could you explain this in code, Im still learning xD Link to comment Share on other sites More sharing options...
abhi2011 Posted April 20, 2013 Share Posted April 20, 2013 > Could you explain this in code, Im still learning xDSince your learning you should try this out on your own. I'll try to break it up for you.ResolutionH and ResolutionW (In general the entire Optionsrec) is a variable. They are assigned values only during run time. While constants are automatically assigned valued the first thing on start up. So your best bet would be to change the Map_X and Map_Y global variables. (Public….)After that you will have to set these variables values. In VB6 if the sub Main exists then it will be first sub to run. Therefore meaning that variables initialization and other important stuff should be initialized here. So find the Main sub and from there manipulate the variables Map_X and Map_Y. Make sure you do the initialization after the options have been loaded. Otherwise unexpected results might occur. Link to comment Share on other sites More sharing options...
hisherwin Posted April 20, 2013 Share Posted April 20, 2013 are you using Dx7? if yes you can do it like thisPublic Const MAX_MAPX As Byte = Options.ResolutionHPublic Const MAX_MAPY As Byte = Options.ResolutionW Link to comment Share on other sites More sharing options...
abhi2011 Posted April 20, 2013 Share Posted April 20, 2013 > are you using Dx7? if yes you can do it like this> > Public Const MAX_MAPX As Byte = Options.ResolutionH> > Public Const MAX_MAPY As Byte = Options.ResolutionWThat is what caused the error. And ResolutionH and ResolutionW will be 0 when the constant is declared. Link to comment Share on other sites More sharing options...
boyesjs03 Posted April 20, 2013 Author Share Posted April 20, 2013 Sherwin - that is what I did xP Abhi - I think I get this, so I change them as variables in ModConstants then I can manipulate them in the Sub Main.And I set it as a variable by announcing it as Public MAX_MAPX… Link to comment Share on other sites More sharing options...
abhi2011 Posted April 20, 2013 Share Posted April 20, 2013 > Abhi - I think I get this, so I change them as variables in ModConstants then I can manipulate them in the Sub Main.> > And I set it as a variable by announcing it as Public MAX_MAPX…Yep. They should be global variables. (Public VarName As VarType)This ensures that they can be accessed from everywhere in the game. And also make sure that the manipulation occurs only after the options are loaded. (There should be a call to a sub that loads the options in the Main procedure) Link to comment Share on other sites More sharing options...
boyesjs03 Posted April 20, 2013 Author Share Posted April 20, 2013 Whoop, I've got this xD putting it into effect when I get home xD Thanks bro ![;)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/wink.png) Link to comment Share on other sites More sharing options...
boyesjs03 Posted April 20, 2013 Author Share Posted April 20, 2013 Wont set to resolved until I've added it in tonight ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png) Link to comment Share on other sites More sharing options...
abhi2011 Posted April 20, 2013 Share Posted April 20, 2013 No problem man. Glad to help. Link to comment Share on other sites More sharing options...
boyesjs03 Posted April 22, 2013 Author Share Posted April 22, 2013 Eurgh I cant do this. I announced them as Variables in modGlobals and removed them from the constants and created a sub to manipulate them and called it from modGeneral Main but it still needs a constant for the hotbar but if I put it in then it screws up ;( Link to comment Share on other sites More sharing options...
abhi2011 Posted April 23, 2013 Share Posted April 23, 2013 Change the Constant name for the hotbar to new variable you created. Link to comment Share on other sites More sharing options...
boyesjs03 Posted April 23, 2013 Author Share Posted April 23, 2013 So just define the hotbar as a variable as well? Link to comment Share on other sites More sharing options...
abhi2011 Posted April 23, 2013 Share Posted April 23, 2013 Mind telling me how it screws up with the sub that needs the constant.And I meant replacing the constant required for the hotbar to the new variable. Link to comment Share on other sites More sharing options...
boyesjs03 Posted April 23, 2013 Author Share Posted April 23, 2013 > Mind telling me how it screws up with the sub that needs the constant.> > And I meant replacing the constant required for the hotbar to the new variable.Will do once Im home. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now