Change: Difference between revisions

From Wiki of ZZT
Jump to navigation Jump to search
(Created page with "{{DISPLAYTITLE:change}} '''#change''' is a ZZT-OOP command that lets you change all instances of a given element with another element. The syntax is <code>#change color e...")
 
No edit summary
 
Line 2: Line 2:
'''#change''' is a [[ZZT-OOP]] command that lets you change all instances of a given element with another element.
'''#change''' is a [[ZZT-OOP]] command that lets you change all instances of a given element with another element.


The syntax is <code>#change color element color element</code>. In both cases, 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 #CHANGE</code> error.
== Syntax ==
<code>#change [<source color>] <source element> [<target color>] <target element></code>
 
In both cases, 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 #CHANGE</code> error.


== Bugs/Quirks ==
== Bugs/Quirks ==

Latest revision as of 17:08, 29 September 2022

#change is a ZZT-OOP command that lets you change all instances of a given element with another element.

Syntax

#change [<source color>] <source element> [<target color>] <target element>

In both cases, 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 #CHANGE error.

Bugs/Quirks

  • ZZT has a limit of 150 stats. If you try to #change statless elements into statful ones, it will only produce them up to that limit - the remaining elements will be turned to Empties instead.
  • Due to a bug, errors thrown by #change do not stop execution of the command! This can cause uninitialized memory to be used as the element and/or color arguments - causing unexpected behaviour and, potentially, crashes.