Duplicator: Difference between revisions
(Created page with "{{Element |zzt-oop name=Duplicator |id={{Byte|12}} |char={{CharSwatch|250}} |color={{ColorSwatch|fg=white|bg=black}} |category=Item |stats=yes |x-y step=Source Direction |cycle=(9-P2)*3 |p1=Duplication Timer |p2=Duplication Rate |destructible=no |effect on movement=Wall |uses zzt-oop color=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 chan...") |
No edit summary |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 40: | Line 40: | ||
When the duplication timer reaches 5, the timer is reset and the duplicator attempts to duplicate the element in the source direction. | 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 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). | 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). | ||
| Line 47: | Line 47: | ||
Duplicators support non-standard x/y-step values, but as always care should be taken to avoid out-of-bounds interactions. | 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. [[gem|gems]], [[torch|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. [[lion|lions]], [[tiger|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. | |||
{{ElementsNavbox}} | {{ElementsNavbox}} | ||
Latest revision as of 22:10, 22 December 2025
| Duplicator | |
|---|---|
| ZZT-OOP name | Duplicator |
| Internal ID | 12 (0x0C) |
| Character | #char 250 · (0xFA) |
| Default color | white on black (0x0F) |
| Category | Item |
| Stats | |
| X/Y-step | Source Direction |
| Default cycle | (9-P2)*3 |
| P1 | Duplication Timer |
| P2 | Duplication Rate |
| Other traits | |
| Effect on movement | Wall |
| 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:
| 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.
| Elements | |
|---|---|
| Special | |
| Items | |
| Terrain | |
| Creatures | |
| Text | |