User Tools

Site Tools


harlowe:print

Differences

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

Link to this comparison view

harlowe:print [2017/10/09 20:39] (current)
Line 1: Line 1:
 +**(print: //Any//) -> //​[[harlowe:​Command|Command]]//​**
  
 +Harlowe'​s version of the "​print"​ macro, common to most story formats.
 +
 +=== Example usage: ===
 +
 +''​%%(print:​ $var + "​s"​)%%''​
 +
 +=== Details: ===
 +
 +It is capable of printing things which [[harlowe:​text|(text:​)]] cannot convert to a [[harlowe:​string|string]],​
 +such as [[harlowe:​changer|changer]] commands - but these will usually become bare descriptive
 +text like ''​%%[A (font: ) command]%%''​. You may find this useful for debugging purposes.
 +
 +This command can be stored in a variable instead of being performed immediately.
 +Notably, the expression to print is stored inside the command, instead of being
 +re-evaluated when it is finally performed. So, a passage
 +that contains:
 +
 +<​code>​
 +(set: $name to "​Dracula"​)
 +(set: $p to (print: "Count " + $name))
 +(set: $name to "​Alucard"​)
 +$p
 +</​code>​
 +will still result in the text ''​%%Count Dracula%%''​. This is not particularly useful
 +compared to just setting ''​%%$p%%''​ to a string, but is available nonetheless.
 +
 +=== See also: ===
 +
 +[[harlowe:​text|(text:​)]],​ [[harlowe:​display|(display:​)]]
harlowe/print.txt ยท Last modified: 2017/10/09 20:39 (external edit)