User Tools

Site Tools


harlowe:hookname

Differences

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

Link to this comparison view

harlowe:hookname [2017/06/19 02:54]
l created
harlowe:hookname [2017/10/09 20:39]
Line 1: Line 1:
-A hook name is like a variable name, but with ''​%%?​%%''​ replacing the ''​%%$%%''​ sigil. When given to a macro that accepts it, 
-it signifies that //all// hooks with the given name should be affected by the macro. 
-For instance, ''​%%(click:​ ?​red)%%''​ will cause //all// hooks with a ''​%%<​red|%%''​ or ''​%%|red>​%%''​ nametag to be subject to the [[harlowe:​click|(click:​)]] 
-macro'​s behaviour. 
  
-In earlier Harlowe versions, it was possible to also use hook names with [[harlowe:​set|(set:​)]],​ [[harlowe:​put|(put:​)]] and [[harlowe:​move|(move:​)]] to modify the 
-text of the hooks, but macros such as [[harlowe:​replace|(replace:​)]] should be used to accomplish this instead. 
- 
-If you only want some of the hooks with the given name to be affected, you can treat the hook name as a sort of read-only 
-[[harlowe:​Array|Array]]:​ access its ''​%%1st%%''​ element (such as by ''​%%?​red'​s 1st%%''​) to only affect the first such named hook in the passage, access 
-the ''​%%last%%''​ to affect the last, and so forth. (Even specifying an array of positions, like ''​%%?​red'​s (a:​1,​3,​5)%%'',​ will work.) 
-Unlike arrays, though, you can't access their ''​%%length%%'',​ nor can you spread them with ''​%%...%%''​. 
- 
-If you need to, you cal also add hook names together to affect both at the same time: ''​%%(click:​ ?red + ?​blue'​s 1st)%%''​ will 
-affect all hooks tagged ''​%%<​red|%%'',​ as well as the first hook tagged ''​%%<​blue|%%''​. 
- 
-Note: if a hook name does not apply to a single hook in the given passage (for instance, if you type ''​%%?​rde%%''​ instead of 
-''​%%?​red%%''​) then no error will be produced. This is to allow macros such as [[harlowe:​click|(click:​)]] to be placed in the ''​%%header%%''​ or ''​%%footer%%''​ 
-passages, and thus easily affect hooks in every passage, even if individual passages lack the given hook name. Of course, it 
-means that you'll have to be extra careful while typing the hook name, as misspellings will not be easily identified 
-by Harlowe itself. 
harlowe/hookname.txt ยท Last modified: 2017/10/09 20:39 (external edit)