Hello.
From the "Possibly Stupid Questions asked by Dan" series, we bring you the "How do I use global variables in room scripts?" episode.
Right, so, I've declared a global variable and want to use it in a room script for a hotspot. But when I type up the script, it doesn't recognize it. How do I do it then? Someone, please help me.
Oh, and if it helps, here's how I declared the global variable: I made a conditional action (if variable is set to a certain value) in the interaction window for the hotspot and then edited the variables and added my global one.
I would really like a fast answer to this, 'cos my project depends on this.
Thanks in advance, you lovely person who have taken time out of your life to answer me.
For each global script variable:
put "export varname;" at the end of the global script
put "import int varname;" in the script header
Or... use the DeNGVaT module (http://ssh.me.uk/moddoc/DeNGVaT) and just type Global.Set("myvar") and Global.Get("myvar")...
Or better, use the conventional way of exporting (http://www.adventuregamestudio.co.uk/manual/exportkeyword.htm) the variable after declaring it and then importing (http://www.adventuregamestudio.co.uk/manual/importkeyword.htm) back in that room's script (or in the script header if you want it to be used in all the rooms' scripts).
Edit: Alright, SSH edited his post before me, so it might look a bit odd.
Wow, that was quite fast. Thanks SSH and Gilbot, I now continue working on Update Quest.