Neither true nor false error

I am getting this error:

line 117: Neither true nor false: woman

I don’t understand what it means. That variable doesn’t even exist in that line.

My code looks like this:

*choice
  *if (man) #Samuel...
    *set firstname "Samuel"
    *set nickname "Sam"
    *goto last_name

The second line (*if (man), etc) is 117, the one that’s showing the error. I can include more of the code if needed, i wasn’t sure how much was relevant.

I’m guessing you have this somewhere in your code?

*set man woman
1 Like

I have

*set man false
*set woman false 

at the beginning of the startup

then the gender choice a bit further down from that in the code sets one of them as true, depending on which you pick.

It was working fine earlier, then I changed something and it stopped working, but I can’t remember what I changed! But I definitely had it working at some point using that setup.

Mind posting your gender setup section? I feel there’s a bit fukup around there.

Print the value of variable man right before the choice.

${man} 
*page_break
*choice
   ... 

no problem.

This is the relevant part of the startup:

*create man false
*create woman false
*create man "man"
*create firstname "firstname"
*create lastname "lastname"
*create nickname "nickname"
*create him "him"
*create his "his"
*create he "he"
*create himself "himself"
*create guy "guy"
*create sir "sir"
*create bastard "bastard"

and this is the actual choice-

*choice
  #...a woman who clearly didn't sleep well last night.
    *set woman true
    *set man "woman"
    *set him "her"
    *set his "her"
    *set he "she"
    *set himself "herself"
    *set guy "gal"
    *set sir "ma'am"
    *set bastard "bitch"
    *goto eyes
  #...a man who probably doesn't want to be awake right now.
    *set man true
    *goto eyes

Ah, yes. You have

*set man true

on the startup, but it gets replaced into string (text) variable.

*set man "woman"
2 Likes

OH. I totally see it now. Whoops!

Thanks for your help!

Alternatively, you can combine both variables into one to make it simple.

*set gender "man/woman"

Consequently, all checks afterwards will have to be longer:

*if gender = "man"

But, as always, I’m a strong proponent for a humanly-readable code.

2 Likes

Sorry, can you explain the “man/woman” part? I haven’t seen that format before (I’m a noob lmao).

Oh, it’s just a text. An example. Don’t pay it too much attention.

Though, if you do, don’t actually write “man/woman”, lel. Write either, depending on your gender setup.


*choice
   #man
      *set gender "man"
   #woman
      *set gender "woman"
   #nb
      *set gender "nb"
1 Like

Ah okay, lol. Your use of “combine” plus that example made me think it was some kind of weird multi-replace. I didn’t know you could make the game actually read words like that!

But you actually do :thinking: thonk
Yes, you can have the game check for exact content of a text.

I was just going to use those for find-and-replace, lol. I learned something new today.

I second that.

What I personally like to do is:

__startup.txt__
*create MALE "M" 
*create FEMALE "F" 
*create gender "" 


__somewhere_else.txt__
*choice
   # Man
      *set gender MALE
   # Woman
      *set gender FEMALE


__checking.txt__
*if (gender = MALE) 
   do something... 

Or something like this.

Conditional checks can compare 3 types of variables: text, numeric, and true/false a.k.a. boolean.
It’s in the wiki: If | ChoiceScript Wiki | Fandom which is part of the masterlist thread.

1 Like

Yeah. I didn’t see that, I did check the wiki but I was just looking for the solution to the specific problem I was having, not browsing. Anyway, thanks to you both!

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