Robotic Tutorial

From MZXWiki
Jump to navigation Jump to search

Robotic has a few concepts that you must understand before you begin to program in it. You can skip this if you want, but it will help you learn robotic much faster. A large portion of this will be obvious to anybody who has ever programmed in any language or used computers extensively.


You can have one command per line. A command is an instruction to MegaZeux or the Robot telling it to do something. A program is a series of commands, that are run right after another.


A parameter is the part of the command that you can change, such as numbers or colors. They specify how the command should be run or what it should effect. For example, in the command:


WAIT is the command, and 6 is the parameter. Many commands have multiple parameters. Parameters are often specified using #, "string", or [color] [char] etc.


A label is a point in a robotic program that has been given a name. It is used as a reference point so the robot can return to that point at any time, to allow repeating sections of commands, etc. Labels are written as follows: :"label".


A message is something one Robot sends to another, or an external event sends to a Robot, to tell it to do something. That something entails jumping to the label corresponding to that message. For example, a Robot can tell another Robot to "Bounce"; That Robot will not be executing commands starting at the label: "Bounce".


X/Y coordinates are a pair of numbers representing a point on the current board. 0/0 is the upper left corner of the board, and the coordinates increase going down and right. You can find coordinates easily using Alt+Y in the editor, or F6 in the game, but only if the game was run through the editor. X/Y coordinates can be negative, but this is uncommon, and used for special purposes only (e.g. REL commands).


A string is a series of letters or characters, inside quotes. For example, "STRING", "Booga!", "MegaZeux dndndn", or "[[]]".


A character is a single symbol, letter, number, punctuation mark, space, graphic, etc. All things are viewed as single characters. When using single characters in Robotic, they must be enclosed in apostrophes: 'X'. Certain characters must be inputted in specific ways to avoid problems with Robotic:

  • \0 for character 0 (probably doesn't work in strings, but does for chars.)
  • \t for tab (character 9)
  • \n for newline (character 10)
  • \r for carriage return (character 13)
  • \" for quotation mark
  • \\ for slash