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

REPS

From Creatures Wiki
Jump to navigation Jump to search

REPS is a CAOS command controlling flow.

Usage

REPS n (int) .. REPE

This creates a bounded loop. REPS opens the loop block and REPE closes it again. The loop block is repeated n times, and then execution continues at the point after REPE.

Examples

Output the factorial of va00:

SETV va01 1
REPS va00
  MULV va01 va00
  SUBV va00 1
REPE
OUTV va01

Create 5 seeds:

********Lets make a seed
inst
reps 5
new: simp 2 3 1000 “tutorial_seed” 1 0 5000
attr 195
bhvr 48
elas 30
fric 50
accg 3
*create some underneath the garden
doif tmvt 1950 950 eq 1
mvto 1950 950
else
*if that doesn't work, create it at the agent creator for DS
setv va00 game “CreatorX”
setv va01 game “CreatorY”
mvsf va00 va01
endi
emit 7 0.3
repe
cmrt 0

See also