Howdy, Stranger!

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

Limited amount of choices

Say I have 3 choices :
Take flashlight
Take backpack
Take matches 

And I only want a player to be able to choose two choices. Is there A way I can do this simply?

Comments

  • This is one method in sugarcane..
    Start:
    <<set $inventory = []>>
    Choices: (put nobr in the tags)

    <<if $x neq 2>>
    Choose two items:<br>
    <<if $inventory neq "flashlight">>
    [[Take flashlight|Choices][$x++;$inventory.push("flashlight")]]<br>
    <<endif>>
    <<if $inventory neq "backpack">>
    [[Take backpack|Choices][$x++;$inventory.push("backpack")]]<br>
    <<endif>>
    <<if $inventory neq "matches">>
    [[Take matches|Choices][$x++;$inventory.push("matches")]] <br>
    <<endif>>

    <<else>>
    You are now carrying <<print $inventory[0]>> and <<print $inventory[1]>>.
    <br>
    [[Continue|NextPassage]]
    <<endif>>
  • While Daza has you on the right track with a list-style inventory, you may be a bit too new to Twine to make proper use of that.

    You might want to try something like this in a passage called "Choices" with the tag "nobr":
    <<if $choices eq 0>>
    What do you want to take?<br><br>
    <<elseif $choices eq 1>>
    You can take one more thing. What do you want?<br><br>
    <<else>>
    You're ready to go!
    <<endif>>

    <<if $choices lt 2 and $flashlight is not "taken">>[[Take flashlight|Choices][$flashlight = "taken"; $choices += 1]]<br><<endif>>
    <<if $choices lt 2 and $backpack is not "taken">>[[Take backpack|Choices][$backpack = "taken"; $choices += 1]]<br><<endif>>
    <<if $choices lt 2 and $matches is not "taken">>[[Take matches|Choices][$matches = "taken"; $choices += 1]]<br><<endif>>
    Included is a sample TWS and HTML.

    Hope that helps!
Sign In or Register to comment.