Put: Difference between revisions

From Wiki of ZZT
Jump to navigation Jump to search
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''#put''' is a [[ZZT-OOP]] command that lets an object place an element on the board. If the element at the target tile is able to be pushed, then using '''#put''' will push it. Otherwise, '''#put''' will replace the target tile.
'''#put''' is a [[ZZT-OOP]] command that lets an object place an element on the board. If the element at the target tile is able to be pushed, then using '''#put''' will push it. Otherwise, '''#put''' will replace the target tile.


The syntax is <code>#put direction color element</code>. The direction argument is mandatory. The color argument is optional. If an element is not specified then ZZT will default to placing a [[Edge|board edge]]
== Syntax ==


If the object's x-step and y-step are both zero, then the command <code>#put flow <element></code> will throw the error <code>Bad #PUT</code> when executed.
<code>#put <direction> [<color>] <element></code>.
 
The direction argument is mandatory, while the color argument is optional. While the element argument is supposed to be mandatory, an empty string is treated as equivalent to a [[Edge|board edge]]. Providing an invalid element name will throw a <code>Bad #PUT</code> error.
 
The direction argument must not point to the same tile as the Object is on; otherwise, the <code>Bad #PUT</code> error will be thrown. For this purpose, one should use [[Become|#become]] instead. Additionally, the target tile is bounds-checked, but attempts to place out of bounds are silently ignored.


== Bugs ==
== Bugs ==


* Due to a bounds-checking error it is impossible to '''#put''' something on the bottommost row of the board.
* Due to a flaw in the bounds-checking logic, it is impossible to '''#put''' something on the bottommost row of the board.
** This can be situationally circumvented using the [[Shoot|#shoot]] or [[Throwstar|#throwstar]] commands in conjunction with [[Change|#change]].
** This can be situationally circumvented using the [[Shoot|#shoot]] or [[Throwstar|#throwstar]] commands in conjunction with [[Change|#change]].


{{ZZT-OOP navbox}}
{{ZZT-OOP navbox}}

Latest revision as of 17:13, 29 September 2022

#put is a ZZT-OOP command that lets an object place an element on the board. If the element at the target tile is able to be pushed, then using #put will push it. Otherwise, #put will replace the target tile.

Syntax

#put <direction> [<color>] <element>.

The direction argument is mandatory, while the color argument is optional. While the element argument is supposed to be mandatory, an empty string is treated as equivalent to a board edge. Providing an invalid element name will throw a Bad #PUT error.

The direction argument must not point to the same tile as the Object is on; otherwise, the Bad #PUT error will be thrown. For this purpose, one should use #become instead. Additionally, the target tile is bounds-checked, but attempts to place out of bounds are silently ignored.

Bugs

  • Due to a flaw in the bounds-checking logic, it is impossible to #put something on the bottommost row of the board.