Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: JudasFm on Thu 13/11/2003 10:56:47

Title: Help required with SetDialogOption
Post by: JudasFm on Thu 13/11/2003 10:56:47
I'm not sure if this belongs here or in the Technical Forum, but I'll start here :)

I want to know how to enable an option in a separate topic.  So far the story's this:

The character has gone to a door and been asked by a guard for a password, which they don't know.  They then do a favour for an NPC fighter in a different room who tells them the password.

I've got the password option written in the Dialogs section.  What I don't know is how to enable it from when the fighter gives it to you.  Any help...?
Title: Re:Help required with SetDialogOption
Post by: MrColossal on Thu 13/11/2003 11:07:41
i do believe this is what you want, from the manual:

SetDialogOption (int topic, int option, int new_state)

Changes whether an option in a conversation is available to the player or not. This allows you to add extra options to a conversation once the player has done certain things.
TOPIC is the topic number, from 0 to the number of topics - 1. Find this out in the Room Editor.

OPTION is the option number within that topic, from 1 to whatever the highest option is for that topic.

NEW_STATE controls what happens to this option. It can have the following values:

0   The option is disabled - the player will not see it
1   The option is enabled - the player can now see and use it
2   The option is permanently disabled - no other command can ever turn
   it back on again.

These are equivalent to the option-off, option-on, and option-off-forever dialog commands.
Example:

if (GetGlobalInt(10)==1)
   SetDialogOption(4,2,1);  

will enable option 2 of topic number 4 if the Global Integer 10 is 1.
See Also: GetDialogOption, RunDialog, StopDialog



good luck

eric
Title: Re:Help required with SetDialogOption
Post by: JudasFm on Thu 13/11/2003 11:22:11
Maybe I should have been slightly clearer; I meant I've read that part in the manual, I basically understand what it's saying but have no idea how to insert it into the script ???
Title: Re:Help required with SetDialogOption
Post by: Ishmael on Thu 13/11/2003 11:25:03
Read the FAQs, KBs etc? There's surely told how do you script things... and the scripting tutorial in the manual...
Title: Re:Help required with SetDialogOption
Post by: JudasFm on Sun 16/11/2003 08:14:04
Again, perhaps I should have mentioned this earlier, but to be honest, I thought it was taken as read that if someone posted a request for help on these forums, they'd already checked the manual, FAQs, KB etc.  I've also looked at some third-party tutorials but they don't answer my question either.  Can someone out there please help me? :)
Title: Re:Help required with SetDialogOption
Post by: Ishmael on Tue 18/11/2003 06:29:02
Well, in the dialog script of the topic, where you aquire the password, put

run-script 1

where you want the option to be enabled, and then createa new function to the global script like folllows:

function dialog_request (int xval) {
if (xval == 1) {
SetDialogOption(a, b, 1);
}
}

where you replace the a with the password query topic number, the b with the option number.
Title: Re:Help required with SetDialogOption
Post by: JudasFm on Tue 18/11/2003 13:23:59
8) Brilliant!  Thanks so much! :D