Twine 2, Sugarcube 2.21.0, need help with stat system!

So my text based rpg is Fallout based

I want to set up the S.P.E.C.I.A.L perk bonuses

Lets say i want my set up to look like this, with just the basic points before you add or subtract.
I know a bit about how to use buttons to add and subtract, but whenever i do, and i tell it to go back to adding or subtracting a point, with a maximum of 10 points to spend, the counter resets!

And yes i want each button click to alter the $playerstr (strength variable) for example!

<<if $statpoints == 0>> [[next|storypoint]]<<else>>Use your points you dummy<</if>> 

wich i learned from a old twine forum post, still learning a lot obviously! But how do i prevent a loop?? If anyone can show me how to set it up so it works! (i also want the $stat 's to be remembered so i can use things like

You have <<print $stat>> strength points! Veronica shakes her head, that wont be enough.

far down the line in the story!

[appended by mod]

So i want to set up the S.P.E.C.I.A.L system in sugarcube 2.21.0

Lets say the base stat, before you either add or subtract, look something like this:

and yes i want the $playerstr for example, to be able to be used later on in the game!

The door is locked down tight, you could brute force it, you have <<print $playerluc>> <<If $playerluc >6>><<print with some luck [[You open it|hallway]]!>><<else>><<print you attempt to pry it open, but you fail, breaking a finger nail in the attempt!
I have no idea if this code is correct, just using what i know so far from trying to learn it, started yesterday :blush:

1 Like

You may want to check out the <<numberpool>> macro set add-on downloadable from the Add-ons section of the SugarCube 2 site.

It can be used to implement the Attribute with Plus & Minus buttons, and supports using a common pool of assignable points.

2 Likes

You may want to check out the <> macro set add-on […]

If I’m not mistaken, the <> in Greyelf’s reply should be <<numberpool>>.

1 Like

Thanks! I edited the comment to make the correct thing show up.