Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Reid on Wed 28/03/2007 06:31:19

Title: creating dialog option as a txtParse box
Post by: Reid on Wed 28/03/2007 06:31:19
Hi all,

As you can hopefully see below, I'm trying to create dialog options (which works great) and have the fourth one be a txtBox for users to give their own responses. It's unclear how I can run a script on that one dialog box though. I really suck at making GUIs so far, so I'd rather not have to create a new one from scratch. I realize in the AGS editor, the 4th option (blank) doesn't relate to the txt parser box.

Thanks,

-Reid

(http://game.rbkdesign.com/ags/dialog_txtparser_help.jpg)

http://game.rbkdesign.com/ags/dialog_txtparser_help.jpg
Title: Re: creating dialog option as a txtParse box
Post by: Ashen on Wed 28/03/2007 11:09:07
I get an 'access forbidden' page when I try to look at that image, so I may be a bit off on what you're trying to do...

From the Manual (http://www.adventuregamestudio.co.uk/manual/Conversations.htm):
Quote
Parser input

You'll notice in the dialog editor, a checkbox "Show text parser with this topic". If you check this, a text box is displayed below the predefined options, which allows the player to type in their own input.

If they type in something themselves, then the dialog_request global script function will be run, with its parameter being the dialog topic number that the player was in.

AGS automatically calls ParseText with the text they typed in before it calls dialog_request, so you can use Said() calls to respond. See the text parser (http://www.adventuregamestudio.co.uk/manual/TextParser.htm) section for more info.

If the 'Show text parser with this topic' setting is what you mean by "the 4th option (blank)", then the second paragraph (the one that says it calls dialog_request should be your answer. (And if that setting wasn't what you meant - try it, before messing with your own GUIs.)

EDIT:
OK, got the image to work. Looks like it is the dialog_request bit you need, and as Khris says below, you don't need the blank option. The 'parser' option is added automatically.
Title: Re: creating dialog option as a txtParse box
Post by: Khris on Wed 28/03/2007 11:11:50
That's right, you don't need an additional blank option.

...

So, from the script menu, select dialog_request, then add whatever you want to happen:
#sectionstart...
function dialog_request(int parameter) {
  if (parameter==1) {  // dBarter dialog has ID 1
    if (Parser.Said("xyzzy");
      cMerchant.Say("Heh.");
    }
  }
}
#sectionend...


Edit: Ashen beat me, manual quote removed
Title: Re: creating dialog option as a txtParse box
Post by: Reid on Wed 28/03/2007 19:05:48
Thank you both Ashen and KhrisMUC. I had read the manual, but didn't understand what it meant by, "with its parameter being the dialog topic number that the player was in." Thanks your replies, now I see that dialog topics do have an ID number in the left side listing of topics. It all makes sense now. Thanks! I'm looking forward to trying this when I get home tonight.

-Reid