Is there a way to determine how many rooms are being used?

Started by hieronymous, Thu 29/10/2009 06:47:46

Previous topic - Next topic

hieronymous

it's possible to obtain most game maxima (e.g. game.CharacterCount etc) at runtime, but there doesn't seem to be anything that tells you how many rooms are being used in the game

in most of my games i create arrays storing information about each room, and manually set something called "GiMaxRooms" to define the array limit. but of course i have to remember to update it every time i add a new room, and being the lazy boy that i am i'd really prefer it if i could write some code to do that for me

so the question really is: is there any way to get hold of what would effectively be "game.RoomCount"?

i've seen the module where you can set the maximum number of rooms used per game, but this is obviously a slightly different requirement

any suggestions gratefully received
Art of Darkness, Beyond the Comfort Zone

monkey0506

There's unfortunately no way to check/get the number of rooms in the game. There's not really even a proper way to check if a particular room number is being used.

Short of manually tracking it and updating a variable, there are two common constants that get used: 300 (the maximum number of state-saving rooms) and 1000 (AFAIK the maximum number of rooms). This could potentially bloat your filesize depending how much data you're storing for each room, but if it's just a few variables it shouldn't be too dramatic to just use a static-sized array.

hieronymous

thanks for the reply

i rather thought that might be the case

i could use a static size array, but there are usually occasions when you want to loop through all the elements in the array, to get, or to set, the data in that array, so using an arbitrary value as the limiter can cause more problems than it solves

looks like i'll have to just bang on with my current manual solution
Art of Darkness, Beyond the Comfort Zone

SMF spam blocked by CleanTalk