*if parentheses multiple vars

I’m writing a kind of aptitude test at the beginning of my story (kind of like the GOAT in Fallout 3) and I’m trying to figure out the best way to mark up the results.

I am very new to Choice Script, so I apologise for any stupidity :stuck_out_tongue:

So I made a bunch of *temp vars like this:

*temp test_police 0
*temp test_fire 0
*temp test_ambulance 0
*temp test_army 0
*temp test_politician 0
*temp test_scientist 0
*temp test_construction 0
*temp test_con 0
*temp test_novelist 0
*temp test_dancer 0

With each question I am adding a score for each var. That’s all working fine.

I am trying to write an *if statement that will find the var with the highest score.

I’m thinking either it cannot be done with this many vars or I need some very complicated parentheses.

This is what I have so far:

*if ((test_fire > test_police) and (test_fire > test_ambulance)) and ((test_fire > test_army) and (test_fire > test_politician)) and ((test_fire > test_scientist) and (test_fire > test_construction)) and ((test_fire > test_con) and (test_fire > test_novelist)) and (test_fire >test_dancer)
	*goto fire 

At the moment I am getting:

Invalid expression at char 128, expected no more tokens, found: NAMED_OPERATOR [and]

Does anyone have any good suggestions?

Thanks in advance!

You’re missing a lot of parenthesis. Basically Choicescript only accepts pair testing, so you have to group stat checks a lot.

I think this should work:

*if (((((((((test_fire > test_police) and (test_fire > test_ambulance)) and (test_fire > test_army)) and (test_fire > test_politician)) and (test_fire > test_scientist)) and (test_fire > test_construction)) and (test_fire > test_con)) and (test_fire > test_novelist)) and (test_fire >test_dancer))
	*goto fire 


You can also check single pairs, and nest another single check, etc.

*if (a and b)
   *if c
      *if (d or e)
         lotsa of checks
1 Like

@EclecticEccentric thank you so much, you’re a genius!! :balloon:

Thanks @Szaal I’ll bear that in mind :slight_smile: