EON's tutorial


Chamber 6: A Temporary Room to House Moo Tutorial
If you've been made a programmer, you can learn to program in moo here. Type "Play 1 on tv" to begin.
Objects in this room:
  Nissan 240 SX            Generic TV               
  Ronnie's vcr             look at me               
>turnon generic tv
Only_b turns on Generic TV.
>tune generic tv to 11
Only_b tunes Generic TV to channel 11.
>sch generic tv
Only_b consults the tv schedule. .
Cdr and paulb haven't really worked out much of a schedule yet, but when they do this is where you can find it!
However, the following tapes in the MMTV Studio Library can be viewed at ANY time. Just tune your tv to channel 11, turn it on, and 'play  on tv'.
 
1    Coding with Cdr - Part 1       Greg_Swan      
2    Coding with Cdr - Part 2       Greg_Swan      
3    Coding with Cdr - Part 3       Greg_Swan      
>play 1 on generic tv
Only_b selects the tape <> for viewing..
 
[on Generic TV]                * * * * * * * * * *
 
[on Generic TV]                    MMTV  Presents
 
[on Generic TV]                    Coding with Cdr!
 
[on Generic TV]           A MOO Programming Tutorial
 
[on Generic TV]              for Absolute Beginners
 
[on Generic TV]                        Part 1
 
[on Generic TV]                * * * * * * * * * *
 
[on Generic TV]      cdr says, "Hi!  I'm cdr. I'm here to help you learn to program in MOO!  This tutorial is for Absolute Beginners,  no previous programming experience in any language is assumed!"
 
[on Generic TV]      cdr says, "MOO, despite all the Bovine jokes you may have heard or made yourself, actually stands for 'Multi-user Object Oriented' programming language..."
 
[on Generic TV]      cdr says, "MOO is kind of a cross between C++ and LISP, but much easier to learn.  When you learn to program in  MOO you can build all kinds of fun things here on mediaMOO!"
 
[on Generic TV]      cdr says, "This is an INTERACTIVE tutorial!  You will actually be coding a program while you watch the tape!"
 
[on Generic TV]      cdr says, "Here's how it  works. I will suggest a line or two of code for you to write.  I will then ask you to pause the tape and actually enter the code before resuming your viewing. "
 
[on Generic TV]      cdr says, "To pause or resume viewing this tape at any time type   PAUSE TVNAME  or  RESUME TVNAME.   Why not practice doing it now.. "

[on Generic TV]      cdr says, "Were you able to pause and resume without problems? Great! Let's get started."

[on Generic TV]      cdr says, "Oh, I just remembered. . Many people prefer to have the tv pause automatically after each line.  If you would like to try this type 'autopause tvname'.  Type resume to continue each time..."

[on Generic TV]      cdr says, "For our first programmed object let's make a Box of Donuts!  It's real easy. Just type  '@create $thing  named Box of  Donuts,donuts'.  Pause the tape and make that box right now!  I'll wait for you..."

[on Generic TV]      cdr says, "Did you do it? Type 'inv' to look at your inventory to make sure you've got it.  You should see it listed there. "
 
[on Generic TV]      cdr says, "In the language of object oriented programming you just made a 'child' of the generic object $thing.  The word 'donuts' is the alias or nickname for your object."
 
[on Generic TV]      cdr says, "Lets make sure that nickname 'donuts' really works.  Type 'drop donuts'."

[on Generic TV]      cdr says, "Now  'look donuts'. "
 
