Verb vs command

The Pixie
22 Sept 2011, 21:35
What actually is the difference between a verb and a command? If I want to add these, which do I choose, and why?

help
shoot #object#
throw #object1# at #object2#

As far as I can see, you can use both.

lelo14
23 Sept 2011, 00:53
I have the same confussion.

But if you look at the attributes that verbs have and compare with the attributes that comands have,
you will see that Verbs have two extra attributes:
isverb set to True and
script which you need to look at because I don't know enough about scripting yet to be able to read what it does

I can't figure out what either of those two attributes are used for or do but clearly comands don't have them so looks to me like a verb is special command with some extra features.

I'm looking forward to getting hearing the answer from someone who knows.

Great question.
lelo

The Pixie
23 Sept 2011, 06:54
A script is series of instructions (like if...else) and function calls; basically a mini-program.

The script attribute of verb is a script that is run for the verb. However, the content of a command is also a script, so although they are set up slightly different, the end result is that each runs a script.

Alex
23 Sept 2011, 09:27
Internally, they are both the same thing. Commands are the more basic type. They simply match a pattern, then fill in variables and run a script.

This is in fact all you really need - and the design is similar to previous versions of Quest. Up until Quest 4.0, there were no verbs at all.

However, a common pattern emerged. Generally when adding a command, most people wanted to be able to do something like "eat #object#", "drink #object#", "throw #object#", with most objects not doing anything, and a few objects having their own implementation. This was a pain to implement over and over again, as your command would have to see if the object was drinkable, throwable, whatever, then run a particular script if it was, and print a sensible message if it wasn't.

So, Quest 4.0 introduced verbs, and a similar design exists in Quest 5.0. It makes it easy to add commands of this form, as you can just add a verb to one object, and the editor will automatically create a command for you so that performing the same action on other objects gives a sensible response.

lelo14
23 Sept 2011, 18:52
Alex wrote:Internally, they are both the same thing. Commands are the more basic type. They simply match a pattern, then fill in variables and run a script.

This is in fact all you really need - and the design is similar to previous versions of Quest. Up until Quest 4.0, there were no verbs at all.

However, a common pattern emerged. Generally when adding a command, most people wanted to be able to do something like "eat #object#", "drink #object#", "throw #object#", with most objects not doing anything, and a few objects having their own implementation. This was a pain to implement over and over again, as your command would have to see if the object was drinkable, throwable, whatever, then run a particular script if it was, and print a sensible message if it wasn't.

So, Quest 4.0 introduced verbs, and a similar design exists in Quest 5.0. It makes it easy to add commands of this form, as you can just add a verb to one object, and the editor will automatically create a command for you so that performing the same action on other objects gives a sensible response.


So commands are global and verbs are local? I.E verbs are for a specific object and comands are things you can do any old time?

Alex
23 Sept 2011, 18:57
Yes that's the basic difference, if you create a command then you have one script that will run for any object passed in to the command. With a verb, you add a script for each object.