{{tag>zxt:extension}} ====== 00000000:0001 - #IFEXT ====== ===== Information ===== * **ID:** 00000000:0001 ===== Flags ===== ^ Flag ^ Set? (MUST/MAY/...) ^ Description ^ | parsing_must | MUST NOT | | | reading_must | MUST NOT | | | writing_must | MUST NOT | | | playing_should | MAY | If any #IFEXT calls are used in Objects with the described caveat for optional support. | | playing_must | MAY | If any #IFEXT calls are used in Objects. | | editing_should | MUST NOT | | ===== Field data ===== None. ===== Description ===== This extension adds an OOP command which faciliates run-time detection of extensions on both ZZT 3.2 and ZXT-compatible implementations. The command is ''#IFEXT owner_id selector_id ...'', where owner_id and selector_id are specified as 32-bit and 16-bit hexadecimal numbers, respectively. If the extension with a given owner_id and selector_id is currently active within the execution context, the rest of the line is treated as a command. Keep in mind that to support ''#IFEXT'' as an optional extension, an '':IFEXT'' label SHOULD be provided to handle the situation in which this extension is not present. ===== Example usage ===== ==== Simple scenario ==== #ifext 00000000 0001 found :found Extensions found! #end :ifext Extensions not found. #end ==== Two touch codepaths ==== @Interactive #ifext 00000000 0001 zap touch :ifext #end :touch I found nothing... #end :touch I found IFEXT support! #end ==== Two touch codepaths (#BIND workaround) ==== If the code above is bound, '':TOUCH'' might end up being zapped multiple times. This code takes care of that: @Interactive #send init #end :init #zap init #ifext 00000000 0001 zap touch :ifext #end :touch I found nothing... #end :touch I found IFEXT support! #end An alternative, more advanced technique is pre-setting the instruction pointer in an external editor. ===== Implementations =====