Howdy, Stranger!

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

Multiple simultaneous choices

Hi everybody,

I'm pretty new to the Twine so apologies if this is a silly basic question.

I would like to know whether anyone knows a way of making multiple simultaneous choices in Twine. So for example choosing 4/6 options; "You are facing multiple enemies but your fireball spell can only reach four creatures; which ones do you choose to target (1) troll, (2) elf, (3) warlock, (4) dragon, (5) giant, and (6) hydra". This is a bit of a silly example but hope you get the point. What I wish to incorporate is a basic multiple-choice structure as in surveys.

Any help in this would be greatly appreciated. Many thanks in advance.

Johnny

Comments

  • This is awfully late in reply, but I think you can do something like this using the <<checkbox>> macro. It doesn't have a wiki page at the moment but you can deploy it in this format:
    <<checkbox $targets "troll" "elf" "warlock" "dragon" "giant" "hydra">>
    <<button "Submit">>
    The inconvenience is that A) there's no real way to restrict the user to just 4 options until you proceed to the next screen, and B) the means of getting the options out of the $targets variable is a tad uncomfortable.

    You can use the following to find out if the user inputted over four options:

    <<if $targets.length > 4>>
    and you can send them back if it's higher.

    You can use the following to find out whether a certain option (like "troll") was selected:

    <<if $targets.indexOf("troll") >-1 >>
Sign In or Register to comment.