User Tools

Site Tools


choice

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
choice [2013/12/18 00:49]
l
choice [2017/10/10 00:39] (current)
Line 1: Line 1:
 =====<<​choice>>​===== =====<<​choice>>​=====
  
-The <<​choice>>​ macro produces passage ​links which can only be clicked onceIf one is clicked, all other <<​choice>>​ links in the passage are permanently disabled.+The <<​choice>> ​[[macro]] is useful for creating a set of multiple ​links that the reader ​can choose ​only one ofOnce one link in the set is clicked, all other <<​choice>>​ links in the passage are permanently disabled. This means that even if you return to the passage by another link, every <<​choice>>​ link in the set will be darkened and no longer clickable. Any other links on the page links remain unaffected.
  
 +For example, if a reader encounters a peanut butter cookie, the reader can eat it, give it to the dog, or throw it out the window, but the reader can't do more than one of those things. (But the reader could go on to do something outside the set, like leave the room.)
 +
 +
 +In [[Jonah]], if the "​Undo"​ [[StorySetting]] is off, then all links will behave like <<​choice>>​ links, and the macro is unnecessary. This is because Jonah permits you to "​undo"​ your moves at any time by scrolling up to a previous passage and clicking another link - undos in Jonah are disabled by forbidding this action.
 +
 +{{ :​choice.png|}}
 ==== Usage ==== ==== Usage ====
  
 >​%%<<​%%choice %%[[%%//​link syntax//​%%]]>>​%% >​%%<<​%%choice %%[[%%//​link syntax//​%%]]>>​%%
  
-You can insert any valid form of the [[link]] syntax into the macro - one with variables ​or setting.+You can insert any valid form of the [[link]] syntax into the macro - one with expressions,​ one that sets [[variable]]s, ​or anything else.
  
 There is also an older formulation,​ used in Twine 1.3.5: There is also an older formulation,​ used in Twine 1.3.5:
Line 13: Line 19:
  
 This formulation is no longer recommended,​ as it conflicts with the link text and passage name ordering used by the normal link syntax. This formulation is no longer recommended,​ as it conflicts with the link text and passage name ordering used by the normal link syntax.
 +
 +==== CSS hooks ====
 +
 +The <<​choice>>​ links have, in addition to their normal CSS classes, the class "​choice"​. When they are darkened, they become span elements with the sole class "​disabled"​. If you want, say, the darkened links to be removed entirely instead of just darkened, you can add this CSS to your story:
 +  ​
 +  .disabled { display:​none;​ }
choice.1387327773.txt.gz ยท Last modified: 2017/10/10 00:37 (external edit)