Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: morph100 on Wed 02/01/2019 19:50:20

Title: Using a bool to determine dialog trigger
Post by: morph100 on Wed 02/01/2019 19:50:20
OK so still trying my very first game so forgive the basic questions.

I'm trying to trigger a different dialog script depending on the value of a bool, as in if bool is true then play dialog 1 if it is false play dialog 2. But I'm setting the Bool value in the room script but the dialog triggers from the character talk are in the global script so I keep getting dialog 1 and not 2.

Hope that makes sense?
Title: Re: Using a bool to determine dialog trigger
Post by: Slasher on Wed 02/01/2019 20:03:56
try making the bool in the global variable pane in the editor and not in room script...
Title: Re: Using a bool to determine dialog trigger
Post by: Khris on Wed 02/01/2019 20:07:46
The entire point of a global variable is to be able to access it from multiple scripts, so your diagnosis doesn't make sense. My guess is you accidentally declared the bool in the header and thus created a separate version for each script.

Here's the proper way:

Code (ags) Select
// global header
import bool showOtherDialog;

// top of global script
bool showOtherDialog; // default value for bools is false
export showOtherDialog;
Title: Re: Using a bool to determine dialog trigger
Post by: morph100 on Wed 02/01/2019 20:14:42
Thanks yes it was a local variable not a global one! I will go back an change it now.