Robot: Difference between revisions

From MZXWiki
Jump to navigation Jump to search
m (Reverted edits by Sharpnova (Talk); changed back to last version by Wervyn)
 
mNo edit summary
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''Robots''' are the main power behind any [[MegaZeux|MZX]] games that are more than rudimentary, and are analogous to Objects in [[ZZT]].  Their use provides a unique approach to game programming by naturally encouraging game designers to divide their program code into discrete, self-contained parts which effectively run as separate threads.  Robots are often used to represent objects and actors within the game, to govern effects and changes to the game world, and to implement [[Engine|engines]].  Robot code is written in Megazeux's own programming language, [[Robotic]], and its uses can be surprisingly versatile given the kludgy nature of the language itself.
{{ID
|name = Robot
|id = 124
|robotic = Robot
|color = none
|param = storage object ID
|idchar = 0
|active = y
|effect_touch = Receive <code>(#)TOUCHED</code>
|special_shot = Receive shot label(s)
|special_bombed = Receive <code>(#)BOMBED</code>
}}
[[Category:MegaZeux]] [[Category:MegaZeux built-in objects]] [[Category:Objects]]


[[Category:MegaZeux]]
[[Robot|Robots]] (ID 124, <code>Robot</code>) 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.
{{stub}}
 
Robots are often used to represent objects and actors within the game, to govern effects and changes to the game world, and to implement [[Engine|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|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==
{{ID
|name = Pushable Robot
|id = 123
|robotic = PushableRobot
|color = none
|param = storage object ID
|idchar = 0
|active = y
|pushable = any
|effect_touch = Receive <code>(#)TOUCHED</code>
|special_pushed = Receive <code>(#)PUSHED</code> (if pushed by [[Player]])
|special_shot = Receive shot label(s)
|special_bombed = Receive <code>(#)BOMBED</code>
}}
[[Robot|Pushable Robots]] (ID 123, <code>PushableRobot</code>) 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==
In [[ZZT]], the equivalent element to Robot is [[zzt:Object]], which uses a different and non-compatible scripting language.

Latest revision as of 21:11, 14 June 2025

Robot # 124 Id124.png
Robotic name Robot
Default color none
Default param storage object ID
ID char 0 (#124)
Attributes Active
Effect when
touched
Receive (#)TOUCHED
Special when
shot
Receive shot label(s)
Special when
bombed
Receive (#)BOMBED

Robots (ID 124, Robot) 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 Robot # 123 Id123.png
Robotic name PushableRobot
Default color none
Default param storage object ID
ID char 0 (#123)
Attributes Active
Pushable: any
Effect when
touched
Receive (#)TOUCHED
Special when
pushed
Receive (#)PUSHED (if pushed by Player)
Special when
shot
Receive shot label(s)
Special when
bombed
Receive (#)BOMBED

Pushable Robots (ID 123, PushableRobot) 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

In ZZT, the equivalent element to Robot is zzt:Object, which uses a different and non-compatible scripting language.