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

CHEM

From Creatures Wiki
Jump to navigation Jump to search
CHEM
This article is about a CAOS command or function.
Category Creatures
Version C1/C2/CV/C3/DS
Command
Parameters
Function
Parameters
Return type [[CAOS types|]]
Related
CAOS
Concepts Stimulus

CHEM is a CAOS command used to output or change the amount of a given chemical in a creature's bloodstream.

CHEM for Output

Syntax: CHEM chemical#(int)

Used in place of a numeric constant or variable.

Returns the amount of the given chemical# in the creature's bloodstream.

CHEM for Input

Syntax: CHEM chemical#(int) amount(signed float)

Standalone command.

Changes the chemical# (from the C3 chemical list) selected in the creatures bloodstream by the amount specified, this can be negative numbers to remove a chemical from a creature's bloodstream, however the final amount in the creature's bloodstream cannot drop below 0.

Examples

CHEM being used in the command line to output the amount of 'life' in the selected creature's bloodstream:

TARG NORN OUTV CHEM 125 

Being used to delete the selected creature if it has less than 0.1 'life' in its bloodstream:

TARG NORN
SETV va00 CHEM 125
DOIF va00 < 0.1
  KILL NORN
ENDI

Being used to add 0.25 to the amount of life in a creature's bloodstream:

TARG NORN
CHEM 125 0.25

Being used to remove 0.5 from the amount of cyanide in a creature's bloodstream:

TARG NORN
CHEM 67 -0.5

Being used in addition to a stimulus to give extra chemicals (a full mole of water and a little Vitamin C):

scrp 2 21 1000 1
stim writ from 97 1
targ from
chem 33 1
chem 99 0.1
targ ownr
endm