Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: subspark on Mon 01/09/2003 10:41:57

Title: Set Global Integer in Dialog Script
Post by: subspark on Mon 01/09/2003 10:41:57
I want to set a flag while the player chooses a dialog option.
I need to do this through the dialog script.

Heres my code:

Character: Wizard: Interactions: Talk to: Run Script:


 // script for character1: Talk to character
MoveCharacter (EGO, 170, 130);
while (character[EGO].walking) Wait (1); //Waits until the character has arrived to the location
FaceCharacter(EGO,WIZ);

//When I want to put anything before the dialog choices, I usually put them right here.

if (GetGlobalInt(8)==1) {
 // code here

DisplaySpeech (0,"Excuse me...");
DisplaySpeech (2,"Anything more?");
RunDialog (5); //Starts the programmed dialog number 0. (topic 0 in the 'dialogs' tab)
}
else {
DisplaySpeech (0,"Excuse me...");
DisplaySpeech (2,"Yes?");
RunDialog (1); //Starts the programmed dialog number 0. (topic 0 in the 'dialogs' tab)
}


My dialog script won't except SetGlobalInt
How can i achieve setting some kind of flag in the dialog script that i can call/get in a character's interaction's talk to script?
Title: Re:Set Global Integer in Dialog Script
Post by: Ishmael on Mon 01/09/2003 10:47:05
"We are now live from the AGS manual, from the converstaions in Tutorials -> Setting up the game"

set-globalint GI VAL

Changes text script GlobalInt number GI to have the value VAL. This is equivalent to the SetGlobalInt text script command, and allows you to quickly set things without having to go through a run-script just to set an int value.

Whattayathink? And I think you kindof doubleposted..?
Title: Re:Set Global Integer in Dialog Script
Post by: subspark on Mon 01/09/2003 10:51:20
I really do appreciate your help TK. I think your fantastic and I have now fully solved my problem. Thanks to you.

Cheers,
Sparky.
Title: Re:Set Global Integer in Dialog Script
Post by: Ishmael on Mon 01/09/2003 10:53:41
No problem, glad to help. ;) And besides... I had nothing better to do then post into the forum... :P
Title: Re:Set Global Integer in Dialog Script
Post by: subspark on Mon 01/09/2003 11:05:14
just maybe one more quessy tho.

You did mention Setting Global Integer "GI" to value "VAL"
where infact the code in my interactions script only accepts numbers for example:

if (GetGlobalInt(8)==1) {
DisplaySpeech (0,"Excuse me...");
DisplaySpeech (2,"Anything more?");
RunDialog (5); //Starts the programmed dialog number 5. (topic 0 in the 'dialogs' tab)
}
else {
DisplaySpeech (0,"Excuse me...");
DisplaySpeech (2,"Yes?");
RunDialog (1); //Starts the programmed dialog number 1. (topic 0 in the 'dialogs' tab)
}


I wrote the number eight in there but can you actually have word values here too?

just to be more organized?!
Title: Re:Set Global Integer in Dialog Script
Post by: Ishmael on Mon 01/09/2003 11:28:29
to set GlobalInt 8 to 1, put

set-globalint 8 1

in the dialog script