Welcome to the Creatures Wiki! Log in and join the community.

caos.syntax

From Creatures Wiki
Jump to navigation Jump to search


The caos.syntax file is found in Docking Station and is Zlib-encoded CreaturesArchive data.

Format[edit]

caos.syntax is little-endian encoded, like other Creatures file formats. All strings are preceded by a 4-byte integer stating their length. The length of a string can be 0.

It begins as follows:

type description
uint32 CreaturesArchive file version (0x0c = Creatures 3, 0x27 = Docking Station)
uint32 caos.syntax file version (0x6)
uint32 version length
char[version length] version
uint32 number of categories
uint32 category #1 length
char[category #1 length] category #1
...
uint32 number of event names
uint32 event name #1 length
char[event name #1 length] event name #1
...
uint32 number of groups
Group[number of groups] groups

The first group is all toplevel commands (those which don't return any value), followed by commands returning integers, variables, floats, strings, and finally agents. These standard groups are followed by groups corresponding to namespaced commands as defined earlier in the file — e.g. the _CD_ namespace is defined in the toplevel group and the integers group, so there are two more groups for _CD_ subcommands that return nothing, and _CD_ commands that return integers, respectively.

Group

type uint32
uint32 number of commands
CommandInfo[number of commands] commands

CommandInfo

type description
uint32 index, incrementing within group
uint32 name length
char[name length] name
uint32 signature length
char[signature length] signature, string, with one character per argument. control flow commands start this with "-". namespaces have "*".
uint32 control flow id, unique to control flow commands, otherwise zero
uint32 namespace id, corresponding to the command group for associated subcommands, otherwise zero
uint32 argument names length
char[argument names length] argument names, space-delimited
uint32 category
uint32 description length
char[description length] description
uint32 command group index

The signature string has the following format:

  • "-" starts signature of all control flow commands
  • "*" subcommand
  • "#" label
  • "a" agent
  • "b" bytestring
  • "c" condition
  • "d" decimal
  • "f" float
  • "i" integer
  • "m" anything
  • "s" string
  • "v" variable