Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Textbox and numbers

So I've been messing with twine the past couple of days, fun thing to learn I must say.
But horribly annoying when it comes to troubleshooting what's gone wrong, now a quick explenation of what I've done should be in order. I've made two variables $Stamina and $Magic, both these values are increased and decreased by 1 each click the player does through a small code in the sidebar.
<<if $Options is 1>> /* Time, Magic and Stamina will not increase */
<<else>>
<<set $Time += 1; $Stam -= 1; $Magic += 1>>
<</if>> /* Options if end */

This piece of code runs everytime you click a passage as a way to make progress with each click, this part works fine.
But I made a 'debug' tool to help manage things and with that I made it so that it's possible to change Magic and Stamina with a </span> & <<Textbox>> command
<<if $Statmod is 1>> /* if Statmod */

<span id="STATMODSTAM">
<<click "Change Stamina">>
<<replace "#STATMODSTAM">> <<textbox "$Stam" "10" "Settings">> <</replace>>
<</click>>
</span>

|

<span id="STATMODSTAM">
<<click "Change Magic">>
<<replace "#STATMODSTAM">> <<textbox "$Magic" "10" "Settings">> <</replace>>
<</click>>
</span>


|

<span id="STATMODSandL">
<<click "Change Both">>
<<replace "#STATMODSandL">> <<textbox "$SandL" "10" "Settings">> <</replace>>
<</click>>
</span>
<<if $SandL gt 0>> <<set $Libido to $SandL; $Stam to $SandL; $SandL to 0>> <</if>>



<<endif>> /* if Statmod END */

Basically I can use it to increase/decrease both the the stats $Stam and $Magic, however, after doing so the very first command I showed you, the one that runs in the sidebar partially stops working.
<<set $Magic += 1>>
This one stops adding 1 as a value to the variable, instead adds "1" as a text string to the variable $Magic. Making the number 10 become 101 and for each passage I click, it adds more becoming 1011, 10111 and so fourth.

I'm slowly going crazy trying to figure out why += doesn't work but the -= works just fine. I desperatly need pointers.
Just to add a bit more information, I am using Twine 2 w/ SugarCube 1.0.26.
Sign In or Register to comment.