Not a number

So I’m having a problem with the not a number error.

This is where the error is involved when you reach this part it tells you aunt or uncle (who ever you choose as a caretaker) is not a number.

*if (food > 0)
 Your ${caretaker} glares at you. she did spend her time preparing that food, and all for it to end up in the trash.
 *set ${caretaker} -10

*if (food = 0)
 Your ${caretaker} smiles happy you took the time to eat your food.
 *set ${caretaker} +10

However my stats look like this

Relationships

*stat_chart
*if caretaker = "Aunt"
  percent ${caretaker}
*if caretaker = "Uncle"
  percent ${caretaker}

And my create section

*create Aunt 0
*create Uncle 0
*create ${caretaker}

Don’t use print syntax ${}

*set ${caretaker} -10

Use reference syntax instead {}

*set {caretaker} -10

Or in layman terms, remove the $ dollar sign.

Im about to see if it works

Oh, this is also an invalid command. *create creates variable; you can’t put any reference in it.

*create ${caretaker}

Do this instead.

*create caretaker ""

Later on, use either *set caretaker "Aunt" or *set caretaker "Uncle" accordingly.

1 Like

Yeah I saw that when I checked it :no_mouth: oops
And now it says its not a number: true

I’ve also already done the third part…

What is in your line 590?

 *set {caretaker} -10

You sure? Seems the error happens elsewhere.
Can you show the pic of your code? On bigger scale.

Or copy your whole scene here.

I’ll have to pm it I don’t feel comfortable otherwise

If I’m looking at your *create* correctly, caretaker is a string variable, not a numeric variable. You can’t use math on a string variable. You have to use the Aunt and Uncle variables instead.

*if caretaker = "Aunt"
      *set Aunt -10
*else
      *set Uncle -10

My suggestion would be to simplify this by turning caretaker into a numerical variable representing the relationship and using a string variable for the name instead.

*create caretaker 0
*create caretaker_name ""

...

*choice
      #My aunt takes care of me.
            *set caretaker_name "aunt"
      #My uncle takes care of me.
            *set caretaker_name "uncle"

...

*choice
      #"Thanks for the food!"
            *set caretaker +10
            Your ${caretaker_name} smiles.
      #"This food sucks."
            *set caretaker -10
            Your ${caretaker_name} frowns.

A variable can only be one thing at a time. The issue is you seem to have caretaker as a string and number.

If you do what @trevers17 suggests above that will fix the error. (The latter part with caretaker_name as a string and caretaker as a number value)

1 Like

Ok I fixed that now I got another error saying that ‘*selectable_if is not a command’

*choice
  *selectable_if (time > 9) #Eat.
   *set time -10
   *set food -1
   *goto eat

However *selectable_if works in this line of code

  *selectable_if (time > 4) #Talk to your ${caretaker}.
   *set time -10
   *goto talk

And Szaal helped me a while ago i forgot to mark her as the solution.

Try copy-pasting the one that works overtop the one that doesn’t.

Just tried it it didn’t work period I thought I misspelled it at first but that’s not the case

Screenshot_2019-07-15_002945

Are you using Firefox by any chance?

Yes I heard about the update and reversed it but this still happened so then i tried chrome same issue.

Are your spaces/tabs correct?

I think so 2 spaces for #
And 3 for *set *goto and so on
And you need a space after (food > 9) so there’s no parse error

It has to be two spaces each time you indent. So your *set and *goto commands need four spaces.

Hmm ive never done that before ill try it might take a while tho 9-10min