Hello everyone, I was wondering on how to use selectable_if statement. I want to use it when you go through several scenes. Here is what I mean:
*choice
*disable_reuse #Library
*goto Library
*disable_reuse #Sensei room
*goto Sensei_room
*disable_reuse #Barracks
*goto Barracks
*selectable_if ((goto = "library") and (goto ="blacksmith"))#Courtyard
*goto Courtyard
I saw that you use it with multiple variables but I haven’t seen any on the forms about when it comes to multiple scenes. What would be the proper way to use this.
Thanks for the help.
Ehm, you’ve currently got one variable (goto) that’s supposed to be two different values at once to go to the Courtyard scene, so that’s most definitely not going to work. Aside from that the code looks fine (mostly). I think the *disable_reuse’s have to be indented though.
1 Like
I copied the format from another form post but it was more of if something is this and that. How would the setup look if I need to have both scenes happen before the courtyard scene?
Add two boolean (true/false) or other type of variables (booleans are probably easiest in this case) and set those somewhere in those scenes.
For example, for in the startup.txt
*create library false
*create blacksmith false
For whatever .txt file those scenes are in
*label library
Lots of text
*set library true
*goto whateverlabelisbeforethatmainchoice
*label blacksmith
Lots of text
*set blacksmith true
*goto whateverlabelisbeforethatmainchoice
Then the main choice 'll be something like
*label whateverlabelisbeforethatmainchoice
*choice
*disable_reuse #Library
*goto library
*disable_reuse #Sensei's room
*goto sensei_room
*disable_reuse #Barracks
*goto barracks
*disable_reuse #Blacksmith
*goto blacksmith
*selectable_if ((library) and (blacksmith)) #Courtyard
*goto courtyard
Please note that the *disable_reuse command is reset if you move to a different .txt file.
(Oh, and I wrote all goto’s, labels and variables in lower case because choicescript is case sensitive and it can really mess stuff up if you make a mistake with that. As long as you’re consistent it’s fine though.)
1 Like
Ah, I see. I didn’t think it would be a boolean type of command.
Thank you I was able to get it to work now.
Any type of command would work. It’s just that in this case a boolean is easiest to use. Now that I think about it, you could probably make those temporary variables. Then you can just skip the part in the startup.txt and just declare them in the scenes themselves as *temp library/blacksmith true. As long as you don’t go to a different .txt file that should work as well, and it’d save you some permanent variables.
What if I want to use multiple scenes like say 4 scenes. How would the selectable_if statement work with that. I used
selectable_if ( (1) and (2) and (3) and (4) ) #chose
I noticed that this doesn’t work.
More brackets, basically. There should be a set of brackets around every two variables, and then around every two sets of two variables.
For example, *selectable_if ((var1 and var2) and (var3 and var4)) #Something selectable
Wow really? I just tested it again and it works like a charm. Thanks Cecilia for the help. This kind of seems a little bit ridiculous to have put a lot more brackets. Oh well.
So then would the same format be true if I just wanted to an if statement?
*if ( ((Lore) and (History)) and ((Trade) and (Geography)) )
*set Intelligence +4
That should work in exactly the same way as the selectable_if.
On a not completely related note, please note that if you use variables other than true boolean variables you have to use operators. For example *if ((Lore) and (History = false)) and ((Trade > 30) and (Geography = "reasonable))
(Which are resp. a true boolean variable, a false boolean variable, a numerical variable and a text variable.)