Temp Text not working

I created a “Reputation” temp text, which works perfectly fine until you try to change its value, even in the “create” section - It only works when it equels 0. There is no error message, it simply wont work. Thanks.

this is the code in the choicescript_stats:

*temp rep_text

*if rep = 0
*set rep_text “Netrual”
*goto chart
*elseif rep = 1
*set rep_text “Positive”
*goto chart
*elseif rep = 2
*set rep_text “Very Positive”
*goto chart
*elseif rep = 3
*set rep_text “Amazing”
*goto chart
*elseif rep = 4
*set rep_text “Hero”
*goto chart
*elseif rep = 5
*Set rep_text “Living Legand”
*goto chart
*elseif rep = 6
*set rep_text “Negative”
*goto chart
*elseif rep = 7
*set rep_text “Very Negative”
*goto chart
*elseif rep = 8
*set rep_text “Hatred”
*goto chart
*elseif rep = 9
*set rep_text “Tyrant”
*goto chart

*label chart

Character
*stat_chart
text Name
text Gender_text Gender
text Money
text Health_text Health
text rep_text Reputation

and the text at the top of startup:

*create rep_text “Neutral”
*create rep 0

You have a temporary variable that’s called exactly the same as a continuous variable? That can’t work properly… I think. Try getting rid of the *temp variable.

1 Like

Are you missing indents?

If what you’re going for is a stat screen with text values (without stat bars) I would handle the code differently.

Eg. In the file:
choicescript.txt
Name: {name} Gender: {gender_text}
Money: {money} Health: {health_text}
Reputation: ${rep_text}

^— that way it displays what text you want, how you want it. You’d have to put in line_break to get them under each other.

I’d get rid of the temp “rep_text” as you’ve already globally created that in startup.txt. Also, with temp values I’m sure they need values like the global ones: numerical / boolean / text.

How are you doing the rep check? Using a gosub command?

@Silverstone

I tried, and i got error message: "invalid line; this line should start with ‘percent’, ‘text’, or ‘opposed pair’. same with the other variables.

@Cecilia_Rosewood
As for getting rid of the temp “rep_text”, I dont want the text to stay the same for the entire game, I want it to change according to player choices, Using numbers and not text (aka “set rep +1”, Not "set rep_text “bla bla”).

If you’ve already got a permanent variable (the variable is permanent, not the value) you don’t need a temp variable by the same name. It should work fine without it.

Edit:
And it does. Just tested it.

Choicescript_stats.txt

*if rep = 0
    *set rep_text "Neutral"
    *goto chart
*elseif rep = 1
    *set rep_text "Positive"
    *goto chart
*elseif rep = 2
    *set rep_text "Very Positive"
    *goto chart
*elseif rep = 3
    *set rep_text "Amazing"
    *goto chart
*elseif rep = 4
    *set rep_text "Hero"
    *goto chart
*elseif rep = 5
    *Set rep_text "Living Legend"
    *goto chart
*elseif rep = 6
    *set rep_text "Negative"
    *goto chart
*elseif rep = 7
    *set rep_text "Very Negative"
    *goto chart
*elseif rep = 8
    *set rep_text "Hated"
    *goto chart
*elseif rep = 9
    *set rep_text "Tyrant"
    *goto chart

*label chart

Character
*stat_chart
  text Name
  text Gender_text Gender
  text Money
  text Health_text Health
  text rep_text Reputation

The test code in the startup.txt file:

*title Test

*create rep_text "Neutral"
*create rep 0
*create name ""
*create gender_text ""
*create money 0
*create health_text 50


*label setrep
*choice
    #set rep 0
        *set rep 0
        You changed your reputation.
        *page_break
        *goto setrep
    #set rep 1
        *set rep 1
        You changed your reputation.
        *page_break
        *goto setrep
    #set rep 2
        *set rep 2
        You changed your reputation.
        *page_break
        *goto setrep
    #set rep 3
        *set rep 3
        You changed your reputation.
        *page_break
        *goto setrep
    #set rep 4
        *set rep 4
        You changed your reputation.
        *page_break
        *goto setrep
    #set rep 5
        *set rep 5
        You changed your reputation.
        *page_break
        *goto setrep
    #set rep 6
        *set rep 6
        You changed your reputation.
        *page_break
        *goto setrep
    #set rep 7
        *set rep 7
        You changed your reputation.
        *page_break
        *goto setrep
    #set rep 8
        *set rep 8
        You changed your reputation.
        *page_break
        *goto setrep
    #set rep 9
        *set rep 9
        You changed your reputation.
        *page_break
        *goto setrep

Just put that code in an empty version of choicescript and you can see it for yourself.

1 Like

It worked, Thanks very much.

Just a note: If you have a *temp and a *create variable with the same name I believe the *temp one always takes precedence.

That’s because *stat_chart requires one of those things. I forgot to mention to remove *stat_chart if you do it the way I suggested. No matter, it’s working for you now thanks to @Cecilia_Rosewood :smile:

1 Like