User Tools

Site Tools


zxt:extension:00000000:0001

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
zxt:extension:00000000:0001 [2021/03/11 22:10] asiezxt:extension:00000000:0001 [2021/08/06 22:26] (current) asie
Line 1: Line 1:
 {{tag>zxt:extension}} {{tag>zxt:extension}}
  
-====== 00000000:0001 - #unlock extensions + #ifext ======+====== 00000000:0001 - #IFEXT ======
  
 ===== Information ===== ===== Information =====
Line 13: Line 13:
 | reading_must | MUST NOT | | | reading_must | MUST NOT | |
 | writing_must | MUST NOT | | | writing_must | MUST NOT | |
-| playing_should | MAY | If any extensions are recommended for gameplay. | +| playing_should | MAY | If any #IFEXT calls are used in Objects with the described caveat for optional support. | 
-| playing_must | MAY | If you're only using the #ifext portion, without #unlock extensions checks. |+| playing_must | MAY | If any #IFEXT calls are used in Objects. |
 | editing_should | MUST NOT | | | editing_should | MUST NOT | |
  
Line 23: Line 23:
 ===== Description ===== ===== Description =====
  
-This extension adds two OOP commands which faciliate run-time detection of extensions on both ZZT 3.2 and ZXT-compatible implementations:+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.
  
-  * ''#UNLOCK'''s behaviour is extended as such: If ''#UNLOCK'' is immediately followed by the token ''EXTENSIONS'', the rest of the line is treated as a command. +Keep in mind that to support ''#IFEXT'' as an optional extensionan '':IFEXT'' label SHOULD be provided to handle the situation in which this extension is not present.
-  * A new command, ''#IFEXT owner_id selector_id ...'' is provided. 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.+
  
-The idea is that ''#UNLOCK EXTENSIONS ...'' will behave on ZZT 3.2-conformant implementations just like ''#UNLOCK'' would - by unlocking the Object, skipping the command being executed. On the flip side, if the extension is not active, ''#UNLOCK EXTENSIONS'' will work as it would on a ZZT 3.2-conformant implementation - providing compatibility in both directions.+===== Example usage =====
  
-==== Example usage ====+==== Simple scenario ====
  
 <code> <code>
-#unlock extensions foundone+#ifext 00000000 0001 found 
 +:found 
 +Extensions found! 
 +#end 
 +:ifext
 Extensions not found. Extensions not found.
 #end #end
-:foundone +</code> 
-#ifext 00000000 0001 foundtwo + 
-Unlock OK, but not ifext? - Should not happen+==== Two touch codepaths ==== 
 + 
 +<code> 
 +@Interactive 
 +#ifext 00000000 0001 zap touch 
 +:ifext 
 +#end 
 +:touch 
 +I found nothing... 
 +#end 
 +:touch 
 +I found IFEXT support!
 #end #end
-:foundtwo 
-Unlock and ifext OK! Your implementation is correct. 
 </code> </code>
  
-===== Implementations =====+==== Two touch codepaths (#BIND workaround) ====
  
-  * [[https://github.com/OpenZoo/ClassicZoo/commit/5e7d49129ee66bf235bd562ddc48bfc407fe6eef|Reference implementation]] (0BSD licenseRoZ-based, OOP.PAS edits apply)+If the code above is bound, '':TOUCH'' might end up being zapped multiple timesThis code takes care of that: 
 + 
 +<code> 
 +@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 
 +</code> 
 + 
 +An alternativemore advanced technique is pre-setting the instruction pointer in an external editor. 
 + 
 +===== Implementations =====
zxt/extension/00000000/0001.1615500647.txt.gz · Last modified: 2021/03/11 22:10 by asie