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

NULL

From Creatures Wiki
Revision as of 00:55, 27 June 2022 by ScoobyGambit (talk | contribs) (→‎Examples)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

NULL is a CAOS command.

Usage[edit]

Syntax: NULL

Returns the null agent.

Some commands, such as TARG, OWNR, _IT_ and others, may return NULL.

You cannot act on the null agent. Attempts to do so will result in Invalid agent.

Note that NULL ne 0 because they are of different types.

Examples[edit]

Null is often used in ENUM scripts to check if the TARG agent still exists:

**This example enumerates through all creatures and kills the ownr agent if the creature no longer exists
enum 4 0 0
doif targ eq null
kill ownr
endi
next

The opposite, doif targ ne null, is used in the snotrock and Ghosthande's Hungry Critter Tutorial to help the snotrocks hunt tubas, which may vanish before the snotrock can get to them! By checking that the target agent does not not exist, the critter does not get stuck on a phantom foodstuff.