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

MESG WRT+

From Creatures Wiki
Revision as of 17:49, 6 February 2022 by Allekha (talk | contribs) (→‎Examples)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

MESG WRT+ is a command that allows to run a script in an agent or creature outside of the currently active script. It sends a message to the agent the script points at.

Usage[edit]

Syntax: MESG WRT+ (command) AGENT (agent) MESSAGE_ID (integer) _p1_ (anything) _p2_ (anything) DELAY (integer)

Send a message with the parameters _p1_ and _p2_ to another agent. Waits DELAY ticks before sending the message. The message_id can be either from the table of message numbers or a custom number.

Examples[edit]

In the script that expels a random bacteria from a creature when it coughs or sneezes:

*where va03 is the creature's x position
*va04 is the creature's y position
*and targ is a random bacteria attached to the creature
mesg wrt+ targ 101 va03 va04 0

This calls script 101 on the bacteria, which can in turn call another bacteria script to copy the expelled bacteria in some cases:

*_p1_ and _p2_ are the x and y position sent by the above code
mesg wrt+ ownr 100 _p1_ _p2_ 0

See also[edit]

External links[edit]