zap

From Wiki of ZZT
Revision as of 08:10, 19 December 2021 by Asie (talk | contribs)
Jump to navigation Jump to search

#zap and #restore are ZZT-OOP commands for disabling labels. #zap label will disable the first active occurence of label by turning it into a comment, while #restore label will turn all comments "label" back into labels. (with caveats - see below). They allow selective disabling of labels on a given Object, as well as multiple meaningful destinations of the same label name.

Label restoration quirks

  • #restore does not work for labels located on the first line, as it relies on a newline preceding the label to locate it.
  • #restore fails to restore labels after the first zapped-matching occurence if the line succeeding them starts on an alphabetic character or an underscore.
  • #zap restart and #restore restart will always edit the second character of the targetted Object's code into ' or : respectively.
  • #zap and #restore edit the code of an Object - this means that, if the code is being used by other bound Objects, labels will be changed on all of them.
  • #zap accidentally allows for remotely zapping labels on other targets - for example, #zap all:label. #restore also allows for this, but only on the first occurence.
    • This means one could use #restore self:label to only restore the first zapped-matching label in an object.