How many variables can you add?


#1

I’m trying to create a composite variable and am running into trouble trying to add more than two variables at a time. This is what I want to do:

*set team_rapport (reg_rapport + rania_rapport + nick_rapport + nora_rapport + leroux_rapport)/5

And this is what I get:

Invalid expression at char 32, expected closing parenthesis, was: OPERATOR[+]

But *set team_rapport (reg_rapport + rania_rapport)/2 works just fine.

Can you only add two variables at a time in ChoiceScript?


#2

Try

*set team_rapport ((((reg_rapport + rania_rapport) + nick_rapport) + nora_rapport) + leroux_rapport)/5


#3

Each statement needs to be wrapped in its own set of parentheses, so you’d need to do something like this:
*set var (((var1 + var2) + (var3 + var4)) + ((var5 + var6) + (var7 + var8)))


#4

Wouldn’t it be easier and simpler to just set them individually?


#5

Doing this:

*set team_rapport 0
*set team_rapport +reg_rapport
*set team_rapport +rannia_rapport
etc
*set team_rapport (team_rapport / 5)

Is also an option, and I think it ends up with the same result


#6