Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

how can i implment dropdown list in sugarcube 2

i would like user to select one of the values from a dropdown.
they will eventually be navigated to a passage which depends on the value they chose.

how do i implement this in sugarcube 2/twine 2

thanks

Comments

  • There may be a better way, but I have three ideas for you:

    1. Use the <<radiobutton>> macro. http://www.motoslave.net/sugarcube/2/docs/macros.html#macros-radiobutton

    2. Use a combination of <<click>>, <<replace>>, and <<link>> or Passage links.

    Here's how the second option might look:
    You have three doors to choose from.  Pick carefully.
    
    <<click "Choose A Door">><<replace "#doorChoices">>[[Door 1]]
    [[Door 2]]
    [[Door 3]]<</replace>><</click>>
    <span id="doorChoices"></span>
    

    3. Use a variable to store the choice so it can be picked back up in a later passage.
    You have three doors to choose from.  Pick carefully.
    
    <<click "Door 1">><<set $doorChoice to 1>><</click>>
    <<click "Door 2">><<set $doorChoice to 2>><</click>>
    <<click "Door 3">><<set $doorChoice to 3>><</click>>
    

    Later on, use <<if $doorChoice is 1>> to determine results based on their decision.
Sign In or Register to comment.