Selectable_if not?

I’m having trouble with figuring out how to make a selectable_if check if a bolean variable is false, not true.

The error I’m getting is: Error: prologue line 327: Couldn’t parse the line after *selectable_if: not (aloof)

My code looks like this:
choice
¨¨
selectable_if not (aloof)
¨¨¨¨#Aloof
¨¨¨¨¨¨set aloof true
¨¨¨¨¨¨
goto sheet_trait
(Okay, I give up on making it look right in here. I’m using a danish keyboard, so some things don’t translate, and I don’t know which buttons to use. The code has stars in the right places…)

I think I just figured it out. I’ll check.

Try putting it on the same line:

*choice
  *selectable_if (not(aloof)) #Aloof
    *set aloof true
    *goto sheet_trait

Also, mark code by hitting the </> button when writing, or using three back ticks (```) above and below it.

3 Likes

Thanks for the reply. :smile:
That’s exactly what I just tried, and it worked.
And I will try to do that next time I ask for help with code.

You can also use
*selectable_if (aloof = false) #Aloof

This may be preferable based on your love of brackets or not.

3 Likes

It took me an embarrassingly long time to realize that I was skipping a necessary parenthesis when I tried to do this, i.e. that

*selectable_if not(variable)
won’t work;

*selectable_if (not(variable))
will.

2 Likes

*selectable_if randomvar #Option
won’t also work. Won’t pass randomtest :expressionless:

I… don’t know what you’re saying.

Is that a boolean test to check if a variable named randomvar returns a value of true ? I think it needs to be *selectable_if (randomvar) #option in a case like that.

2 Likes

Yea, it is a boolean variable :sweat_smile:
Just the opposite of @Havenstone’s case.

I’m not sure with other types of variable, tho. I just assumed that all of them require parentheses.

“The condition itself must always be placed within parentheses (brackets).”

3 Likes

The basic code for a Boolean is:

*if variable = true
*if variable = false

These can also be written as:
*if (variable)
*if (not (variable))

I tend to use the second for true and the first for everything else, but these are interchangeable.

Outside of #options, it’s also possible to check *if foo without parentheses. Parentheses are only mandated in the case of *selectable_if because there needs to be an end to the equation before the actual #option.

3 Likes