creating dialog option as a txtParse box

Started by Reid, Wed 28/03/2007 06:31:19

Previous topic - Next topic

Reid

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

Ashen

#1
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:
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 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.
I know what you're thinking ... Don't think that.

Khris

#2
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:
Code: ags
#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

Reid

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

SMF spam blocked by CleanTalk