I suppose this would be a beginner question.
I have defined 4 global variables.
int Chest = 0;
int FireWoodDamp = 0;
int WaterHeaterLit = 0;
int WineHole = 0;
But AGS treats them all as Global integer 0. I've tried using the Global Varible Pane, and I've tried doing it myself in the global script header. And it does the same thing.
I searched the forums for a while to find a solution, but came up with nothing. I don't know if I looked hard enought or what...
I can get by by using the search and replace to turn them all into numbers instead of custom names. But I'd like to resolve it so I don't have to write down what each global integer is.
I'm using AGS 3.0.2 sp1 btw....
So you declared all of those in the global script and you want access to them in rooms?
Bad way: At the end of the global script, write
export INTNAME
(or at least after the declaration). Then in the global header, write
import int INTNAME
Good way: Make your global variables in the Global variables pane and set an initial value. Then reference them in script by their name.
[Edit]:Are you trying to use GetGlobalInt and SetGlobalInt?
~Trent
Quote from: Trent R on Sun 09/11/2008 04:58:34
Good way: Make your global variables in the Global variables pane and set an initial value. Then reference them in script by their name.
I did this first, same thing.
Quote from: Trent R on Sun 09/11/2008 04:58:34
[Edit]:Are you trying to use GetGlobalInt and SetGlobalInt?
Yes, should I not use those, and just use the Variable name? If so I feel like an idiot :P
I could be wrong, but I believe those still work for upgraded games, and that you can't make that type of global variables.
So yeah, just use the name of the var, just the same as any other.
~Trent
Thank you i got it working,
You're by no means the first person to make this mistake.
Do you mind if I ask where you got the impression that you had to use SetGlobalInt/GEtGlobalInt? I've tried to make it clear by writing in their manual pages that they are obsolete; is there some sort of tutorial or manual page that you were following that made you think you had to use them?
It's obviously confusing a fair few people, so I'd like to track down where the confusion is coming from.
Well, for me I guess it was the switch from 2.72, and I was used to GetGlobalInt. I feel like an Idiot now because it is in the manual. The weird thing was I was using the manual all day too! It was just late, and I was frustrated after scripting all day.