Basic Stat-Screen Question


#1

The wiki may answer this one, but I’m having trouble parsing it if so.

For my game, I’m trying to create a variable for the PC’s “specialty” on the statscreen. I tried to model the code after how you input code for names, which looks like this in the statscreen:

*temp fullname “unknown”
*set fullname “!{firstname} !{lastname}”
*stat_chart
text fullname Name
*line_break

Like this in the startup.txt:

*create firstname “unknown”

and like this in the game when you make a selection:

*choice
#Joe
*set firstname "Joe"
goto nextsection

All that works great, it fills in the name on the statscreen just fine. Now for my specialty my code on the statscreen l tried to make it exactly the same way:

*temp myspecialty “unknown”
*set myspecialty “$!{myspecialty}”
*stat_chart
text myspecialty Specialty
*line_break

It has an identical portion in the startup.txt:

*create specialty “unknown”

and in for the player’s selection in the game looks like this:

*choice
#Pediatrics
*set myspecialty “Pediatrics”
*goto nextpart

As near as I can tell, the code is totally identical, yet when the player picks “joe” it fills in joe on the statscreen, yet when the player picks “Pediatrics” it doesn’t change what the statscreen is displaying. What am I doing wrong?


#2

FYI, you can block your code and use the </> button to de-format-ize your code, showing us the indentation.


Now, back to topic.

On your stats_screen, try to remove the *temp myspecialty "unknown", turning your code into this.

*set myspecialty “$!{myspecialty}”
*stat_chart
    text myspecialty Specialty
*line_break

#3

As I understand it, in your first sample you use two variables—firstname and lastname— to set the value of a third variable, fullname.

In your second example, you have two variables—specialty and myspecialty. However, myspecialty seems to be a temporary variable that only exists in the stats screen. Worse, while there is a command during gameplay to *set myspecialty "Pediatrics", as soon as the player visits the stats screen, the myspecialty variable is reset to "unknown" by the *temp command.

I recommend two changes: First, during gameplay, *set specialty "Pediatrics" instead of *set myspecialty "Pediatrics". Second, on the stats page, *set myspecialty "$!{specialty}" instead of *set myspecialty "$!{myspecialty}".


#4

Szaal nailed it! Thanks guys!