Trying to solve a problem with the Stat Screen


#1

I’m having trouble with everything in the Stat Screen. I’m frustrated because I have been trying to solve all the problems by myself, but this is something I can’t understand.

The error I’m getting is the following:
I’m trying to create a variable that allows the player to see the stats of a different way. I mean, the player does not only have the option to see his or her strenght as a number, but also it has a description attached to that number. I will show you guys the code:

*if astucia = 0
   *set astucia1 "¿Astucia? ¿Eso se come?"
   *goto chart
*elseif astucia = 1
    *set astucia1 "Tan astuto como un bebé"
    *goto chart
*elseif astucia >= 5
    *set astucia1 "No se te escapa una mentira"
    *goto chart
*elseif astucia >= 8
    *set astucia1 "Habría que darte un premio"
    *goto chart
*elseif astucia >= 10
    *set astucia1 "Eres capaz de venderle hielo a un esquimal"
    *goto chart

*if empatia = 0
   *set empatia1 "Podrías ser un psicópata. Quién sabe"
   *goto chart
*elseif empatia = 1
    *set empatia1 "He visto piedras más empáticas que tú"
    *goto chart
*elseif empatia >= 5
    *set empatia1 "Empiezas a entender la mente humana"
    *goto chart
*elseif empatia >= 8
    *set empatia1 "Habría que darte un premio"
    *goto chart
*elseif empatia >= 10
    *set empatia1 "A veces da la impresión de que lees la mente"
    *goto chart

*label chart

*stat_chart
 text astucia [b]Astucia[/b]  
Actualmente tu nivel de astucia es... [b]${astucia1}[/b]
 
*stat_chart
 text empatia [b]Empatía[/b]  
Actualmente tu nivel de empatía es... [b]${empatia1}[/b]

(The variables are in spanish, but that should not be a problem when it comes to understand the basic code I showed here. At least that’s what I hope…)

Well, as you can see, I just copied the same code I used in “astucia” and I reused it in “empatia”. I created the variables needed in the startup and it just work fine for “astucia” but when the “empatia” is displayed on the screen it just does not work.

Astucia: 0

Actualmente tu nivel de astucia es... ¿Astucia? ¿Eso se come?
Empatía: 0

Actualmente tu nivel de empatía es... Nada 

The description nearby the number stay the same as default. So… thats my problem :smiley: Probably a really stupid one, I know. Thanks before hand.


#2

I assume that your error is the description for [empatia1] stays the same regardless of the number, am I right?

I’m not sure if this is the cause, but your indentation for the codes below *if empatia = 0 are too much. Try making the indentation equal for all nested-code on all files. (i.e. if your indentation is 3 spaces, stick with 3 spaces consistently. Or use tab↹ instead.


#3

I think your *goto commands under the various *if astucia lines are causing ChoiceScript to skip the section of *if empatia lines. Perhaps instead of *goto chart they *goto set_empatia, and you have a *label set_empatia in between the *if astucia and *if empatia lines.

I’m certain it’s also possible to rewrite your *elseif lines to *if lines and completely get rid of *goto commands, but that will likely take more planning. I suspect it would look something like this:

*if astucia =0
    *set astucia1 "¿Astucia? ¿Eso se come?"
*if (astucia >0) and (astucia <5)
    *set astucia1 "Tan astuto como un bebé"
*if (astucia >=5) and (astucia <8)
    *set astucia1 "No se te escapa una mentira"
*if (astucia >=8) and (astucia <10)
    *set astucia1 "Habría que darte un premio"
*if astucia >=10
    *set astucia1 "Eres capaz de venderle hielo a un esquimal"

#4

You were totally right. The problem was that sneaky *goto and my vision problems :sweat_smile: All have been solve, and you even provide a more efficient way of writing the code without all that mess. I thank you with all my heart :heart: