User:Nanobot/DEV ZZT-oop command
Become
[edit]Usage: BECOME <entity>
The object turns into the given entity. Its code is deleted, and it may no longer perform its pre-stated functions, even if changed back into an object.
If the object becomes an element with stats, its parameters are set to 0 and its cycle interval is set to the default for the specific new element.
Related Topics: Elements, Entities
Bind
[edit]Usage: BIND <objectname>
The object sets its length value to the negative of the appearance number of the first stat element with the specified object name that appears in the board’s data. It begins to use that object’s code for the commands it executes. It doesn’t copy it, but rather uses the exact same place in the data to read its functions to perform.
Commands that alter the code (Zap or Restore) for one object also affect the object that is bound to it.
A major advantage of using the Bind command is it takes up less memory than having a copy of the code for the other object. If the board size approaches a dangerous size (17 kB or more) or the world approaches a dangerous size (250 kB or more), proper use of the Bind command can significantly reduce the size.
Change
[edit]Usage: CHANGE <entity> <entity>
Every instance of the first specified entity on the active board is changed into the second specified entity. If the color is not specified in the second entity, the result color will be the color of the preexisting entity.
If any of the new elements default with stats, the parameters are all set to zero and their cycle intervals are set to their defaults.
Related Topics: Elements, Entities
Char
[edit]Usage: CHAR <integer>
The object’s first parameter (the display character parameter) is set to the given integer, thus changing the object's appearance. The integer must be a single byte's length (between 0 and 255).
Clear
[edit]Usage: CLEAR <flagname>
The first active flag with the given flag name is removed from the data, thus deactivating it and adding space for another flag to be set in its place.
Cycle
[edit]Usage: CYCLE <integer>
The object’s cycle interval is set to the given integer. The integer must be a single byte's length (between 0 and 255), and the object won’t accept 0. The higher the number is, the slower the object executes its code.
Die
[edit]Usage: DIE
The object clears its code from the board data and turns itself into an empty.
End
[edit]Usage: END
The object sets its current instruction value to –1. By doing this, the object stops executing any further commands. Besides continuing the Walk function, it won’t do anything until something else causes it to react by sending it to a label.
End game
[edit]Usage: ENDGAME
The health is set to 0. The player then reacts to this by speeding up to game to maximum speed (speed 8), displaying the game over message, and rejecting the regular keyboard input functions.
Give
[edit]Usage: GIVE <status> <integer>
The specified status value is incremented by the given integer. The integer must be between 0 and 32767.
Related Topics: Status Counters
Go
[edit]Usage: GO <direction>
The object moves one space in the given direction and terminates the cycle. If it is blocked, it simply waits until it can move and then does so. No further code will be executed until either it completes the move (the cycle after the move is completed) or an outside element sends it to a label.
Related Topics: Directions
Idle
[edit]Usage: IDLE
The object terminates the cycle.
The IDLE command is effectively the same as #GO IDLE
and /I[DLE]
.
If
[edit]Usage: IF <condition> {<operator>|<command>}
The object tests if the given condition is true, in which case it executes the given command or operator. The command automatically assumes a "#" operator if none is given and the first word is a valid command name. If the condition is not true, it simply ignores to rest of the line and continues with the next line of code.
Related Topics: Conditions, Operators
Lock
[edit]Usage: LOCK
The object sets its second parameter to 1. By doing this, the object isolates itself from outside influence by rejecting any attempts to send it to a label. Until the Unlock command is used, nothing beside the object itself can cause the object to jump to another label. It still accepts its own Send commands.
Play
[edit]Usage: PLAY <string>
The given string of notes is played on the PC Speaker. If notes are already playing, it will append the given string to the currently playing one. The object continues through the code immediately without waiting for the music to play through. If the string of music in memory is maxed out, the rest of the string will be discarded and left unplayed.
Related Topics: Music Parameters
Put
[edit]Usage: PUT <direction> <entity>
The specified entity is placed to the given direction of the object. It will overwrite any preexisting element in that direction, with the exception of the player. If the color is not specified in the entity, the result color will be the color of the preexisting element.
There is a bug that disables an object from putting something in the bottom row of a board. This may simply be an error in ZZT regarding the bounds checking for the edge of boards (the y coordinate may just be off by one). Objects cannot use the Put command for putting anything in the bottom row of the board or off the edge of the board anywhere.
Related Topics: Directions, Elements, Entities
Restore
[edit]Usage: RESTORE <location>
Every instance of '<label>
in the object in the first part of the given location is changed into :<label>
. Labels that have been disabled with the Zap command are enabled again.
Related Topics: Locations
Send
[edit]Usage: [SEND] <location>
An object is sent to the given location, so its code will begin running from there. Locations may include the object’s name or reference, and the name of the label.
It is notable that the word Send is optional, meaning that the word "SEND" may be completely omitted.
Related Topics: Locations
Set
[edit]Usage: SET <flagname>
The first empty flag space is set with the given flag name. That flag name is then active for If commands. The flag may be removed using the Clear command.
A single flag name may be set more than once, taking up more than one flag space. If there are more than one flag of a single flag name set, If commands still treat it as one flag, so it is always recommended to make sure that only one is set at any time in order to save space for more.
Shoot
[edit]Usage: SHOOT <direction>
The object places a white-on-black enemy bullet moving in the given direction to the given direction if it isn’t blocked.
Related Topics: Directions
Take
[edit]Usage: TAKE <status> <integer> [{<operator>|<command>}]
The specified status value is decremented by the given integer. If the integer is smaller than the specified status value, the optional command or operator given is executed and the value remains unchanged. The command automatically assumes a "#" operator if none is given and the first word is a valid command name. The given integer must be between 0 and 32767.
Related Topics: Status Counters, Operators
Then
[edit]Usage: THEN {<operator>|<command>}
The given command or operator is executed normally.
The Then command was originally made as an optional appendage to the If command, but it isn't necessary.
Related Topics: Operators
Throw star
[edit]Usage: THROWSTAR <direction>
The object places an enemy star with a life of 100 cycles moving in the given direction to the given direction.
Related Topics: Directions
Try
[edit]Usage: TRY <direction> [{<operators>|<command>}]
Similarly to the Go command, the object attempts to move in the given direction. However, if it cannot move it will simply continue executing its code. If a command or operator is given, it will execute it if it is unable to move in the given direction. The command automatically assumes a "#" operator if none is given and the first word is a valid command name.
Related Topics: Directions, Operators
Unlock
[edit]Usage: LOCK
The object sets its second parameter to 0. By doing this, the object begins allowing outside elements to send it to labels within its code. This is used to undo what the Lock command does.
Walk
[edit]Usage: WALK <direction>
The object sets its x and y step values based on the given direction. This causes the object to persistently move in the given direction regardless of the commands it is executing. Unlike the Go command, the Walk command initiates persistant movement until another Walk command alters the x and y step values once again. When it is blocked in the walking direction, it temporarily ceases its movement but continues executing its code. It begins moving again when it is no longer blocked.
Because the Walk command alters the cyclical movement and the Go command forces an immediate movement, the two may both affect the object’s coordinates in one single cycle. This may allow the object to move at double speed, diagonally, or in one direction and back in a single cycle.
Related Topics: Directions
Zap
[edit]Usage: ZAP <location>
The first instance of the given label in the specified object’s code is changed into a zapped label (the ":" is changed into a "'"), thus resulting in a non-functioning label marker. If the object whose label was zapped is sent to a label with the same name, it will either go to the next label in its code with the same name if one exists or, if none do, it will simply ignore the send attempt.
The Zap command can be undone using the Restore command. Note that the Restore command undoes every zapped label with the same name in the object’s code.
Related Topics: Locations