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

GRID

From Creatures Wiki
Jump to navigation Jump to search

GRID is a CAOS command used in Creatures 3 and Docking Station to allow the coder to examine things about the room next to the agent in four given directions.

Syntax[edit]

GRID (integer) agent (agent) direction (integer)

Returns the ID of a room adjacent to the agent in the given direction. A straight line is drawn from the centre of the agent until it hits a room. Directions are LEFT, RGHT, _UP_, or DOWN. A value of -1 is returned if no room can be found.

Examples[edit]

From the grasshopper:

	setv va60 prop grid ownr left 5
	setv va61 prop grid ownr rght 5
	doif va60 > va61
		setv ov10 1
	elif va60 < va61
		setv ov10 -1
	endi

This helps the grasshopper avoid bodies of water - it checks the level of CA 5 (bodies of water) to its left and right, then sets ov10 (the variable containing the direction the grasshopper moves) depending on which direction smells less like water.

See also[edit]