Robot: Difference between revisions

From MZXWiki
Jump to navigation Jump to search
(Rewrite Robot article.)
(Add Pushable Robots section.)
Line 5: Line 5:
==Behavior==
==Behavior==
Robots execute a number of [[commands]] in their Robotic script every cycle determined by the current value of the [[COMMANDS]] counter. When a command halts the program—either temporarily through a [[cycle|cycle-ending]] command such as [[WAIT]], or indefinitely through [[END]]—or when the commands limit is reached, the Robot automatically yields execution to the next object on the board. This makes Robots analogous to [https://en.wikipedia.org/wiki/Coroutine cooperative coroutines] in other programming languages.
Robots execute a number of [[commands]] in their Robotic script every cycle determined by the current value of the [[COMMANDS]] counter. When a command halts the program—either temporarily through a [[cycle|cycle-ending]] command such as [[WAIT]], or indefinitely through [[END]]—or when the commands limit is reached, the Robot automatically yields execution to the next object on the board. This makes Robots analogous to [https://en.wikipedia.org/wiki/Coroutine cooperative coroutines] in other programming languages.
==Pushable Robots==
[[Robot|Pushable Robots]] are an alternate ID of Robots. The only difference between Robots and Pushable Robots is that Pushable Robots can be [[pushing|pushed]] by the [[Player]] and other things, whereas regular Robots can not be pushed.
Other alternate Robot states, such as [[locking]], [[lavawalking]], and [[goopwalking]], are handled through internal state variables instead.


==ZZT connection==
==ZZT connection==

Revision as of 01:04, 29 May 2025

Robots are built-ins which are capable of executing Robotic scripts. They are the most powerful type of built-in, and the main power behind all but the simplest MegaZeux games.

Robots are often used to represent objects and actors within the game, to govern effects and changes to the game world, and to implement engines.

Behavior

Robots execute a number of commands in their Robotic script every cycle determined by the current value of the COMMANDS counter. When a command halts the program—either temporarily through a cycle-ending command such as WAIT, or indefinitely through END—or when the commands limit is reached, the Robot automatically yields execution to the next object on the board. This makes Robots analogous to cooperative coroutines in other programming languages.

Pushable Robots

Pushable Robots are an alternate ID of Robots. The only difference between Robots and Pushable Robots is that Pushable Robots can be pushed by the Player and other things, whereas regular Robots can not be pushed.

Other alternate Robot states, such as locking, lavawalking, and goopwalking, are handled through internal state variables instead.

ZZT connection

Robots are analogous to Objects in ZZT.