Howdy, Stranger!

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

How do I make the variables in checkboxes show up?

This is my first time using twine and I'm having trouble implementing variables via the checkboxes. I'm trying to have the player choose who they want to hang out with and how many people, but when I went to test it out nothing on the second passage shows up.

In my first passage I have:
Who do you want to hang out with?
 
<<checkbox $hangout "Hailey">>
<<checkbox $hangout "Jake">>
<<checkbox $hangout "Finn">> 
<<checkbox $hangout "Blake">>

<<button [[Continue|Continue]]>>

and in my second passage I have:
<<if ($hangout is "Hailey") and ($hangout is "Jake") and ($hangout is"Blake") and ($hangout is "Finn")>> You hangout with Blake, Hailey, Jake and Finn at the [[mall|mall1]].<<endif>>


<<if ($hangout is "Blake") and ($hangout is "Hailey") and ($hangout is "Jimmy")>> You hangout with Blake, Hailey, and Finn at the [[mall|mall2]].
<<endif>>


<<if ($hangout is "Blake") and ($hangout is "Hailey") and ($hangout is "Jake")>> You hangout with Blake, Hailey, and Jake at the [[mall|mall3]]. <<endif>>


<<if ($hangout is "Jake") and ($hangout is "Finn") and ($hangout is "Emma")>> You hangout with Jake, Finn, and Hailey at the [[mall|mall4]].<<endif>>


<<if ($hangout is "Jake") and ($hangout is "Finn") and ($hangout is "Blake")>> You hangout with Jake, Finn, and Blake at the [[mall|mall5]].<<endif>>


<<if ($hangout is "Jake") and ($hangout is "Finn")>> You hang out with Jake and Finn at the [[mall|mall6]].  <<endif>>


<<if ($hangout is "Jake") and ($hangout is "Hailey")>> You hang out with Jake and Hailey at the [[mall|mall7]].  <<endif>>


<<if ($hangout is "Jake") and ($hangout is "Blake")>> You hang out with Jake and Blake at the [[mall|mall8]].<<endif>>


<<if ($hangout is "Finn") and ($hangout is "Hailey")>> You hang out with Finn and Hailey at the [[mall|mall9]]. <<endif>>


<<if ($hangout is "Finn") and ($hangout is "Blake")>> You hang out with Finn and Blake at the [[mall|mall10]].<<endif>>


<<if ($hangout is "Hailey") and ($hangout is "Blake")>> You hang out with Hailey and Blake at the [[mall|mall11]].<<endif>>


<<if ($hangout is "Hailey")>>You hang out with only Hailey at the [[mall|mall12]]. <<endif>>


<<if ($hangout is "Blake")>>You hang out with only Blake at the [[mall|mall13]].<<endif>>


<<if ($hangout is "Jake")>>You hang out with only Jake at the [[mall|mall14]].<<endif>>


<<if ($hangout is "Finn")>>You hang out with only Finn at the [[mall|mall15]].<<endif>>

Comments

  • edited November 2016
    You should always state which story format you're using and its version.

    If you're using a version of SugarCube—not to be confused with Sugarcane—then its documentation covers your question—see: <<checkbox>> docs for SugarCube v1 and/or SugarCube v2. TL;DR: You need to quote the variable name in this specific instance.
  • I'm using Sugarcane with Twine 1.4.2
  • I don't recall exactly how Sugarcane handles its <<checkbox>> macro, so I'm afraid I can't verify that your syntax is correct—though I think your example above is probably correct.

    Looking more at the example of your logic, however, there is an issue there. You're specifying the same variable to multiple <<checkbox>> macros, which if I recall correctly means that it will collect all of those instances into an array which it will store in $hangout. Within your logic you're not treating $hangout like the array it is as you should be, so that's why things aren't working.

    So, instead of the sub-conditions you're using now:
    ($hangout is "Hailey")
    
    You'd need to do something like the following:
    ($hangout.findIndex("Hailey") ne -1)
    
  • I tried that and when I went to test it said it was a bad condition.
  • Mea culpa. The operator is neq, not ne, so that should have been:
    ($hangout.findIndex("Hailey") neq -1)
    
  • I need help on this matter aswell. I'm using Harlowee... Can anyone help?
Sign In or Register to comment.