Error flag in a single choice

So, I am running into an airor:

Best_stat_4, non-existant variable stat_1```

I have two questions.
One, if I put the stats page into this, would someone be able to help me fix this, and two, this particular airor only comes up in choice two, with the 
```gosub_scene best_stat``` flag being in the label that all three of the choices connect to. With that in mind, why is only choice two flagging this?

Anyway, here is the stats page:

*label highest_stat_calc
*set stat_counter 1
*label stat_calc_loop
*set stat_1 combat
*set stat_name_1 “combat”
*set stat_2 perception
*set stat_name_2 “perception”
*set stat_3 people
*set stat_name_3 “people”
*set stat_4 tech
*set stat_name_4 “tech”
*if Relationship_counter <= Total_relationships
*if relationship[Relationship_counter] > Highest_relationship_stat
*set Highest_relationship_stat relationship[Relationship_counter]
*set highest_relationship relationship_name[Relationship_counter]
*set Relationship_counter + 1
*goto relationship_calc_loop

It's the relation_calculator one, not the stats_page one, if that helps at all.

Based on this:

Do you have *create stat_1 in startup?

You said that the error only comes up in choice two. Can you describe what happens under that choice?

1 Like

The file at // says: dialog best_stat_5: non-existant variable stat_name_1

I’m still not totally sure what all the stat_ lines do, exactly, and every once in a while an error pops up that, when I reboot my computer, goes away, even if I can’t find anything wrong in the files I have.

Here is what I have in the startup file as far as stats go:

*comment stat_page_variables
*create selectible_if 1
*create stat_page 0
*create stat_counter 1
*create anty_repeat 0

I can put more of the stat variables in, but I’m not sure if this will mess with the highest_calc page, and getting the relationships figured out correctly.

Also, for things like

*set stat_1 XXX
*set stat_2 XXX

ETC, how would you set that up as a create variable in startup? It seems that I don’t have the *stat_1 and such there, and right now, I can’t think of how I would go about setting it up, as it’s neither a true/falce, or a 1/2/3.

All the variables you use need to be created, whether with *create name value in the startup.txt file or with *temp name value before you try to use them.

Have a look at this to get a better understanding of how choicescript works.

1 Like

From what I am getting from the guide, (I am not sure if there is a spasific guide that talks about the *set anty-repeat 0), or at least I was not able to find one, do I have to put the, for example

*create stat_1 ""
It wants a create variable, but as the current variable is, 

*set stat_1 combat

I am a little confused on what to do here.Also, thanks for all the links.

Looking at the startup file for your WIP on Dashingdon, it looks like you have already created the variables for combat and the other stats. But you will still need to create all the variables that you listed in the first post. That means stat_1, stat_name_1, stat_2, stat_name_2, and so forth.

Basically, you cannot *set a variable without creating it first. This is because a variable does not exist until you use *create to include it in the game. (This is also why you got the error message about the non-existent variable.)

What I am confused about is, when I say, put in

*create stat_1 combat

That is neither true/falce, a number, or in a quoted string. I can put quotes after it, but I don’t know how that will affect the other highest_calc page.

Using this will result in an error. You need to include a number instead, so something like:

*create stat_1 0

And then when it’s needed, you can set the variable:

*set stat_1 combat

This means that stat_1 will hold the same value as combat.

CMIIW here, but using quotation marks will result in the variable being treated as a string, not a number. It will probably affect the stat calculations like you said.

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