Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Scoville on Thu 19/02/2004 04:22:49

Title: Altering variables in a script
Post by: Scoville on Thu 19/02/2004 04:22:49
I made a variable using the drop down menu commands, but I need to access it in the script in a couple places. The variable name is GUNdistract, so I typed "GUNdistract = 1;" in the spot it should fit in the script, but when I save I get an error saying they don't know what GUNdistract is. This happens if I make it a global variable or local to a room. I tried declaring the variable in the global script as well, and that didn't work either. Any suggestions?
Title: Re:Altering variables in a script
Post by: Hinders on Thu 19/02/2004 07:04:50
you have to declare it too!
put :
int GUNdistract;

in room script.
Title: Re:Altering variables in a script
Post by: Wolfgang Abenteuer on Thu 19/02/2004 07:07:28
If you're changing a global variable in a room script, you need to export it from the global script and then into that room script first.  Just put export GUNdistract; at the end of your global script, and then import int GUNdistract; into the room file (if you only want it for that one room), or the script header (if you want it for more than just one room).

~Wolfgang
Title: Re:Altering variables in a script
Post by: Scoville on Thu 19/02/2004 21:07:06
Importing/exporting fixed it! Thanks!