Invalid expression

I’m having trouble with the *if command

The error I’m getting is: Invalid expression at char 16, expected OPERATOR, was: NUMBER [1]

My code looks like this:

*if Siblings_Alive = "1"
*goto A43
*if Siblings_Alive = "2"
*goto A44
*if Siblings_Alive = "3"
*goto A45
*if Siblings_Alive = "4"
*goto A46

I have tried without the quotes and equals sign already, now I’m just confused.

Have you tried putting ( ) brackets around sibling alive to the end?

Like so:

(Siblings_Alive = “1”)

Have you tried *if Siblings_Alive = 1?

You don’t need the expression in parentheses.

Are you sure you want the variable for Siblings_Alive to be a string rather than an number? What does your variable declaration look like at the start? There’s a significant difference between 1 and “1”.

Is it *create Siblings_Alive 4, (or whatever number)

or *create Siblings_Alive “unknown”? (or whatever in the quotation marks)

1 Like

Here is how I would write this.

*if (Siblings_Alive = 1)
  *goto A43
*elseif (Siblings_Alive = 2)
  *goto A44
*elseif (Siblings_Alive = 3)
  *goto A45
*elseif (Siblings_Alive = 4)
  *goto A46
  *bug Siblings_Alive should be between 1-4.

Make sure that in startup.txt, you have this code with whatever default value you want:

*create Siblings_Alive 1

And elsewhere you’ve got something that looks like this:

*set Siblings_Alive 4

Although honestly I wouldn’t write it like I wrote above at all; I’d go:

“Hey man, @{Siblings_Alive+1 I know you don’t have any siblings, but try to put yourself in my shoes!|
you’ve got a sibling, don’t you? You know how they are.|
you’ve got two siblings! They’re crazy, right?|
you’ve got three siblings too! You should be on my side!|
you’re one of five — you know how it is.}”