Zap: Difference between revisions

From Wiki of ZZT
Jump to navigation Jump to search
(Created page with "{{DISPLAYTITLE:zap}} '''#zap''' and '''#restore''' are ZZT-OOP commands for disabling labels. '''#zap label''' will disable the first active occurence of label by turning...")
 
No edit summary
Line 5: Line 5:


* '''#restore''' does not work for labels located on the first line, as it relies on a newline preceding the label to locate it.
* '''#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 occurence if the line succeeding them starts on an alphabetic character or an underscore.
* '''#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 <code>'</code> or <code>:</code> respectively.
* '''#zap restart''' and '''#restore restart''' will always edit the second character of the targetted Object's code into <code>'</code> or <code>:</code> respectively.
* '''#zap''' and '''#restore''' edit the code of an Object - this means that, if the code is being used by other [[Bind|bound]] Objects, labels will be changed on all of them.
* '''#zap''' and '''#restore''' edit the code of an Object - this means that, if the code is being used by other [[Bind|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.


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

Revision as of 08:10, 19 December 2021

#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.