Steps to make Coffee

1. Make the Drink
1. Make object (using Object button) and name the object Coffee (or whatever you want to drink).
2. Use the Program button then select the Coffee object you made. Hit the "new Verb" button. Name the verb "drink"
Set the arguments to this none none [means drink this direct object and no preposition nor indirect object]
In the programming box type these two lines or cut and paste:
"<---start copying here--->"
player:tell("You take a swig of ", this.name, ".");
player.location:announce(player.name, " takes a swig of ", this.name, ".");
"<----end copying here--->"
Hit the Compile Button. Then, test your verb by typing "drink coffee" in the MOO dialogue box.


2. Drink with Taste (tate is a property)
1. Add a property called taste to the drink. In the Program box select your object and view it. Then hit the "New Property" button. Call the property "taste". In the box the property, describe the taste of the drink --for example "cool and refreshing"

2. Now modify your original drink verb. In the Program box select your object and view it. From the verbs on your object, select "drink." Modify the verb so it looks like this:

player:tell("You take a swig of ", this.taste, " ", this.name, ".");
player.location:announce(player.name, " takes a swig of ", this.taste, " ", this.name, ".");

Keep the argument at this none none. Now, hit the Compile Button. Then, test your verb by typing "drink coffee" in the MOO dialogue box.


3. Drink with Multiple Swigs (swigs is a property) and One Taste
1. Now lets add multiple sips to the drink. Start by creating a properyt called "swigs." In the Program box select your object and view it. Then hit the "New Property" button. Call the property "swigs". In the box the property, type the number 3. this gives your drink 3 swigs.

2. Now modify your original drink verb. In the Program box select your object and view it. From the verbs on your object, select "drink." Modify the verb so it looks like this:

swigs_left = this.swigs;
if (swigs_left == 0)
player:tell("The", this.name, " is empty. You need to refill it.");
elseif (swigs_left == 1)
player:tell("You take the last swig of ", this.taste, " ", this.name, ".");
player.location:announce(player.name, " takes a big swig of ", this.taste, " ", this.name, ".");
swigs_left = swigs_left - 1;
this.swigs = left_swigs;
elseif (swigs_left == 2)
player:tell("You take another swig of ", this.name, ". It's starting to get ", this.taste, ".");
player.location:announce(player.name, " takes a big swig of ", this.taste, " ", this.name, ".");
swigs_left = swigs_left - 1;
this.swigs = swigs_left;
elseif (swigs_left == 3)
player:tell("You take a swig of ", this.taste, " ", this.name, ".");
player.location:announce(player.name, " takes a swig of ", this.taste, " ", this.name, ".");
swigs_left = swigs_left - 1;
this.swigs = swigs_left;
endif

Keep the argument at this none none. Now, hit the Compile Button. Then, test your verb by typing "drink coffee" in the MOO dialogue box.

Drink Refill Verb
1. Now since we have limited number of swigs, we have to make another verb called "refill" that will reset the number of swigs to 3. Use the Program button then select the Coffee object you made. Hit the "new Verb" button. Name the verb "refill". Set the arguments to this none none [means refill this direct object and no preposition nor indirect object]
In the programming box type these two lines or cut and paste:

"<---start pasting from here--->"
1: if (this.swigs == 0)
2: this.swigs = 3;
3: player:tell("You refill your ", this.name);
4: player.location:announce(player.name, " refills ", player.pp, " ", this.name, ".");
5: else
6: this.swigs = 3;
7: player:tell("You refill your half-full ", this.name, " and spill some all over the floor.");
8: player.location:announce(player.name, " tries to refill ", player.pp, " ", " half full ", this.name, " and spills some all over the floor.");
9: endif
"<---end pasting here-->"


Drink with Multiple Sips and Multiple Tastes
1. add properties called tasteone, tastetwo, and tastethree to the drink. Describe each taste. This way, as the amount of swigs decreases, the taste changes. Note that the orignial drink.taste property is ignored now and replaced by seperate tastes for each swig. For example, on a coffee object the last taste (called tasteone) can be described as " cold and bitter " while the first taste (called tastethree) can be described as " hot and tasty "

2. Now modify your drink verb yet again. In the Program box select your object and view it. From the verbs on your object, select "drink." Modify the verb so it looks like this:

"<---start copying here--->"
1: swigs_left = this.swigs;
2: if (swigs_left == 0)
3: player:tell("The ", this.name, " is empty. You need to refill it.");
4: elseif (swigs_left == 1)
5: player:tell("You take the last swig of ", this.tasteone, " ", this.name, ".");
6: player.location:announce(player.name, " takes a big swig of ", this.tasteone, " ", this.name, ".");
7: swigs_left = swigs_left - 1;
8: this.swigs = swigs_left;
9: elseif (swigs_left == 2)
10: player:tell("You take another swig of ", this.name, ". It's starting to get ", this.tastetwo, ".");
11: player.location:announce(player.name, " takes a big swig of ", this.tastetwo, " ", this.name, ".");
12: swigs_left = swigs_left - 1;
13: this.swigs = swigs_left;
14: elseif (swigs_left == 3)
15: player:tell("You take a swig of ", this.tastethree, " ", this.name, ".");
16: player.location:announce(player.name, " takes a swig of ", this.tastethree, " ", this.name, ".");
17: swigs_left = swigs_left - 1;
18: this.swigs = swigs_left;
19: endif

"<---stop copying here--->"

Compile and test your verb.

CONGRADULATIONS. YOU'VE PROGRAMMED A MULTIPLE VERB, MULTIPLE PROERY OBJECT!

Now you can try making a cow that gives milk. View 2 on Basic Drink Program.