| 08-13-2004, 06:49 PM | #1 |
I need to make it so I can have a region name as a string variable, because i need to convert it to an integer value... the reason i need this is because im making a board game, and I want to have it so when a player rolls the dice, the game identfys the integer value of the region name so the player will advance to a space that is for example 5 spaces up, if he rolled a 5.. to do this i would have it add 5 to the integer value of the region he was on.. help please! edit: also, im confused at what an index is.. |
| 08-14-2004, 08:14 AM | #2 |
There's no function that would do that in GUI. Perhaps there is a jass option, you would have to ask in the jass vault for this (or wait if somebody notices this here; you can edit your first post and add an icon like I did to mine, so you can get more attention from jassers). The GUI way to do this would be to store every region (or, better yet, every center of region (because you move units to points, not to region)) into a variable array at map initialization. For example, you save (centre of region (field1)) to pointVariable[1], (centre of region (field2)) to pointVariable[2], (centre of region (field3)) to pointVariable[3],.... That way, you have all your regions nicely numbered in the array. Moving the pieces around is then simple, just move them to pointVariable[((unitPosition)+(diceRoll))]. |
| 08-14-2004, 09:16 PM | #3 |
you could store them in gamecache using the return bug under the name you want. Eg. function GetStoredRegion takes string name returns rect return GetStoredInteger(InitGameCache("gc"),"gc",name) return null endfunction |
