Closed parthesis error with selectable if and selectable if problems in general

I searched through the forms looking the solution for the error and I did find one, but it didn’t really help. I keep on getting the error Chapter1 line 716: Invalid expression at char 17, expected OPERATOR or CLOSE_PARENTHESIS, was: VAR [true]. I have a closed parenthesis where it wants one, and it still gives me the error. I’ve tried spamming parenthesis, but nothing worked. This is what the line of code looks like

		*goto trainingsession
	*selectable_if (condition3 = 1) #Go out and buy some fancy clothes
		*set misson1con "true"
		*goto clothesshopping
	#Figure out how to transform back
		*set misson2con "true" 
		*goto thepast
	*selectable_if(((misson2con true)) and ((misson1con true))) #Relax with the rest of the time you have left.

The set of parenthesis should equal the variables … This is how I’d write that line:

*selectible_if ((mission2con = “true”) and (mission1con = “true”)) #Relax with rest of the time you have left.

Note: You may not need the equal sign in the variables; I use numerics exclusively, so my memory may be hazy on that.

Note2: I also added a space between the command and variable at the beginning.

2 Likes

That most interesting thing about your response is that I had that originally and Random test did not like that statement, Also, just another question so I don’t need to enter another topic relating to Selectable if and Closed parenthesis. Is this legal to do.

selectable_if ((weapon = "Shotgun") or (weapon = "Sub-machine gun") or (weapon = "Assault rifle") or (weapon = "Dual pistols")) #You unholster your $(weapon) and begin to kill ghouls to the music.

I’m going to defer to better code-monkeys then I … I would have to work this out slowly to make it work properly.


*selectable_if (((weapon = "Shotgun") or (weapon = "Sub-machine gun")) or ((weapon = "Assault rifle") or (weapon = "Dual pistols"))) #You unholster your ${weapon} and begin to kill ghouls to the music.

That should work, I think. Parentheses always need to go in pairs with ChoiceScript, so I usually start by sectioning them off by twos, then sets of four, then eight, if I get that far.

And maybe try this for the other one?

	*selectable_if ((misson2con = true) and (misson1con = true)) #Relax with the rest of the time you have left.

Again, pairs of vars (ha, it rhymes). And you don’t need the "" with booleans, just true or false will do.

3 Likes

That may be my problem because I am treating the parenthesis like a mathematical equation. But there is a problem what if it’s and odd number and can’t be paired

1 Like

Right…so the pattern would look something like this:


((((var1) or (var2)) or ((var3) or (var4))) or (((var5) or (var6)) or (var7)))

I started by marking off sets of two:


((var1) or (var2)) or ((var3) or (var4)) or ((var5) or (var6)) or (var7)

like that, and then putting together as many sets of twos as I can:


(((var1) or (var2)) or ((var3) or (var4))) or (((var5) or (var6)) or (var7))

(var7) gets snugged in at the end there…

And then one last parentheses around the whole thing:


((((var1) or (var2)) or ((var3) or (var4))) or (((var5) or (var6)) or (var7)))

Also if you’re using CSIDE or the ChoiceScript highlighter for Notepad++ (or anything else similar that includes a ChoiceScript syntax highlighter) it should illuminate the parentheses for you so you can be sure the pairs match. I find that very helpful to check my work. (:

2 Likes

Ok I think I get it now. If i had 3 var per se it would be (((var1) or (var2)) or (var 3))

3 Likes

Perfect!

1 Like

I think this might be my last problem with selectable if, but in this specific section it says no choice, but there is a choice where is really confusing me. When Random test chooses the weapon choice of claws it goes through three options using claws, but only this one is tripping it up. I made sure that the caps were ok and all and they are all set. What could possible be causing no selectable options here. I’m starting to feel like an idiot due to this.

*choice
	*selectable_if (((weapon = "Assault rifle") or (weapon = "Sub-machine gun")) or ( weapon = "Shotgun")) #Hit the leader with the butt of your gun because you have no ammo.
		*set GhoulDancerBoss - 5
		*goto toughtime2
	*selectable_if ((weapon = "Brass Knuckles") or (weapon = "Crowbar")) #You swing your ${weapon} at the leader knocking out what few teeth he already had
		*set GhoulDancerBoss - 20
		*goto toughtime2
	*selectable_if (((weapon = "Claws") or (weapon = "Bowie Knife")) or ((weapon = "Karambit") or (weapon = "Machete"))) #You swing your ${weapon} at the ghoul leader slicing off one of his arms
		*goto toughtime2
	#Look for a spare magazine in your pack.
		You found no magazines that could be used for your gun, but you did find three hundred dollars
		*goto toughtime2

The code looks fine.

Can we see the error message you got? The problem might lies not in the choice body itself.

line 906: No selectable options