Duplicator

From Wiki of ZZT
Revision as of 22:10, 22 December 2025 by RT-55J (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Duplicator
ZZT-OOP nameDuplicator
Internal ID12 (0x0C)
Character#char 250 · (0xFA)
Default colorwhite on black (0x0F)
CategoryItem
Stats
X/Y-stepSource Direction
Default cycle(9-P2)*3
P1Duplication Timer
P2Duplication Rate
Other traits
Effect on movementWall
Destructible?no
Uses ZZT-OOP color names?Default only

The duplicator is device that copies an element from its source direction to the tile in its opposite direction. The frequency at which it duplicates can be changed with the "duplication rate" parameter, with higher numbers resulting in faster duplication.

Every tick the duplicator increments its duplication timer by one, and then draws the tile according to the following table:

Duplicator Characters
P1 Character
1 #char 250 · (0xFA)
2 #char 249 (0xF9)
3 #char 248 ° (0xF8)
4 #char 111 o (0x6F)
5 #char 79 O (0x4F)
Default #char 250 · (0xFA)

When the duplication timer reaches 5, the timer is reset and the duplicator attempts to duplicate the element in the source direction.

The duplication procedure first checks if a player (or player clone) is at the destination tile. If so, then the game has the player touch the source tile, with several possible side effects (listed below).

If a player is not at the destination tile, the game instead attempts to push the destination tile away. If the push is unsuccessful, then the duplicator plays its "blocked" sound and then does nothing. If the push is successful, then the contents of the source tile are copied to the destination and the duplication sound is played. If the source tile has stats, then all stats are carried over to the duplicate (including the code).

Note that every tick the duplicator sets its cycle according to the formula Cycle := (9 - P2) * 3, with P2 representing the "Duplication Rate," which limits the granularity and maximum speed of duplicators even when using external editors.

Duplicators support non-standard x/y-step values, but as always care should be taken to avoid out-of-bounds interactions.

Touching through a Duplicator

If a player or player clone is at the destination tile of a duplicator, the player will touch the element on the source tile. Various different side effect can happen depending on the element.

  • Collectible items (e.g. gems, torches: The item is collected and destroyed. However, due to a visual bug the item will appear to stay in place until the board is redrawn.
  • Built-in enemies (e.g. lions, tigers): The player takes damage, and the enemy is destroyed.
  • Object: The object receives a touch message.
  • Passage or Edge: The player is forced through the passage. This will result in the "koopo bug" occurring (stat parameters on the next board getting corrupted).
  • Boulder or Slider: ZZT will crash due to a stack overflow.