It looks like you're new here. If you want to get involved, click one of these buttons!
<<checkbox $backpack "Sword">>
<<checkbox $backpack "Axe">>
<<checkbox $backpack "Pie">>
<<button [[Pack Your Bag]]>>
If someone could tell me how I would adapt that example into Sugarcube it would be much appreciated.
Comments
1. The variable_name parameter: Because you can select more than one checkbox at the same time you need to give each one its own unique variable_name and as the documentation states it need to be quoted (eg. wrapped in quotes)
2. The other two mandatory parameters: The 2nd and 3rd parameters are meant to indicate the values to store in the variable named when the checkbox is unchecked and checked.
So your example should look something like the following:
Just to clarify first, I understood my example was wrong, I was just doing it how I knew how to do it in Sugarcane.
I'm still confused though and am having trouble getting this to work (sorry, this is probably really clear to others).
1: When I try to display (edit: via the print function) the result on the next passage, I keep getting no results (either a blank or a 0 or a false). Is there a 'button' (I know that might not be the right word) associated with the checklist command like there is in Sugarcane?
2: Is there no way to have the checklist modify a single variable like in Sugarcane? In my Sugarcane example I could click on sword and pie and on the next page just have a <<print $backpack>> to display the results (sword,pie).
3:Is there any way to make the box appear without the word true or false? Is it possible to just make a box next to the word axe and if the player checks it axe becomes true?
Thank you again.
RE: 2 - I don't believe SugarCube's checkbox supports this, at least I could not see that ability when looking at its source code.
RE: 3 - SugarCube's check box does not display anything besides the box itself, it leaves the displaying of text to you.
(note: the following uses TWEE notation, lines starting with two colons indicate a new passage, text on the same line as the two colons is the new passage's title.)
There are one too many arguments to those
<<checkbox>>
calls, the final boolean is erroneous and is simply being ignored. The above should be: The, optional, fourth argument is thechecked
keyword.I'll also note that SugarCube's input macros allow complex $variable assignments, so, if a generic object were used, you could also do something like this: Thereby assigning directly to the properties of
$packed
.