I am trying to make the ‘suspicion’ bar appear with different text depending on the scene. So I am using if statements based on the variable ‘scene’ to change the text. The problem is the stats screen shows the variable as something else than when I reference it in-game.
When the scene variable is shown on the stats page, it shows the variable as ‘object Object’. However, I have tested the variable by placing it in-game as ${scene} and it shows the correct scene: ‘heist’.
My code in the stats file:
[b] Character Information [/b]
*if (scene = "heist")
*stat_chart
text name
text gender
percent suspicion Attention
*elseif (scene = "interrogation")
*stat_chart
text name
text gender
percent suspicion Combativeness
*else
*stat_chart
text name
text gender
percent suspicion Suspicion
text scene
It always goes to the last *else because choicescript isn’t interpreting the scene as ‘heist’
My code in the heist scene file:
*set scene "heist"
${scene}
Here the scene variable appears correctly as ‘heist’.
Yeah, and showing a general idea of what the code, in general, looks like could be helpful as well. If this is embedded deep within other else statements, it could just be skipping to the first “true” statement.
Just tried that, now I get there error “It is illegal to fall in to an *else statement; you must *goto or *finish before the end of the indented block”. Which is odd because I didn’t think you needed a *goto or *finish in the stats screen (at least it worked before when I didn’t have that), but I’ll try fixing that now.
That worked!
*if (part = "heist")
*stat_chart
text name
text gender
percent suspicion Attention
text part
*goto continue
*elseif (part = "interrogation")
*stat_chart
text name
text gender
percent suspicion Combative
*goto continue
*else
*stat_chart
text name
text gender
percent suspicion Suspicion
*goto continue
*label continue
Lesson learned, don’t use ‘scene’ as a variable. I changed the variable to ‘part’ and now it works! Thanks a bunch. (updated to include the new variable shown)