Solved: Using a global bool in a dialog with a character

Started by johanvepa, Mon 01/04/2013 01:07:18

Previous topic - Next topic

johanvepa

I have made a bool determining whether or not the player character has noticed a certain feature on the person he's talking to. If so, a dialog option will be available.

However, the dialog does not recognize the bool.

I would do this:

Code: AGS

@S  // Dialog startup entry point
narrator: You inquire about...
 if (seentattoo == true)
 {
 option-on 2
 }
return


I have defined the seentattoo bool in my globalscript and exported it. I have imported it to the room where the dialog is taking place. Am I missing something here?

NickyNyce

#1
Could it be that during this dialog, you turn this variable to true. If that's the case, it would only work if you exited the dialog and restarted it (Due to your check being in the start section of the dialog). You could of course turn the OptionState to on in the dialog that turned your variable to true, that way you wouldn't have to leave the dialog.

I have no business answering these questions, just a thought.

Crimson Wizard

#2
Quote from: Nanuaraq on Mon 01/04/2013 01:07:18
I have defined the seentattoo bool in my globalscript and exported it. I have imported it to the room where the dialog is taking place. Am I missing something here?
Dialog is a global entity, not related to any room in particular. Declare variable as imported in the GlobalScript.ash instead, so that it is visible in any script.

Khris

Also, if you're going to have a manageable number of them, I'd recommend using the Global variables pane instead.

johanvepa

That wasn't it, but thank you anyway.

Quote from: NickyNyce on Mon 01/04/2013 01:50:20
Could it be that during this dialog, you turn this variable to true. If that's the case, it would only work if you exited the dialog and restarted it (Due to your check being in the start section of the dialog). You could of course turn the OptionState to on in the dialog that turned your variable to true, that way you wouldn't have to leave the dialog.

I have no business answering these questions, just a thought.

johanvepa

I'll try that, thank you.

Quote from: Crimson Wizard on Mon 01/04/2013 01:56:42
Quote from: Nanuaraq on Mon 01/04/2013 01:07:18
I have defined the seentattoo bool in my globalscript and exported it. I have imported it to the room where the dialog is taking place. Am I missing something here?
Dialog is a global entity, not related to any room in particular. Declare variable as imported in the GlobalScript.ash instead, so that it is visible in any script.

johanvepa

Yeah, I wanted to put the bool at the top of the room script, but since it is linked to looking at a character, and looking at a character can only be done via the globalscript.asc (right?), I had to have it in the global.

Quote from: Khris on Mon 01/04/2013 02:09:55
Also, if you're going to have a manageable number of them, I'd recommend using the Global variables pane instead.

Khris

Sure, variables that are about a single room's state, as long as they don't need to be accessed from elsewhere, are fine at the top of the room script and can be accessed by all functions in that script.

johanvepa

Thank you, that did the trick.

Quote from: Crimson Wizard on Mon 01/04/2013 01:56:42
Dialog is a global entity, not related to any room in particular. Declare variable as imported in the GlobalScript.ash instead, so that it is visible in any script.

SMF spam blocked by CleanTalk