The Dink Network

The variable limit... when do locals die?

June 13th 2005, 06:08 AM
custom_simon.gif
SimonK
Peasant He/Him Australia
 
Hmmm... you have a total variable limit of approx 250 (I believe someone once measured it as being 272...) which includes both globals and locals, because saved games include local variables of ... what exactly? Scripts active on the map screen you are current on? Or is it something else?

I believe something else, due to trouble shooting the bug in which "S" key was no longer bringing up the New Stats dispaly in PQ for PSue.

I've taken a look at the saved game that showed this problem (using Redink1's "Save Game Editor of Justice" - a handy little program). Somehow the variable which tracks the display of the new stats - &newstats - had been set to 1 mid game - it should've been 0 - it is only meant to be equal to 1 when the script is in mid 'main' procedure, i.e. stats are being displayed and then this global variable changes back to 0 when you hit any key - marking the end of the main procedure.

My guess is something weird happened when PSue were pushing keys... because resetting this global variable to 0 didn't solve things completely: I got to hear the gong sound that signifies bringing up the display, but still no dispaly... the Debug.txt file then revealed that there were more than 250 variables... so back to using SGEJ and yes there were a lot of "local" variables floating around... not sure why, as these should die with their script, I thought... and those scripts which I call in the game which aren't attached to a sprite should have a kill_this_task(); at the end - which should definetly kill those suckers... ah well, the Dink Engine has it's problems....

Anyone shed any light on this?

June 13th 2005, 12:52 PM
goblinm.gif
Conventional wisdom is that variables die when the associated scripts die... either Ted or Seth alludes to this in the DinkC reference by noting that you want to initialize variables in the die proc when possible.

I'd assume you checked scripts_used, just to be sure there wasn't a missing kill_this_script...? My guess is that there were just a lot of scripts being run.