Object Creation

All commands used to create new objects begin with "new:"

NOTE: all new: commands change the target object to the one which has just been created, so that any further commands in the script will affect the new object and can thus be used to alter other  variables as required.


Scenery Objects

new: scen imagefile #images image# plane

Creates a scenery object.

Imagefile is a 4-byte token representing the filename of the image file in the /images directory.

#images is the total number of images in that file.

Image# is the image associated with this object.

Plane is the depth position of the object, 0 = background, 9000 = foreground.


Simple Objects

new: simp imagefile #images image# plane clone

Create a Simple Object.
Most of objects you will ever create using cobs will be simple ones, food, toys, herbs, animals are all simple objects.
Note that the default family will be set to 2.

clone is 0 normally, or 1 to create a cloned image gallery. (Sorry I'm not sure exactly what that means, so I always set it to 0)

See above for the other values.


Call Button Objects

new: cbtn imagefile #images image# plane 

Create a lift Call Button object.

See above for the other values.

Compound Objects

new: comp imagefile #images image# clone

Create a Compound Object.  Note that the default family will be set to 3, compound objects.
You must use "new: part" to add one or more parts to object as it initially has none.

Compound objects are objects with more than one part, this makes it easier to change parts of the object easily and save space in the image files used.

See above for the other values.


Compound Object Parts

new: part part# relx rely imageoffset plane

Used to add a part to the current target Compound Object.
This is best done immediately after creating the parent compound object.
After this command, the "part" value is left pointing to this part number, for subsequent part-relative commands.

part# is the part number, from 0 to 9. Zero is the default main part, and is probably essential.

relx and rely are the position of the part relative to part 0. It keeps things simple to use the coordinates 0 and 0 for part 0.

imageoffset is the base sprite for this part relative to first sprite for the object, so 1 for the next image, 2 for the one after than etc.

Plane is the Z position of the object, 0 = background, 9000 = foreground.



Vehicle Objects

new: vhcl imagefile #images image#

Create a Vehicle, a specific type of compound object.
These are usually horizontally moving objects such as the rafts for moving other objects and creatures.


Lift Objects

new: lift imagefile #images image#

Create a Lift, another specific type of compound object.
These are usually vertically moving objects such as the wooden lifts for moving other objects and creatures.


Blackboard Objects

new: bkbd imagefile #images image# bkgndcolour chalkcolour aliascolour textx texty 

Create a Blackboard, a specific type of compound object used to teach the meaning of words to creatures..

bkgndcolour chalkcolour aliascolour are the colour numbers to use for plotting text.

textx and texty are the co-ordinates of the place to plot text, relative to part 0.

Other blackboard commands can be found here.


Creature Objects

new: crea moniker sex

Create a new-born creature.

moniker is the filename of the new norn's genome file.

sex is set to 1 if the creature is to be male, 2 if it's to be female. More usually it is set to 0 if the sex is to be determined randomly.

Note: the moniker must be supplied as an integer, not a string. This is so that, for example, egg objects can store the moniker in obv0 during incubation. If you need to store a moniker in a macro as a token, then you must use the tokn command to convert it to integer.

NEW: CREA OBV0 0 create creature bred from moniker stored in the variable "obv0".
NEW: CREA TOKN EVE1 0 create from explicitly named genome file "eve1".


Genome Files

new: gene mum dad child

Create a new genome file from mum's and dad's (or just mum's if dad = 0) genomes, and store the new genome's moniker in the value child. 

Again, the token command "tokn " must be used to create an integer from the genome file name.

new: gene tokn eve_ tokn adam obv0
This will create a child of Adam and Eve and store the child's genome moniker in target object's obv0 variable.
This child genome can later be used to make a new creature (after a pregnancy and an egg)