PDA

View Full Version : Umm, we DO have global variables, you know...



Revfan9
01-15-2007, 11:39 PM
I've seen suggestions for global variables, and I just want to clear this up: We already have them.

gd0-255 Global variables used throughout the quest, yes, they are saved in .sav

sd0-7 Screen variables. These are independent on a screen by screen, dmap by dmap basis.

However, do be very, very careful with these, as they are used internally by the Zscript compiler, so I would reccomend only using them if you only use Zasm stuff in your quest.

Thanks to Jman for explaining this to me...

jman2050
01-17-2007, 10:40 PM
For clarification, only gd variables are used internally by ZScript. sd variables are free for use.

_L_
01-17-2007, 11:36 PM
It is, however, possible but unlikely that gd255 would ever be used, right? And the one below it?

Revfan9
01-17-2007, 11:43 PM
Actually, _L_, after looking through a couple of Zscripts in the compiler output, I have only seen gd0 used, but it's still not too safe, as I don't know wether the compiler uses the others or not, as I am not a developer.

DarkDragon
01-18-2007, 11:01 AM
The compiler will only use up global variables if the ZScript asks for one, and will always allocate global variables starting at gd0 and working up.

Note that the above should be considered an informal tip and not part of the ZScript compiler specification; it's how the compiler currently works but not necessarily how it will always work.