Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: KillerKlown on Tue 21/11/2006 18:44:36

Title: Question about different dialogs...
Post by: KillerKlown on Tue 21/11/2006 18:44:36
Hi...i just need an answer to this...i read a tutorial about variables. It contained something with my_counter etc. I want to be able to have different dialogs run after i've done things in the game...let's say...when i initially talks to a guy, dialog 1 starts, and let's say i pick up an object later on...should i add 1 to my_counter in that room where i got the object?

When i return to the room with the guy the script would have something like "if (my_counter == 1) {
should i add "run dialog 2" or?...hope you know what i mean hehe...my english isn't perfect
Title: Re: Question about different dialogs...
Post by: on Tue 21/11/2006 19:01:57
Two methods are possible here.

You can change a global variable depending on actions the player does, and in the TALK TO option for the target character, you'd include something like your above IF GLOBAL_VAR == 1...

Or, you could just switch dialog topics on and/or off, instead of changing the whole dialog. This would be more handy if a certain action changes only some parts of a dlg, though.

As for the scripting, you're right. The action should change the global variable. Code from other objects should refer to that variable. That way, you can be sure that you can access the var from everywhere in the game, and read it from everywhere too.

BTW your english really isn't that bad  ;)
Title: Re: Question about different dialogs...
Post by: KillerKlown on Tue 21/11/2006 19:05:16
Hehe well i've studied the english language for some time...

ok i haven't tried turning on/off options but...if i get...a book for example and
return to the guy...how do i change to turn dialog options on..."if player got inventory item" turn on dialog option "3" or?
Title: Re: Question about different dialogs...
Post by: on Tue 21/11/2006 20:44:56
Dialog.GetOptionState and Dialog.SetOptionState are the commands you'll want to use; just browse the manual for them.
Title: Re: Question about different dialogs...
Post by: Candle on Tue 21/11/2006 21:01:17
And turn them on and off in other rooms with the MODULE: OtherRoom v0.85
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=20650.0
Title: Re: Question about different dialogs...
Post by: KillerKlown on Tue 21/11/2006 21:17:21
Quote from: Candle on Tue 21/11/2006 21:01:17
And turn them on and off in other rooms with the MODULE: OtherRoom v0.85
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=20650.0
ah nice...thanks guys i'll look into this :D
Title: Re: Question about different dialogs...
Post by: strazer on Tue 21/11/2006 21:32:14
Thanks Candle for plugging the module, but they're not talking about room objects but dialog options, which are accessible globally anyway.
Title: Re: Question about different dialogs...
Post by: Khris on Tue 21/11/2006 23:43:37
KillerKlown:
To introduce a global variable, declare and export it at the start of the global script, outside any funtion:
int my_counter=1;
export my_counter;

Then import it in the script header:
import int my_counter;
In the interaction where the books gets picked up, use
my_counter++;   // increment variable by one
In the character's talk to interaction, use something like
if (my_counter==1) dNobookyet.Start();
else dGotbook.Start();

(Nobookyet and Gotbook are just examples of names for the dialogs.)
Title: Re: Question about different dialogs...
Post by: KillerKlown on Tue 21/11/2006 23:50:49
Thanks a lot buddy :)
Title: Re: Question about different dialogs...
Post by: Claaaus on Tue 01/01/2008 23:50:13
@ KhrisMUC
Your post from 21 Nov 2006 was really helpful to me. I had the same problem as KillerKlown and your answer led me straight to the point. Thanks, mate!
Title: Re: Question about different dialogs...
Post by: Dualnames on Wed 02/01/2008 22:26:43
No need to post after a year when you can PM him...