Text parser and "ignore" words

Started by troflip, Sat 23/10/2004 08:38:25

Previous topic - Next topic

troflip

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.


Rui 'Trovatore' Pires

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.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

Radiant

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.

troflip

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).

   

Edwin Xie

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.
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Radiant

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

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


Then, in your rep_ex function, add
Code: ags

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


SMF spam blocked by CleanTalk