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

ESEE

From Creatures Wiki
(Redirected from Esee)
Jump to navigation Jump to search

ESEE is a CAOS command which controls flow. It is used in Creatures 2 and in Creatures 3/Docking Station.

Usage[edit]

Syntax: ESEE 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 which can be 'seen' by the original agent. Whether an agent can be seen by the agent which is doing the counting is determined as follows: an agent can see another agent if it is within range, its permeability allows it to see through all intervening walls, and for creatures, the ATTR Invisible isn't set.

The counting cycle works by first setting TARG, then setting the limits, then evaluating the content of the loop, then going on to the next agent, and so on until all agents of the given class number within the limits have been exhausted.

Any or all of the arguments may be 0, which is a wildcard. So ESEE 0 0 0 will loop through all agents within the limits of the counting agent.

At the end of the ESEE loop, in C3/DS, TARG is not set to OWNR. For smart vendors, it's important to manually reset the TARG to OWNR.

When ESEE is used in installation scripts, where there is no OWNR, TARG is used instead.

In Creatures 2, all commands between ESEE and ENUM run instantaneously. CDN archive

A common CAOS error that can occur with ESEE is 'Invalid targ', if the TARG stops existing before the ESEE loop is finished counting. To avoid this, place the ESEE-NEXT loop pairing between an INST and a SLOW:

INST
ESEE blah blah blah..
*Do something here
NEXT
SLOW

Example[edit]

In this example, from the Full Lifecycle Plant's special vending script, the script is LOCKed to prevent interruption, a RNGE of 30 is set, and then a temporary variable is set to 0, then esee is used to count all instances of the fruit (2 8 1000) within the 30 pixel range. Note that the ESEE loop is closed with a NEXT, and that the TARG is explicitly set back to OWNR (as typically ESEE-NEXT loops will leave TARG as the last object counted). Then the temporary variable is checked to allow for vending.

scrp 2 4 1000 1000
	lock
	rnge 30
	setv va66 0
	esee 2 8 1000
		addv va66 1
	next
	targ ownr
	doif va66 le 4

See also[edit]

  • ENUM - catch-all enumeration loop
  • ETCH - 'touching' enumeration loop
  • EPAS - vehicle's passengers
  • ECON - port connections
  • STAR
  • SEEE