Selectable_if error

*if ((alicia_present) or (cameron_present)) or (((lexi_present) or (myano_present)) or (((olapen_present) or (samuel_present)))
‘’’*choice
‘’’*selectable_if (alicia_present = true) #Talk to Alicia
‘’‘You talk to Alicia
‘’’*finish
‘’’’*selectable_if (cameron_present = true) #Talk to Cameron
‘’’‘You talk to Cameron
‘’’’*finish
‘’’’’*selectable_if (lexi_present = true) #Talk to Lexi
‘’’’‘You talk to Lexi as she wolfs down a whole pizza.
‘’’’*finish
*selectable_if (myano_present = true) #Talk to Myano
You talk to Myano as she preens herself
*finish
*selectable_if (olapen_present = true) #Talk to Olapen
You talk to Olapen
*finish
*selectable_if (samuel_present = true) #Talk to Samuel
You talk to Samuel
*finish
*else
You find no-one to talk to, poor you!
*finish

Error Line 131: Neither true nor false

1 Like

Are you sure the variable being tested on line 131 is boolean, not numeral or a string?

If you format your code so that we can clearly see the indentations, that would be most helpful; also, which line is line 131?

Also, you can just do *if samuel_present; you don’t have to say *if (samuel_present) = true.

Edit: OK, I think I have it. The code is testing (samuel_present = true) as a boolean rather than testing samuel_present as a boolean.

Just change everything to the *if samuel_present format and this should be fixed. Unless there’s something wonky going on in with a *create or a *temp.

Here’s what I wrote

I think that for the first if statement you have to write *if((alicia_present = true) or (cameron_present = true)) and so on.

Edit: You’d also have to do that for the selectable_if statements too.

students line 131: Invalid expression, expected CLOSE_PARENTHESIS

*if (((A or B) or (C or D)) or (E or F))

That isn’t the case. *if alicia_present works the same as using *if alicia_present = true.

*if (((alicia_present = true) or (cameron_present = true))) or (((lexi_present = true) or (myano_present = true)) or (((olapen_present = true) or (samuel_present = true)))

*if (((alicia_present or cameron_present) or (lexi_present or myano_present)) or (olapen_present or samuel_present))

Then it says Line 131, neither true nor false again

What do you have for your *create for those variables in your *startup file? (Or your *temp if they are only in this chapter?)

Startup files:

*create akashic_friendship 0
*create ennui_friendship 0
*create leon_friendship 0
*create npc1 “Myano”
*create myano_present “”
*create myano_friendship 0
*create npc2 “Samuel”
*create samuel_present “”
*create sam_friendship 0
*create npc3 “Cameron”
*create cameron_present “”
*create cameron_friendship 0
*create npc4 “Lexi”
*create lexi_present “”
*create lexi_friendship 0
*create npc5 “Misako”
*create misako “”
*create misako_present “”
*create misako_friendship 0
*create npc6 “Tetris”
*create tetris_present “”
*create tetris_friendship 0
*create npc7 “Olapen”
*create olapen_present “”
*create olapen_friendship 0
*create npc8 “Alicia”
*create alicia_present “”
*create alicia_friendship 0

There’s the problem.

You created them as strings. They need to be booleans.

change them from *create cameron_present “” to *create cameron_present false (or true–whichever you want to be the default.)

Side note: Incidentally, this is why it is good practice to avoid the = “true” way of checking variables–to keep a careful distinction between booleans and strings, because you can get confused about which you are checking if you use = “true”

students line 136: Invalid expression at char 76, expected CLOSE_PARENTHESIS, was: NAMED_OPERATOR [or]

What.

Show me that line. Is it the talk to Cameron line?

*if (((alicia_present or cameron_present) or (lexi_present or myano_present)) or (olapen_present or samuel_present))

(I edited the above and you were too quick for me–you cut and pasted the pre-edit with the typo still in it!)

1 Like

It works now, but I will come back to the topic if anything else needs fixing in this code!

1 Like

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the @moderators.