CAOS Tool Introduction

1. Introduction
CAOS, or Creatures Agent Object Scripting, is the language used to code all the items in the world. It is very powerful within the game environment: it can be used to create entirely new agents for your world, alter existing ones, or even change the world itself. The only real limit is your imagination.

The CAOS Tool allows agents to be created in half the time. It can find the kind of simple coding errors that would otherwise leave you baffled for half a day, and can quickly inject and alter scripts and objects. It can also be used to view the outputs of macro commands, and view and manipulate the scriptorium.

Sadly, the CAOS Tool will not write your agent's code for you! You will still have to learn some CAOS at least. Happily, it's a fairly easy language to learn, and you can find help on this in section 7.

In the meantime, get thinking! We're sure you have some great ideas and now is the time to make your dream agent (or cheat) reality!

2. Installation
You can find a download link and instructions for activating the CAOS Tool in the CAOS Tool article.

3. The COS File Format
Many people moving up from a Creatures 2 third party cobbling program, or people entirely new to agent creation might be unfamiliar with the idea of the COS file. COS files are a text file that contains all your scripts, including event scripting, installation macros and removal code. Here is an example of a very simple COS file:

*This is the install script
new: simp 2 8 53200 "apple" 15 13 10
attr 195
bhvr 48
elas 30
accg 5
fric 100
mvto 821 769
setv ov61 25
emit 6 0.25
cmra 455 422 0



*A simple eat script
scrp 2 8 53200 12
stim writ from 78 1
snde "eat1"
kill ownr
endm

*It goes bang when you drop it
scrp 2 8 53200 6
doif wall = down
snde "dr10"
endi
endm

*Time to get rid of those apples!
rscr
enum
2 8 53200
kill targ
next
scrx
2 8 53200 12
scrx 2 8 53200 6

The install script is first in the file, and then the event scripts are added. The event scripts can be simply placed one after the other in any order after the install script has finished. The scrp command will instruct the computer that the install script has finished, and a new event script is starting. The removal script is specified with the rscr command- this is not a true CAOS command, and is only used in making COS files.

Any lines beginning with an asterisk are ignored on injection, and these comment lines can be used to remember exactly what it was you were trying to do, anyway. Users of C2 COS files will notice a few differences in the format, aside from the big differences in the language. The iscr tag is no longer necessary to specify the install script, although it won't throw up syntax errors if you like using it simply for tidiness. There is also no inst command in the install script, since install scripts are now run instantly by default. Another big difference is the lack of endm commands at the ends of both the install and removal macros. They have been done away with altogether, and including them will cause an error on injecting your agent.

If you want to see more examples of COS scripts, look in the creatures 3/bootstrap/001 World/ folder- there's lots of them. The above example script is fully injectable into the game, and will not clash with any game agents. It's also quite tasty, too.

4. CAOS Tool Colour Coding and Syntax Errors
You will notice that the COS file example above is colour coded. The CAOS Tool colours the various elements of the code according to its function:

Blue: Command

Magenta: Variable

Brown: Value

Green: Comment

Red: A Naughty Syntax Error

Syntax Errors cause an error message to appear in a pop-up window or in the error window if it has been enabled. The pop-up window will simply inform you that an error has been found, whereas the error window gives full details.

5. Breakdown of Menu Commands
Many of the menu items can also be found as buttons on the toolbar. Hold your mouse pointer over each tool button for a few seconds to see a brief description of its use in the statusbar at the bottom of the CAOS Tool's main window.

File Menu:

Edit Menu:

View Menu:

Scriptorium Menu:
NB: For any of these menu items to work, the scriptorium window must be open.

Inject Menu:

Window Menu:

This menu allows manipulation of multiple open windows within the CAOS Tool.

Help Menu:

6. Other things to consider when injecting code
It is important to remember that making the COS file is not all there is to making an agent. Unless you are using standard images and sound files from the game, you must make sure all your dependencies are created and in place before you inject your code, or the game will kill your agent. You should place all sound effects, images, genomes etc into the correct place before injecting your CAOS code. This has to be done manually- there is no compiled .agent file at this point putting everything in place for you. Tools are available on the CDN for making the extras for the game, such as the sprite builder kit for making images or the PRAY Builder for creating a .agent file that can be distributed to others as one file.

Obviously, your game needs to be running, otherwise you can't inject code into it. It is possible to inject code on the world switcher screen, but if you wish to add an object to a world, you will need to have loaded a world. It is advisable to have a test world with one or two norns in to test your new creations- that way, you won't muck up your breeding population of creatures.

7. Learning more about the CAOS language and creating your own agents
This guide to the CAOS Tool does not act as a set of tutorials for learning the CAOS language itself. There are many such tutorials available on the web, including an excellent one on the CDN website itself. Learning the language is entirely possible for a beginner, and is a good way to get into the complex world of computer programming. However, a good knowledge of the vagaries of the Windows operating system is always useful.

Once you have made your COS file, your various images and sounds and so forth, you'll probably want to publish them for the whole world to enjoy. The .agent format is ideal for doing this. Agent files contain all data needed to install a new agent into a Creatures 3 world, including all the dependant files. The user can inject your agent into their world using the Creator machine. To compile these agent files, you need to use a subset of the CAOS language called PRAY. Pray basically tells the agent compiler what exactly it is supposed to be compiling, what to stick in the file, and where to place it all when the creator is used. There is a full set of tutorials on using the pray language on the CDN website. So, get coding, and good luck!