[on Generic TV]      cdr says, " Hee, hee....Not a very appetizing description  so far is it.."
>pause generic tv
Only_b pauses Generic TV momentarily. . .
>@create $thing named Box of Donut, donuts
You now have Box of Donut (aka donuts) with object number #3015 and parent generic thing (#5).
>drop donuts
You drop Box of Donut.
>exam donuts
Box of Donut (aka #3015, Box of Donut, and donuts)
Owned by Only_b.
(No description set.)
Obvious verbs:
  g*et/t*ake donuts
  d*rop/th*row donuts
  gi*ve/ha*nd donuts to 
>resume generic tv
Only_b resumes viewing the tape.

[on Generic TV]      cdr says, "Lets change that boring description! Type  @describe donuts as "You see a box of yummy scrumptious donuts begging to be eaten".  Pause the tape and do it.  I'll wait..."

>@describe donuts as "You see a box a yummy begging to be eatenn... but not by you !
Description set.
>look donuts
You see a box a yummy begging to be eatenn... but not by you !
>resume generic tv

[on Generic TV]      cdr says, "The next thing we'll do is create several kinds of donuts for inside the box. Type a line like the one that follows adding as many donut descriptions as you wish."

[on Generic TV]      @property donuts.kinds {"yummy cherry donut","tasty mooberry croissant","creamy custard donut"}

 
[on Generic TV]      cdr says, "What we just did was add a property called 'kinds' to the object 'box of donuts'.  This property is a list of 3 donut descriptions."


>@property donuts.kinds {"yummy strawberry donut", "creamy chocolate donut", "almost crunchy sugar donut" }

>look donuts
You see a box a yummy begging to be eatenn... but not by you !
 
[on Generic TV]      cdr says, "Now let's see if you were successful.  Type  '@dump donuts'    Do you see a property called 'kinds'  with the correct donut descriptions?  If you don't, try adding the property again..."
>@dump donuts
;;#3015.("key") = 0
;;#3015.("aliases") = {"Box of Donut", "donuts"}
;;#3015.("description") = "You see a box a yummy begging to be eatenn... but not by you !"
;;#3015.("object_size") = {0, 0}

"***finished***
 
[on Generic TV]      cdr says, "Now that we have added the property, let's practice talking like real MOO programmers and describe what we did"
 
[on Generic TV]      cdr says, "Repeat after me: 'We added the PROPERTY 'kinds' to the OBJECT 'donuts' and INITIALIZED the  property's  VALUE to a LIST of  CHARACTER STRINGS describing various donuts'    Hey!  Are we cool or what!"

>@property donuts.kinds {"creamy chocolate donut","yummy strawberry dontu","alomost crunchy sugar donut"}

Property added with value {"creamy chocolate donut", "yummy strawberry dontu", "alomost crunchy sugar donut"}.

>'We added the PROPERTY 'kinds'\
> to the OBJECT 'donuts' and INITIALIZED the  property's  VALUE to a LIST of  CH\
>ARACTER STRINGS describing various donuts'

 
[on Generic TV]      cdr says, "Now let's see if we can add an EAT verb to our donuts object so we can gobble up some of those donuts!   Our EAT verb  might be called like this 'eat donuts'.  "
 
[on Generic TV]      cdr says, "To create the verb type        '@verb donuts:eat this'       Pause and do it now."
 
[on Generic TV]      cdr says, "To verify that you have created this verb, type  '@verbs donuts' and you should see it listed.. ok?"
 
>@verb donuts:eat this
[on Generic TV]      cdr says, "Now lets make the verb DO something!  When a player eats a donut let's have the player choose a donut kind at random and gobble it up."
 
[on Generic TV]      cdr says, "I will show you the complete program but don't type it in just yet...  Here it is:"
 
[on Generic TV]      

 donut_choice = this.kinds[random(3)];
 player.location:announce_all(player.name," gobbles up a ",donut_choice,".");

[on Generic TV]      cdr says, "Let's talk about what's happening here before we try to enter the code..."
 
[on Generic TV]      cdr says, " In line 1 random(3) generates a random number from 1 to 3. ( If you had 5 donuts in your box you would make this random(5).)  Let's suppose the function came up with the number 2.."
 
[on Generic TV]      cdr says, "The variable 'donut_choice would then be set to the second item in the list 'this.kinds', that is, the value of 'donut_choice' would now be "tasty mooberry croissant""
 
[on Generic TV]      cdr says, "When a player eats a randomly selected donut everyone in the room should be informed of this event.  This is the job of the second line."
 
[on Generic TV]      cdr says, "In line 2 'player.location'   is the location of the player who is eating the donut, usually some room."
 
[on Generic TV]      cdr says, "The verb 'announce_all'  is a verb defined for all rooms and it means 'tell everybody in the room'  something or other.. "
Only_b [to We]: added the PROPERTY 'kinds'\
 
[on Generic TV]      cdr says, "If Jill had typed 'eat donut'  all players in the room (including Jill) would see 'Jill gobbles up  a tasty mooberry croissant.'"
 
[on Generic TV]      cdr says, "Now lets program that verb!  You will need to type in the three lines I will show you  followed by a period on a line by itself."
 
[on Generic TV]      cdr says, "The first line actually creates a new verb named EAT and assigns it to the object 'donuts'.  You will be  prompted for the remaining two lines. Don't forget to end with a period on a separate line.."
 
[on Generic TV]      cdr says, "Pause the tape now and try entering the program:"

>@verbs donuts
;verbs(#3015) => {"eat"}
>@edit donuts:eat
Verb Editor

Do a 'look' to get the list of commands, or 'help' for assistance.

@program donuts:eat
Now programming Box of Donut:eat(0).
[Type lines of input; type `.' on a line by itself to end; `@abort' cancels.]
>donut_choice=this.kinds[random(3)];
>player.location:announce_all(player.name,"gobbles up a",donut_choice,".");
>.
0 errors.
Verb programmed.
.
 
[on Generic TV]      cdr says, "If you were not so lucky you got some cryptic message about a parse error or whatnot.  Just try again.."
>resume generic tv
 
[on Generic TV]      cdr says, "Now let's try out that verb.  Type 'eat donuts' 3 or four times.  Yum Yum!  Congratulations! You are on your way to becoming a true blue MOO programmer!"
 
>eat donut
Only_bgobbles up acreamy chocolate donut.
>eat donut
Only_bgobbles up ayummy strawberry dontu.
>eat donut
Only_bgobbles up aalomost crunchy sugar donut.
>eat donut
Only_bgobbles up aalomost crunchy sugar donut.
>eat donut
Only_bgobbles up ayummy strawberry dontu.
>eat donut
Only_bgobbles up ayummy strawberry dontu.
>resume generic tv
 
[on Generic TV]      cdr says, "Next time we will introduce some more fun features of the MOO language and we'll learn how to use the editor!  Until then, HAPPY MOOING!"
>resume generic tv
 
[on Generic TV]      cdr says, "Bye bye!"
>resume generic tv
 
[on Generic TV]                 >> END OF TAPE <<
>



Back to EON's programming

E.F.B