What is a COS File?

Whats a COS file and how do I make one?
A COS file (Creatures Object Source) is purely a text file with a .COS extension. The contents of the file and its arrangement are what make it special, and allow it to be used with the CyberLife COB Compiler.

A COS file intended to become a COB can have up to 3 distinct parts within it; the Installation Script, the Events Scripts and the Remove Scripts.

With this in mind, the structure of a COS file can be shown as below:

*****************EXAMPLE COS FILE – this will make a ball

*** You can use asterisks for marking a line as a comment

*** and it will be ignored by the COB Compiler


******** Here’s the Installation part – use the token ‘iscr’ to mark this part of the

********the COS file as being for installation.

iscr

***Place all the commands to create the object(s) here, one command per line.

***You can use spacing and tabs to make the code more readable For example,

new: simp bal2 8 0 500 0

setv cls2 2 13 4

setv attr 199

bhvr 1 11


setv size 110

setv accg 5

setv rest 20

setv aero 5


mvto 5300 400

slim

setv grav 1

endm



********Here’s some Event Scripts – the compiler will know that the Installation part has finished by the use of ‘endm’ at the end of the ‘iscr’ section, or by the use of the ‘scrp’ command.


***ball collision

scrp 2 13 4 6

snde boi2

setv actv 0

doif wall eq 3

doif velx lt 0

anim [07654321]

endi

doif velx gt 0

anim [12345670]

endi

endi

doif wall eq 0

anim [56765]

endi

doif wall eq 1

anim [56765]

endi

doif grav eq 0

pose 0

endi

stim shou 40 8 0 0 36 50 45 50 42 50 0 0

endm


***ball activate

scrp 2 13 4 1

stim writ from 20 9 20 0 42 10 36 50 45 100 44 50

setv var0 posl

setv var1 posr

addv var0 var1

divv var0 2

targ from

setv var1 posl

targ ownr

doif var1 lt var0

rndv var2 15 25

anim [12345670]

else

rndv var2 -25 -15

anim [07654321]

endi

setv velx var2

setv vely -40

setv actv 0

endm



********Here’s the removal part – these commands will remove the physical presence of the object ********from Albia, but also remove the scripts it injected. Use the token ‘rscr’ to mark this section as ********containing the removal scripts


rscr


enum 2 13 4

kill targ

next


scrx 2 13 4 6

scrx 2 13 4 1


endm

And thats it!

The full range of CAOS commands are detailed in a different document, the purpose of this is to show that a COS file is a simple data structure and can be created with a text editor.

So how can I turn a COS file into a COB I can distribute?
By creating a COS file in the format detailed above you are essentially creating the bare bones of a COB. All that is then needed is to pass it through a COB Compiler and add the extra files needed for the object to work (images and sounds).

Some points to bear in mind when creating a COS with the intention of making a COB:

A note on classifiers:
The species aspect of the classifier has a range from 1 to 65,535 but not all of these are available for use. The table below shows the allocation of classifiers: