Twine Version: Twine 2.6.0
Story Format: Sugarcube 2.36.1
I’m trying to use this code to distribute stat points to multiple different stats in one passage. But when I do so, Agility, Endurance and Mind don’t change when you click the buttons. It just shows the variable for the stat. Even when you change the order of that stats, only Brawn changes as you click the buttons. I tried setting the StoryInit passage stats to 5 when applicable, but that doesn’t change anything.
Also tried the Sugarcube 2 (2.18) “Player Statistics” Example, but that code has problems of it’s own. What exactly is wrong with this code and how can I fix it?
Stat Points: <<set $char.SP to 5>><span id="charSP">$char.SP</span>
Brawn: <<set $char.Brawn to 5>>\
<<button "-">>
<<if $char.SP gt 0>>
<<set $char.Brawn--, $char.SP++>>
<<replace "#stats-Brw">>$char.Brawn<</replace>>
<<replace "#charSP">>$char.SP<</replace>>
<</if>>
<</button>> \
<span id="stats-Brw">$char.Brawn</span> \
<<button "+">>
<<if $char.Brawn lt 200 and $char.SP gt 0>>
<<set $char.Brawn++, $char.SP-->>
<<replace "#stats-Brw">>$char.Brawn<</replace>>
<<replace "#charSP">>$char.SP<</replace>>
<</if>>
<</button>>
Agility: <<set $char.Agi to 5>>\
<<button "-">>
<<if $char.Agi gte 6>>
<<set $char.Agi--, $char.SP++>>
<<replace "#statsAgil">>$char.Agi<</replace>>
<<replace "#charSP">>$char.SP<</replace>>
<</if>>
<</button>> \
<span id="statsAgil">$char.Agi</span> \
<<button "+">>
<<if $char.Agi lt 200 and $char.SP gt 0>>
<<set $char.Agi++, $char.SP-->>
<<replace "#statsAgil">>char.Agi<</replace>>
<<replace "#charSP">>$char.SP<</replace>>
<</if>>
<</button>>
Endurence: <<set $char.End to 5>>\
<<button "-">>
<<if $char.End gte 6>>
<<set $char.End--, $char.SP++>>
<<replace "#statsEndr">>$char.End<</replace>>
<<replace "#charSP">>$char.SP<</replace>>
<</if>>
<</button>> \
<span id="statsEndr">$char.End</span> \
<<button "+">>
<<if $char.End lt 200 and $char.SP gt 0>>
<<set $char.End++, $char.SP-->>
<<replace "#statsEndr">>char.End<</replace>>
<<replace "#charSP">>$char.SP<</replace>>
<</if>>
<</button>>
Mind: <<set $char.Mind to 5>>\
<<button "-">>
<<if $char.Mind gte 6>>
<<set $char.Mind--, $char.SP++>>
<<replace "#statsMnd">>$char.Mind<</replace>>
<<replace "#charSP">>$char.SP<</replace>>
<</if>>
<</button>> \
<span id="statsMnd">$char.Mind</span> \
<<button "+">>
<<if $char.Mind lt 200 and $char.SP gt 0>>
<<set $char.Mind++, $char.SP-->>
<<replace "#statsMnd">>char.Mind<</replace>>
<<replace "#charSP">>$char.SP<</replace>>
<</if>>
<</button>>
: :
StoryInit Passage
: :
<<set $char to {
name:" ",
Level:0,
Exp:0,
maxExp:0,
damagehp:0,
damagemp:0,
currHp:0,
maxHp:0,
currMp:0,
maxMp:0,
Brawn:0,
Agi:0,
End:0,
Mind:0,
PD:0,
MD:0,
MSP:0,
SP:0,
USP:0}>>