ADDS

From Creatures Wikia

Jump to: navigation, search

ADDS is a CAOS command for string concatenation.

Usage

Syntax: ADDS var (string variable) str (string)

Appends str to var.

You can only append strings onto strings, so if you want to append a number you need to use VTOS to get it as a string, first.

Examples

You could use this to append something to the text in the text part of a compound object. In the example below we are also combining our own string and something dynamically generated using CAOS.

SETS va00 PTXT
ADDS va00 "\nWe are currently operating at "
ADDS va00 VTOS BUZZ
ADDS va00 " ms/tick (ideally!)"
PTXT va00

You might like to make an animation that varies depending on circumstances. One way to do that is to use conditional execution, maybe some variables, and ANIM; another way is to use ADDS and ANMS. So just for instance, say you only want to loop this animation if ov00, which stores some state or other, is 0...

SETS va00 "6 7 8 9 10 11"
DOIF ov00 eq 0
  ADDS va00 " 255"
ENDI
ANMS va00

There are other examples using ADDS in CAOS and FILE OOPE.

See also

Personal tools