Conditional Stats (And Other Scripting in Stat Charts)


#1

I’d like to create a stat chart where certain skills only show up if you have points in them. So far the only way I can think of to accomplish this is to create a separate stat chart for each skill, like so:

*if (skill_1 != 0)
*stat_chart
percent skill_1 First Skill
*if (skill_2 != 0)
*stat_chart
percent skill_2 Second Skill

Is there a more efficient way to do this?

Second question – I tried writing:

*stat_chart
percent Skill
${skill_text}

And the description showed up as ${skill_text} instead of as the value of the variable. Again, I could work around this with a different stat chart for every possible value of skill_text, but that’s a rather ridiculous amount of script.

Help?


#2

…I want to edit my post…

Just realizing that indentation doesn’t show up.

Revised:

*if (skill_1 != 0)
…*stat_chart
…percent skill_1 First Skill
*if (skill_2 != 0)
…*stat_chart
…percent skill_2 Second Skill

…and…

*stat_chart
…percent Skill
…${skill_text}


#3

We can’t use arrays, so the only way I can think of is using a text variable which is the concatenation of many variables like what they did in Choice of Vampires. Something like:

*label Dex
*if dexterity > 0
…*set skill_display &“Dexterity” & " " & ${Dexterity} & line_break
…*goto str
*else
…*goto Str

*label Str
*if strength > 0
…*set skill_display &“Strength” & " " & ${Dexterity} & line_break
…*goto wis
*else
…*goto wis

and at the end
Skills:
*line_break
${skill_display}

I haven’t tested the above, since I am at work but the above looks laborious and also you may not be able to concatenate multiple variables which requires use of subroutines.


#4

As far as I can tell, what you wrote would be more simply accomplished like this:

Skills:

*if (dex > 0)
…Dexterity: {dex} ....\*line_break \*if (str > 0) ....Strength: {str}
…*line_break

…and so on. What I’m trying to do is display the red and blue stat bar for each skill. As far as I know, there is no way to do this outside of a *stat_chart command, and there is no way to use any conditionals or such within that *stat_chart command.


#5

Hm, no, I can’t fall out of an *if the way I wrote it. I think it can still be simpler than what you’ve written, though, maybe something like this:

Skills:
*line_break
*if (dex > 0)
…Dexterity: {dex} ....\*line_break ....\*goto strength \*label strength \*if (str > 0) ....Strength: {str}
…*line_break
…*goto wisdom

That wasn’t really my question, though…I want to be able to use stat bars while using commands to determine the stat’s name and/or description.