This is an old revision of the document!
The «radio» macro lets you offer your reader with a familiar radio button input. While a «checkbox» set lets the reader make multiple choices, radio buttons are mutually exclusive–your reader can choose only one option:
The code to create the above example looks like this:
Would you like to see some radio buttons?
«radio $choice “yes”»
«radio $choice “no”»
«radio $choice “maybe”»
«button &91;&91;Go on|go_on&93;&93;»
$choice is the name of the input. You can set this to any variable name you like. “yes” “no” and “maybe” are the values of each input. These are what will be displayed to the reader AND stored in the variable ($choice).
Note that, in order for the value to be stored, there must be a «button» in the passage, and the user must click it.
As of version 1.4.2, Twine forces a line break between radio buttons.
To work around this, you can set your radio buttons in a table.
As of version 1.4.2, there is no option to mark a radio button as selected before your reader makes their choice.
To work around this, you can initialize your variable and offer the reader one radio button, like so: