Creating A Simple Cob

Most cobs have an installation script, here is an example taken from Daniel Smallman's Pear Tree cob.

The  script itself Description and translation
inst Despite what many people believe, this means "instant" not "install". It makes sure that the rest of the script is executed instantly without interruption. You only need to place this once, at the beginning of the script.
new: simp petr 4 0 0 0 new: tells the program this command is to create a new object in the world

simp means the object being created is a simple one (as are most) as opposed to a compound one that is composed of several parts

petr is the name of the sprite file containing the images for this object. This must be four letters with no directory name or extension, the file must be in the /images directory.

4 tells the program that four images from the sprite file are to be used by this object

0 is the number of the first image in the sprite file to be used by the object (so in this case the images 0, 1, 2 and 3 are used)

0 is the "plane" of the object, i.e. the layer it occupies. An object with plane 0 is placed right in the background. There is a range of plane coordinates right up to 9000 which is right at the foreground.
It is worth noting that newer objects are placed on top of older ones even if they share the same plane.

0 the last number is the clone number, no one seems to understand this fully so make sure you leave it at 0 
setv clas 33835776 setv is short for "set variable"

clas is the classification variable for that object

33835776 is the number used to classify this object. It is calculated from the genus, family and species numbers, Bobcob has a function to calculate this.

It is important you give each object a unique class otherwise removing it becomes difficult and it means you cannot attach any other scripts to it without overwriting another object's scripts.

setv attr 64 setv setting a new variable

attr is the attribute variable, meaning the physical properties of the object. (such as visibility, movability, gravity)

64 is the number calculated by adding all the numbers corresponding to the attributes you want for the object
Bobcob has a function to calculate this too!
bhvr 1 0 bhvr is the behaviour variable, but does not require a "setv" preceding it

1 the first number is how the object interacts with the user. 1 means you can click on it to activate it

0 the second number is how the object interacts with creatures.
0 means that creatures cannot interact with this object.
mvto 5440 910 mvto stands for "move to". it is essential that you set coordinates for each object or they will remain in the initial position (left of the moon)

5440 the first digit is the X coordinate, in this case it is in the jungle area.
X-Y Locator cob is useful to find coordinate positions.

910 is the vertical coordinate (0 being at the top of the sky), in this case it is just above ground level

Note that the coordinates given are where the top left hand corner of the object are placed, so to have an object appear on the ground you must give coordinates for the top the object above the ground.
sys: cmra 5040 610 sys: tells us that this is a system command

cmra is the command for moving the camera (the current view we have of Albia)

5040 is the X coordinate

610 is the Y coordinate

Note again that the coordinates are for the top left corner of the screen, not the centre.

mesg writ targ 8 This is not a command typically used in an installation script, it sends a message to itself to trigger script 8.

mesg message command

writ "writes" or sends the message (as opposed to using "shou" or shout to broadcast the message to all objects within earshot)

targ means to send the message to the current target object, as we have just created an object, the target is automatically set to the created object

8 is the message to be sent, which is one that tells the object it has entered the game, most likely to trigger further scripts. More often I find adding a tick command is easier.


endm probably stands for "end module" and must be placed at the END of EVERY script, this is important.