User Tools

Site Tools


macro

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
macro [2013/12/13 22:38]
l
macro [2017/10/09 20:39] (current)
Line 1: Line 1:
 A **macro** is a piece of code that is inserted into [[passage]] text. Macros are used to accomplish many effects, such as altering the game's state, displaying different text depending on the game's state, and altering the manner in which text is displayed. A **macro** is a piece of code that is inserted into [[passage]] text. Macros are used to accomplish many effects, such as altering the game's state, displaying different text depending on the game's state, and altering the manner in which text is displayed.
  
-===== List of built-in macros=====+===== List of Twine 1 built-in macros=====
  
-The following macros *control variables and text* in the story, or use them to alter the displayed passage text:+([[http://​twinery.org/​wiki/​twine2:​add_stats_rpg_battles_or_just_plain_random_events|Twine 2 macros start here]].) 
 + 
 +These are only the built-in macros in Twine 1. Other macros may be installed or written on a story-by-story basis. 
 + 
 +The following macros ​**control variables and text** in the story, or use them to alter the displayed passage text:
   * [[<<​if>>​]] / <<​else>>​ / <<​endif>>​   * [[<<​if>>​]] / <<​else>>​ / <<​endif>>​
   * [[<<​set>>​]]   * [[<<​set>>​]]
   * [[<<​remember>>​]]   * [[<<​remember>>​]]
  
-The following macros *display special text*, such as the contents of variables, or the text of another passage. They can provide powerful means of expression in a story.+The following macros ​**display special text**, such as the contents of variables, or the text of another passage. They can provide powerful means of expression in a story.
   * [[<<​print>>​]]   * [[<<​print>>​]]
   * [[<<​display>>​]]   * [[<<​display>>​]]
  
-The following macros create special kinds of links:+The following macros create special kinds of **[[link]]s**:
   * [[<<​actions>>​]]   * [[<<​actions>>​]]
   * [[<<​choice>>​]]   * [[<<​choice>>​]]
Line 18: Line 22:
 The following macro controls how its contained text is displayed, and can be useful when combined with other macros: The following macro controls how its contained text is displayed, and can be useful when combined with other macros:
   * [[<<​nobr>>​]]   * [[<<​nobr>>​]]
 +
 +The following macros create **form input elements**, and can be used to get input from the player:
 +  * [[<<​textinput>>​]]
 +  * [[<<​radio>>​]]
 +  * [[<<​checkbox>>​]]
 +  * [[<<​button>>​]]
    
 The following macros are not as useful as they were in previous versions of Twine, but remain for backwards-compatibility:​ The following macros are not as useful as they were in previous versions of Twine, but remain for backwards-compatibility:​
-  * [[<<​silently>>​]] (now supplanted by the [[<<​nobr>>​]] macro and the "​nobr"​ passage tag.) +  * [[<<​silently>>​]] (now supplanted by the [[<<​nobr>>​]] macro and the "​nobr" ​[[tag|passage tag]].) 
-  * [[<<​back>>​]] / <<​return>>​ (now supplanted by the previous() ​[[function]].)+  * [[<<​back>>​]] / <<​return>>​ (now supplanted by the [[function|previous() function]].) 
 + 
 +===== Pseudo-macros ===== 
 + 
 +In addition to actual Javascript-coded macros, the [[<<​display>>​]] macro has a shorthand form which allows passages to behave as if they were macros - their contained code can be called and included from any other passage using a syntax similar to actual macros.
  
macro.1386992291.txt.gz · Last modified: 2017/10/09 20:37 (external edit)