Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: ROTh on Thu 28/10/2004 15:55:26

Title: Variables - Problems with saving them
Post by: ROTh on Thu 28/10/2004 15:55:26
I connected some things if you have done something to the "If a variable is set to a certain value" option, but it seems that the value (Global int) which is set in the game isn't saved. Why? and how can I manage that??
Title: Re: Variables - Problems with saving them
Post by: Radiant on Thu 28/10/2004 16:06:46
Global ints are saved in save game files.
My guess is that something else is wrong with your code; maybe you could post a sample?
Title: Re: Variables - Problems with saving them
Post by: strazer on Thu 28/10/2004 21:27:54
Note that GlobalInts are different from the variables you set via the Interaction Editor. GlobalInts != Graphical variables.

For example, if you set a globalint in dialog script via set-globalint, you can only check its status with script using the GetGlobalInt function.
If you want to set a graphical variable via script, use the SetGraphicalVariable function.
Title: Re: Variables - Problems with saving them
Post by: ROTh on Thu 04/11/2004 12:43:58
I set the variable value with the interaction editor and I use the conditional "If a variable is set to a certain value" (with the interaction editor, too). I don't use a script here. .... but the value isn't saved.
Title: Re: Variables - Problems with saving them
Post by: strazer on Thu 04/11/2004 13:02:10
I'm using v2.62. I've tested it with "Interact" on characters, inventory items and objects. Worked fine.
In which interaction do you set the variable?
Maybe you have defined a global variable and a room variable with the same name, confusing the two?
Title: Re: Variables - Problems with saving them
Post by: ROTh on Sat 06/11/2004 23:43:19
I'm using v2.52, but I think that couldn't be the problem, because it seems that I'm the first one with that problem.
I set the variables and ask for the variables at interactions with charakters or objects. (e.g. use inventory). So I couldn't post the script, I think.
Title: Re: Variables - Problems with saving them
Post by: Edwin Xie on Sun 07/11/2004 00:05:28
Correction: 2.62 but anyway, you could always use a script like:


Put this script in, use dustbin with old man interaction (Don't delete the animation of the old man with the dustbin though):
SetGlobalInt(GLOBALINT,1);


Put this script in, use tire with old man interaction (Don't delete the animation of the old man with both though):
if (GetGlobalInt(GLOBALINT)== 1){ // if the dustbin is already on the old man
SetGlobalInt(GLOBALINT,2);
}


Put this in the interaction for the region of the old man:
if (GetGlobalInt(GLOBALINT)==1){ // The tire is on the old man
blahblah;
}
else if (GetGlobalInt(GLOBALINT)==2){ //The tire and the wastebasket is on the old man
blahblah;
}
Title: Re: Variables - Problems with saving them
Post by: Pumaman on Sun 07/11/2004 13:21:17
Can you clarify what you mean by "not getting saved" -- do you mean it works fine except if you save the game and then load it again, or do you mean it's not being saved in between interactions? If it's the latter, it's likely the logic is wrong in your interactions -- could you post what commands you're using in what order?