Parser text

Started by Vincent, Sun 14/07/2024 22:27:29

Previous topic - Next topic

Vincent

Hey guys I am getting stuck while trying to do something. I am using the Show Text Parser inside a dialog script. This way AGS call automatically Parser.ParseText without to store any string. But how do I check what is the player text? Because I'd like to do something like:

Code: ags
if (param == dDialog1.ID) 
{
  if (Parser.Said("where are you")) 
  {
     string msg = Parser.GetLastWordTyped(); 
     Display("player typed: %s", msg);
  }
}

Khris

If you put that code in the global  dialog_request  it should work (minus the GetLastWordTyped() part)

Vincent

Yeah this piece of code is what I have in my dialog_request which works fine.

Question was how I get the typed message submitted when you use the Show Text Parser inside a dialog script?
Because if you use the Show Text Parser inside a dialog script then the Parser.ParseText get called automatically without submit any string. My guess is that there is no chance to know what the player typed using this method.

A side note I think it would be useful also to have something like Parser.SetWordType(int wordGroup, eType); so you can have a word to be normal type but if you need you can set that word to be ignored later on in run-time, something like this:

Code: ags
if (param == dDialog1.ID) 
{
  if (Parser.Said("where are you")) 
  {
     string msg = Parser.GetLastWordTyped(); 
     Display("player typed: %s", msg);
     Parser.SetWordType(1, eIgnored); // set the word "where are you" to be ignored
  }
}

Khris

I don't think you can directly access the string. This is really old functionality that has been around for a long time (and is rarely used, as far as I can tell).
It was primarily intended to be able to do the Quest For Glory thing where you can just type a random topic to ask people about.

Using existing capabilities, you need to use a dialog option that shows a separate text box to be able to have full access to what the player typed.

Vincent

Quote from: Khris on Mon 15/07/2024 10:50:30you need to use a dialog option that shows a separate text box to be able to have full access to what the player typed.

You mean like selecting a dialog option and it pop up a custom text box? like:
Code: ags
1. ask
2. eat
3. show text box

Khris

Yes, exactly.

However you could also use custom dialog rendering to create your own simulated text box, but there's no easy way to do that, you have to do all the key processing and rendering yourself.

Vincent

Quote from: Khris on Mon 15/07/2024 19:52:18However you could also use custom dialog rendering to create your own simulated text box, but there's no easy way to do that, you have to do all the key processing and rendering yourself.

Alright I got it. Later I decided to change some mechanics to make it more easy and using only dialog scripts.

ps: Side note: There is no way to exit a dialog outside a dialog script? For example let's say I have a dialog running and I want to push a button to exit the dialog?

SMF spam blocked by CleanTalk