Textparser in dialogs

Started by loominous, Thu 04/09/2003 22:19:01

Previous topic - Next topic

loominous

Is it possible, and if so, difficult to let the player use the textparser in dialogs?

Realising I m probably not very clear in my question here s what I m aiming for:

When I click on a person after 'talk to' has been selected a la LEC GUI, I want to let the player type in the "topics". So instead of choosing some printed topics from the bottom, the player would type in keywords to trigger messages.

Is this possible and if so difficult to make?
Looking for a writer

Ishmael

hmm... I see the dialog editor useless when making this kind of thing.. You need ot manually create the dialogs and all in normal scritping.
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Scorpiorus

You can use an AGS v2.56 new feature - a parser input in dialog. Open dialog editor and tick Show text parser with this topic for the topic you want. Then in game when that topic is displayed you'll see a text box as the last option in dialog. As the user has written something and pressed enter AGS calls dialog_request() function and pass current topic number as parameter. You can use it to show desired messages.

Quote from the manual (AGS v2.56):
QuoteParser 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.

Example:

function dialog_request (int parameter) {

if (parameter == 0) { // if topic number 0

if (Said("hello")) DisplaySpeech (MAN, "Hi there");
if (Said("bye")) DisplaySpeech (MAN, "See ya later");

}
else if (parameter == 1) { // if topic number 1

if (Said("ask about items for sale")) RunDialog (3);

}

}

Hope it helps

-Cheers

loominous

Excellent. Thanks for the info.
Looking for a writer

SMF spam blocked by CleanTalk