First of all I'm quite new to Twine and Sugarcube but I've found my way until now but now I've been struggling to find and answer to the below issue:
I have a character that has several stats like strength and energy.
I use them like this:
In the StoryInit:
<<set $energy to 100>>
In the passages of the story:
<<set $energy to $energy +10>>
Now I want to set a maximum and a minimum for all the stats seperately. I used to do it like this:
<<set $energy to $energy +30>>
<<if $energy gte 100>><<set $energy to 100>>
<</if>>
But to this every time is a lot of work and and just asking for mistakes.
Is there and what is the best way to limit these stats seperately. (so strength has a max of 200 and energy a max of 100)
I haven't used Twine for a while but I think you can just use javascript Math stuff as normal:
Or make it into a widget:
So you can use:
So you can avoid repetition/mistakes as you say. Make a similar one for strength etc. and just change the 100.