Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: on Sat 23/10/2004 08:38:25

Title: Text parser and "ignore" words
Post by: on Sat 23/10/2004 08:38:25
I want to be able to treat "look box" differently from "look in box".  To do this, it seems like I must remove "in" from the list of ignore words, and add it back as a normal word (otherwise, I get an error that "in" is an ignored word).  Then I can use Said("look box") and Said("look in box").

However, most of the time, I want words like "in" to be ignored.  For example, "look in tree" and "look tree", "look on tree" should all be the same.  But I don't want to have to do Said("look [in] [on] [etc...] tree") for every single thing you can look at.

So basically I want words like "in", "on", "under", etc... to be ignored most of the time, but sometimes I do want to do something different when they're present.

Is there a way to do this in AGS?  (I made a small game with SCI before, and it allowed this).
If I could somehow change the list of ignored words at runtime, I think I could do this.

Title: Re: Text parser and "ignore" words
Post by: Rui 'Trovatore' Pires on Sat 23/10/2004 09:51:15
Why not just "un-ignore" all of them and simply not use them when they're not needed? I, for one, was ALWAYS pissed off, when played text adventures, to find that some word wasn't recognized in a place but WAS in the other place, because by then I'd given up on the word, thinking the parser didn't support it.
Title: Re: Text parser and "ignore" words
Post by: Radiant on Sat 23/10/2004 12:31:51
You could just give 'in' a standard response. After all, 'look in table', 'look in door' and 'look in sign' don't make a whole lot of sense.
Title: Re: Text parser and "ignore" words
Post by: on Sat 23/10/2004 18:15:05
Good point... I guess there aren't too many cases when "in" or "under" make sense to be added.

I suppose maybe I could also strip these words out manually and call ParseText and the room script a second time with them removed (although calling it a second time doesn't seem to work very well).

   
Title: Re: Text parser and "ignore" words
Post by: Edwin Xie on Sat 23/10/2004 20:04:39
I think what you meant was "look at box" and "look in box" and you want them to be different. Right? But yes, sometimes words like those don't make any sense like "look in paper" etc.
Title: Re: Text parser and "ignore" words
Post by: Radiant on Sat 23/10/2004 22:48:47
ParseText is one of those functions that doesn't get called immediately; instead, it gets called if your current script finishes.
One way to deal with this is something like

  ...
  ParseText ();
  repeatparsetext = 1;
  ...


Then, in your rep_ex function, add

  if (repeatparsetext) {
     repeatparsetext = 0;
     ParseText ();
  }