"Hidden" stats, what am I doing wrong?


#1

Hey everyone,

I’ve followed the directions on the choicescript home page dedicated to customising the stats screen, and it only partially works. I’m trying to figure out what I did wrong for the parts that don’t work since I haven’t changed anything.

Here’s the code I’m working with.

*temp title_r1 "???"
*temp title_r2 "???"
*temp title_r3 "???"
*if bestfriend = "Liz"
    *set title_r1 "Liz"
    *goto stat1
*if bestfriend = "Sam"
    *set title_r1 "Sam"
    *goto stat1
*if Natmet = true
    *set title_r2 "Nat"
    *goto stat1
*if Leomet = true
    *set title_r2 "Leo"
    *goto stat1
*if Kiramet = true
    *set title_r3 "Kira"
    *goto stat1
*else
    *label stat1
    *stat_chart
        percent r1 ${title_r1}
        percent r2 ${title_r2}
        percent r3 ${title_r3}

So it should look like this at the beginning (which it does):

However, when the conditions become true, only the first one, Liz or Sam, displays correctly.

The other two stat bars don’t show the name change if the correct conditions are met. I have checked the code multiple times to make sure the condition actually does become true and is spelled correctly, but to no avail. Does it not work with boolean variables or do I have it set up wrong?

I’m not sure what is causing the difference? I don’t want to hide it completely, I simply want the name to change from “???” to the relevant character’s name.

Thanks guys!


#2

Have you tried using *elseif ?


#3

Yes, I’ve tried that but I’m still getting “???” for the last two bars.


#4

Your problem is that you have a *goto set up after each *if statement. Because of this, the code automatically skips anything after the first true statement, resulting in those other variables not being changed appropriately.

You should be able to make do with just removing the *goto codes.


#5

Wow okay, thank you very much. I don’t know why I couldn’t figure it out.

I previously had *else and *elseif in the statements which forced me to *finish or *goto before they ended, but I forgot that’s not required if you’re using only *if statements.

Thanks again so much!


#6
*temp title_r1 "???"
*temp title_r2 "???"
*temp title_r3 "???"
*set bestfriend "Liz"
*set leomet true
*set kiramet true
*if bestfriend = "Liz"
    *set title_r1 "Liz"
*if bestfriend = "Sam"
    *set title_r1 "Sam"
*if Natmet = true
    *set title_r2 "Nat"
*if Leomet = true
    *set title_r2 "Leo"
*if Kiramet = true
    *set title_r3 "Kira"
*label stat1
*stat_chart
    percent r1 ${title_r1}
    percent r2 ${title_r2}
    percent r3 ${title_r3}

Obviously wouldn’t need the *set commands I added after the *temp commands, but removing the *goto AND *else codes will fix the issue for you.


#7

Yep! It worked perfectly once I got rid of both of those, thanks again!