problem when examining a noun/object that has a verb in it
NecroDeath
16 Sept 2016, 18:31I have carol singers in my game, when you 'x carol singers' it performs the verb 'sing', is there a way around this other than renaming the carol singers?
hegemonkhan
16 Sept 2016, 21:50I'll let Pixie or Jay or whoever address this, as I don't know how the built-in stuff works very well, but if it has something to do with parsing, just understand that parsing is complex and there's not much of a work around of/for its issues, for example:
(this is a really poor example... Pixie or Jay can come up with good ones, I'm just not that familiar enough with parsing to think of a good example, lol)
I have 2 Commands, with these patterns (what/form you type in during game play, to activate the Command):
Command 1:
pattern: run #text#
Command 2:
pattern: run to #text#
if I were to type in:
run to town
which Command is it going to activate?
am I saying:
run #to town# // Command 1 is activated
or
run to #town# // Command 2 is activated
???
again a poor example, but I hope you get the concept of the difficulty with parsing, and thus why there's no easy way around it.
you just got to make all your stuff as clearly separate/unique as you can, so you don't get into any conflicts with string/text matching (general parsing)
Jay Nabonne
18 Sept 2016, 10:14NecroDeath, would you be able to post your code? It's either a bug in Quest or a bug in your code. Having something to run would make it easier.
I wanted to try to reproduce what you've done, but there is no default "sing" verb or command. Also there is a difference between a verb and a command. So if you could at least clarify:
- Did you add "sing" as a command or as a verb? (For example, "sing" as a verb would always need an object, like "sing song".)
- What is the pattern you used when you added "sing"?
- Did you add "sing" to the room or to the global set of verbs/commands?
I don't know every nuance of the parser, but I'm not sure how something that starts with "x" could invoke "sing". Being able to reproduce it (either by you posting the code or me recreating it) will help tremendously.
NecroDeath
18 Sept 2016, 12:53Hi,
Added as command to room. Regular expression, 'sing' then the following:
if (not Got(Bottle of Port)) {
msg ("You sing, the carol singers increase in volume, the crowd starts singing. For a moment the whole town square is united in a joyous brief pause from the commercial hustle and bustle.
The carol leader walks over and shakes your hand, "here take this,". He hands you a Bottle of Port")
AddToInventory (Bottle of Port)
}
else {
msg ("You sing, the carol singers increase in volume, the crowd starts singing. For a moment the whole town square is united in a joyous brief pause from the commercial hustle and bustle.
The carol leader smiles at you")
}
The Pixie
18 Sept 2016, 13:10The regular expression will match against "sing" anywhere in the input text. Type this, the thing at the start will mean ing has to be at the start of the typed text.
^sing
Or do it as a command expression, which I think adds that in implicitly.
NecroDeath
18 Sept 2016, 13:23cheers! fixed.
Jay Nabonne
18 Sept 2016, 16:04That makes sense, now. :) Nice one, Pixie!
Just to add a tidbit in case it helps anyone: commands added to a room take precedence over global ones, which is one reason why the sing command always got selected. (I don't know what would have happened if it had been global.)