TYPE

From Creatures Wikia

Jump to: navigation, search

TYPE is a CAOS command used to find the type of a token.

Usage

Syntax: TYPE something

Returns an integer from the following list depending on what something is.

  • 0: integer
  • 1: floating point
  • 2: string
  • 3: simple agent
  • 4: pointer
  • 5: compound agent
  • 6: vehicle
  • 7: creature
  • -1: NULL agent pointer
  • -2: unknown agent - signifies an internal error

Examples

This is an obvious 'print anything' command. It prints va00.

DOIF TYPE va00 eq 0 or TYPE va00 eq 1
  OUTV va00
ELIF TYPE va00 eq 2
  OUTS va00
ELIF TYPE va00 ge 3 and TYPE va00 le 7
  DOIF TYPE va00 eq 3
    OUTS "Simple"
  ELIF TYPE va00 eq 4
    OUTS "Pointer"
  ELIF TYPE va00 eq 5
    OUTS "Compound"
  ELIF TYPE va00 eq 6
    OUTS "Vehicle"
  ELIF TYPE va00 eq 7
    OUTS "Creature"
  ENDI
  TARG va00
  OUTS " agent, class number "
  OUTV FMLY OUTS " " OUTV GNUS OUTS " " OUTV SPCS
  OUTS ", current id "
  OUTV UNID
ELIF TYPE va00 eq -1
  OUTS "NULL agent"
ELSE
  OUTS "ERROR"
ENDI
Personal tools