Coding issues

I’m getting the following error…

Error: line 326: Not a number: _survival

The relevant line is…

*if ((partner&"_survival") >49) 

Now as far as I’m aware the code above should check the variable [insert partner name]_survival stat which is a number.

So for example, if the current partner is Austin it would check austin_survival.

However, going by the error it’s not working how I thought it did. Have I done it wrong or did I just misunderstand what it does?

It’s missing one step. Right now it’s a string compared to a number. I think it needs to be forced to be interpreted as a number on the left. Try this:

*if ({{partner & "_survival"}} > 49)

(see last section “Truly bizarre references”: Advanced Choicescript - Choice of Games LLC)


Sadly it didn’t work says that _survival isn’t a variable.

I’ll have to do this the hard way, thank you anyway.

A bit of trial and error!

*if {partner & "_survival"} > 49
*create austin_survival 50
*create partner "austin"

*if ({{partner & "_survival"}} > 49)

I put this in a test startup and it prints yes. If you are willing to let us see the rest of the code, maybe we can see what else is involved in the issue? :slight_smile:

(It’s cool that Sinnie’s answer also works.)

*if {partner & "_survival"} > 49

@brushmen - I don’t think we need all those brackets. I just tried it with the single set of curly braces and it works fine (edited my post).


Array notation supports strings too, so you could actually do:

*if (partner["survival"] > 49)


Thanks for the suggestions I found a different way of doing it which while not as clean actually required less code.


Okay. I’ve been running randomtest (the game passes quicktest) yet it running into an error during seed 4 which doesn’t seem to exist. So I thought I’d reuse this topic.

The specific error message is; Error: buried line 93: increasing indent not allowed, expected 2 was 4

Now the code;

  *hide_reuse #"How do you think we should approach this?"
    *if (partner = "Cassandra") [<- This is line 93] 
      "We need to make sure that the unnatural isn't a threat to anyone and stays contained. That has to be our first priority, or even better, we should set up explosives and blow the chamber up to ensure it stays buried," Cassandra says firmly.
      *goto buried_talk
    *elseif (partner = "Victor")
      We should go straight to the creature and kill it, anything that can survive being buried alive needs to be taken down while its easiest," Victor replies.
      *goto buried_talk
      "We need to speak to the client, find out all we can about the ruins," $!{partner} replies.
      *goto buried_talk

It says 2 expected was 4 but I use tab and auto format in CSIDE which is set to 2. so I’m not sure why it’s erroring. I’m hoping some fresh eyes can spot the obvious issue I’m missing,

EDIT: fixed it now. It was a silly mistake.