Multiple Variables in a Single "selectable_if" Option


#1

I want to know if it’s possible to make a choice available for several different variables.

As I am making a game where you’ll be able to choose certain classes, more than one class will be able to choose a certain path. I want to make something along the lines of…

*selectable_if (class = “Pirate Master”)

But I also want it to say…

*selectable_if (class = “Shadow Ninja”)

So how do I go about accomplishing this? Any help is appreciated greatly.


#2

*selectable_if ((class =“Pirate Master”)or(class =“Shadow Ninja”)) #Blah, bla.


#3

You’d use


*label class
*hide_reuse
*choice

	*selectable_if (class = Pirate Master)
		*goto class

	*selectable_if (class = Shadow Ninja)
		*goto class

Maybe I misunderstood the question, but this is what you’d use to choose multiple choices after the initial choice.


#4

@Marajade
Thank you!

@Samuel_H_Young
I see what you were thinking, but I meant in a single choice, not after the initial choice.


#5

I just wanted to add that recently I’ve found myself splitting my logic up, a little bit like this:

 
*if ((class="pirate") or (class = "ninja"))
   *temp can_choose true
*else
   *temp can_choose false

*choice
   *selectable_if (can_choose) #I'm a ninja or a pirate!

This is because I find that choices can get very cluttered and hard to understand or follow when you start adding long lists of ifs before them. Either method works, of course, use whatever you feel most comfortable with! That’s just another option.


#6

@CJW
That’s a really good method- it’s much cleaner and easier to understand.


#7

@MaraJade
How would you use it if you were going for three options?
I’ve tried ((if class = “class1”)or(if class =“class2”)or(if class = “class3”)) and ((if class = “class1”)or(if class =“class2”))or(if class = “class3”), but neither of them seem to work. I get an error stating I used too many booleans on that line.


#8

@Mystogan
Why don’t you use the method CJW showed you?


*if ((class="pirate") or (class = "ninja"))
   *temp can_choose true
*else
   *temp can_choose false

*choice
   *selectable_if (can_choose) #I'm a ninja or a pirate!


#9

@Mystogan that’s a concatenation its explained in wiki but i never use it, because give me tons of errors if i want use is the example @CJW this way.

*selectable_if ((can_choose)or(class =“whatever”)) #Blah
This way you could use the 3 variables same time without errors.


#10

You could do…


*temp can_choose false
*if (class = "class1")
  *set can_choose true
*if (class = "class2")
  *set can_choose true
*if (class = "class3")
  *set can_choose true
*if (class = "class4")
  *set can_choose true

*choice
  *selectable_if (can_choose) #MyChoice

It’s not the tidiest approach, but it should work.
Otherwise as @MaraJade suggested, check out the concatenation page.

It doesn’t specifically cover *ifs but it’s a similar principle to that discussed under the ‘more than two strings’ section: http://choicescriptdev.wikia.com/wiki/Concatenation#Concatenating_More_Than_Two_Strings

Just drop the &'s


#11

@CJW
Thank you. Your system has seemed to fix it.