This shows you the differences between two versions of the page.
harlowe:passage [2017/06/19 01:25] l |
harlowe:passage [2017/10/09 20:39] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | **(passage: // [ [[harlowe:String|String]] ]//) -> //[[harlowe:Datamap|datamap]]//** | ||
- | When given a passage [[harlowe:string|string]] name, this provides a [[harlowe:datamap|datamap]] containing information about that passage. If no | ||
- | name was provided, then it provides information about the current passage. | ||
- | |||
- | === Example usage: === | ||
- | |||
- | ''%%(passage:"Cellar")%%'' | ||
- | |||
- | === Rationale: === | ||
- | |||
- | There are times when you wish to examine the data of the story as it is running - for instance, checking what | ||
- | tag a certain passage has, and performing some special behaviour as a result. This macro provides that functionality. | ||
- | |||
- | === Details: === | ||
- | |||
- | The datamap contains the following names and values. | ||
- | |||
- | ^Name ^ Value ^ | ||
- | | source | The source markup of the passage, exactly as you entered it in the Twine editor | | ||
- | | name | The string name of this passage. | | ||
- | | tags | An [array](#type_array) of strings, which are the tags you gave to this passage. | | ||
- | |||
- | The "source" value, like all strings, can be printed using [[harlowe:print|(print:)]]. Be warned that printing the source of | ||
- | the current passage, while inside of it, may lead to an infinite regress. | ||
- | |||
- | Interestingly, the construction ''%%(print: (passage: "Cellar")'s source)%%'' is essentially identical in function (albeit longer to write) | ||
- | than ''%%(display: "Cellar")%%''. | ||
- | |||
- | === See also: === | ||
- | |||
- | [[harlowe:history|(history:)]], [[harlowe:savedgames|(savedgames:)]] |