What it looks like

So, what does this mythical code stuff look like? Lots of mystical 1s and 0s and Greek characters? Nope. Actually, it's pretty ordinary looking. MOO code is written in lines - you enter a line at a time in the verb editor. At the end of each line is a semicolon (;). Not so scary huh? (By the way, don't forget the semicolons, they are actually important!)


The first thing we're going to look at is what a 'variable' is. They're fundamental to MOO coding - while you could conceivably do without them, your code would be totally unreadable. (See also MUSH coding ;))
Variables are used to temporarily hold values - like properties do for values you want stored permanently. You can create them out of thin air as well! A variable can have almost any name you want made up of letters and underscores. Typically make the name something that will remind you what the value it's designed to hold is when you come back to the code later.

To create a variable in your code the easiest way is:
<variable name> = <value>;
For example:
my_number = 1;

This would create a variable called 'my_number' that held the integer '1'. You can't create a variable without giving it a value at the same time - you couldn't just say 'my_number' and have a valueless variable - in the same what that properties have to contain some value.

Variables last only as long as the code in which they're created is running. To store values longer than that, write them to an appropriate property.
They also have no set 'type' that they can contain, unlike variables in a lot of other programming languages. my_number = "string value"; is quite permissible, even after creating it as a variable to store a number in.

There are some variables that are set automatically for every piece of code. They're used all the time, so here they are and what they mean.

Last modified: Wed Sep 15 23:37:01 GMT 1999