User Tools

Site Tools


harlowe:hook_markup

Differences

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

Link to this comparison view

harlowe:hook_markup [2017/10/09 20:39] (current)
Line 1: Line 1:
 +====Hooks====
  
 +In Harlowe, a hook is a means of indicating that a specific span of passage prose is special in some way. It
 +essentially consists of text between single ''​%%[%%''​ and ''​%%]%%''​ marks. Prose inside a hook can be modified, styled,
 +controlled and analysed in a variety of ways using macros.
 +
 +A hook by itself, such as ''​%%[some text]%%'',​ is not very interesting. However, if you attach a macro or a
 +variable to the front, the attached value is used to change the hook in some way, such as hiding
 +it based on the game state, altering the styling of its text, moving its text to elsewhere in the passage.
 +
 +<​code>​
 +(font: "​Courier New"​)[This is a hook.
 +
 +As you can see, this has a macro instance in front of it.]
 +This text is outside the hook.
 +</​code>​
 +The [[harlowe:​font|(font:​)]] macro is one of several macros which produces a special styling command, instead of a basic
 +data type like a number or a string. In this case, the command changes the attached hook's font to Courier New,
 +without modifying the other text.
 +
 +You can save this command to a variable, and then use it repeatedly, like so:
 +
 +<​code>​
 +(set: $x to (font: "​Skia"​))
 +$x[This text is in Skia.]
 +$x[As is this text.]
 +</​code>​
 +The basic [[harlowe:​if|(if:​)]] macro is used by attaching it to a hook, too:
 +
 +<​code>​
 +(if: $x is 2)[This text is only displayed if $x is 2.]
 +</​code>​
 +For more information about command macros, consult the descriptions for each of them in turn.
harlowe/hook_markup.txt ยท Last modified: 2017/10/09 20:39 (external edit)