Using a wildcard with a verb

cfiggis
18 Jan 2020, 19:09

I have a tablecloth I want the player to put on table 1 and then table 2. Each table has a "cloth" boolean attribute set to False that I want to set to True when I put the tablecloth on it. So the tablecloth object has a Put verb. So the action I want to take place is to set the cloth attribute on Table 1 to True. But I don't know how to specify a wildcard with a verb. So it'd be something like "Put tablecloth on X" And then set attribute X.cloth to True.

I'm sure this is straightforward, I'm just haven't found the solution. What's the simplest way to do that? Thanks!


mrangel
18 Jan 2020, 20:51

I believe when you give an object a verb, you can select its type to be "message", "script", or "multiple objects".

If you choose multiple objects, the verb can be used in commands like "put tablecloth with table".
You then set up a script for each object it can be used on; or a script with the name "default".

The verb has an attribute named separator, which by default is "with; using". You can change it to be something else if you want to use different words.

Note that this is easier using the desktop editor. I believe that in the web editor, you can't edit verbs directly, so if you want to play around with them you'd need to do something like:

nameofverb.separator = "on"
nameofverb.pattern = "^put (?<object>.+?)( on (?<object2>.+))?$"

in your start script.


But…
I think this will not work for "put tablecloth on table".
Quest has a built in command named put whose pattern is put #object1# on #object2#. And if the player's input matches both a command and a verb, I believe that the command wins.

You could always make the tables surfaces (on the "Container" tab), in which case objects can be put on them without needing a verb.
If you want to stop the player putting arbitrary objects on the table, a container can have a script to run when an object is added to it. You could make it something like:

if (object = tablecloth) {
  RemoveObject (object)
  this.cloth = true
  msg ("You put the tablecloth on the table.")
}
else {
  msg ("You don't want to put that on the nice clean table.")
}

Martintab
18 Jan 2020, 21:06

ICC T20 world cup 2020 will be played in Australia in 2020 for the first time. Australia will have the advantage to show something different than the previous of short format because they failed to hold the trophy of 20