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


From Creatures Wiki
Jump to navigation Jump to search

ETCH is a CAOS command which controls flow.


Syntax: ETCH family (int) genus (int) species (int)

This marks the start of an enumeration loop, which must be ended by NEXT. It cycles through every agent which matches the classifier AND is touching the OWNR object. Whether one agent 'touches' another is decided if their bounding boxes are touching. ETCH first sets TARG, then evaluates the content of the loop, then goes on to the next agent, and so on until all agents of the given class number that are touching the object have been exhausted. In install scripts, when there is no OWNR, TARG is used instead.

Any or all of the arguments may be 0, which is a wildcard. So ETCH 0 0 0 will loop through all agents touching that object.

At the end of the loop, TARG is set to OWNR - so store the original TARG somewhere else if it's important.


For example, the capillata's doors use ETCH to STIM WRIT all creatures who went through the door with the "went through meta door" stim if the pointer activated the door:

** Only transfers all touching creatures if the pointer activated the door,
** if it wasn't the pointer then it only transfers the creature that touched it.
	doif from = pntr
		etch 4 0 0
			doif targ <> hhld and carr = null and aslp = 0 and dead = 0
				mvft va00 va01
				stim writ targ 95 1
		doif touc ownr from = 1
			doif from <> null
				targ from
				mvft va00 va01
				stim writ targ 95 1
				setv va99 0

Helen's Cob Creation Tutorials covers the ETCH concept in tutorial 7.

See also[edit]