external next up previous contents index
Next: Creating an object Up: Basic MOO Programming Tutorial Previous: 8.3 MOO tutorialLevel

8.4 MOO tutorial, Level 1 (``holder'')

 

The MOO programming language is object-based (and object-oriented in the sense that permanent data and procedures are all attached to objects). So if you want to program anything, you foremost deal with objects. MOO programming is a bit different from ordinary programming as you interact directly with the MOO database. Everything you program will be stored there. In this sense you can consider your MOO client as a data base interface.

This will be shown in a simple example, a tool that will allow you:

  1. to store short bits of information
  2. to edit those bits
  3. to show those bits to other people

The product you will program has just educational purpose, but actually might want to use it for real. Carry it around and use it to remember important things to do in the MOO for example. The following transcript shows some interactions with a a tool that allready has been programmed. DON'T try out those commands now, since you first have to program something like this first ! Note that commands entered after the > are entered by the user, the rest is feedback from the MOO.

----------------------------------------------------------------------
>help holder
holder (#2108):
----
This is an exercice left for the reader!
Type @examine in the meantime....

>@examine holder
holder (#2108) is owned by MooBoy (#1324).
Aliases:  holder and memo
Information Holder
Key:  (None.)
Obvious Verbs:
  add <anything> to holder
  dump holder
  show <anything> on holder
  clear holder
  erase <anything> from holder
  g*et/t*ake holder
  d*rop/th*row holder
  gi*ve/ha*nd holder to <anything>

>dump holder

>add Improve MOO tutorial
I don't understand that.

>add Improve MOO tutorial to holder
Inserted ''Improve MOO tutorial'' to holder

>dump holder
1: Improve MOO tutorial

>add changer le dump verb (feedback si le holder est vide) to holder
Inserted ''changer le dump verb (feedback si le holder est vide)'' to holder

>show 2 on holder
MooBoy shows item 2 on holder: changer le dump verb
feedback si le holder est vide)

>add test to holder
Inserted ''test'' to holder

>dump holder
1: Improve MOO tutorial
2: changer le dump verb (feedback si le holder est vide)
3: test

>erase 3 from holder
You erased element 3: "test" from holder

>clear holder
Do you really want to erase all information bits? [Enter `yes' or `no']
>no
OK, information onholder was too important for erasing
----------------------------------------------------------------------

Remember the goals we want to achieve in order to understand why we are programming all the following features. The tutorial in this section will take some time (count four hours at least and more if you never did any programming before). Also note that you maybe will not understand everything in a first go. To really understand what you did you should add new functionalities to this objects once are done with the tutorial (or else program something else). So let's start:





Daniel K. Schneider
Thu Apr 17 12:43:52 MET DST 1997