Quantcast
Channel: Help! with 2.0 - Twine Forum
Viewing all articles
Browse latest Browse all 1844

Something I don't understand with += and -=

$
0
0
Hi, I use Twine 2.1.1 and sugarcube 2.14

I work on a textbox for a bank system (withdraw and deposit).

Here what I've got on the passage called "Bank" :
Withdraw : <<textbox "$Withdraw" "">>[[euros|Bank]]
Deposit : <<textbox "$Deposit" "">>[[euros|Bank]]

and here what I've got in the display :
\<<if passage() is "Bank">><<if $Withdraw>><<set $Money+=$Withdraw; $Baccount-=$Withdraw>><</if>><<if $Deposit>><<set $Money-=$Deposit; $Baccount+=$Deposit>><</if>><</if>>

The result for the -= is always good.

BUT, the result for the += set something weird.

For example :

$Money is 10
$Baccount is 1000

I withdraw 200, the result would be 210 and 800. No the result are 10200 and 800
Then I deposit 200, the result would be 10000 and 1000. No the result are 10000 and 800200

So maybe my setting is wrong, but I don't understand the result.

Viewing all articles
Browse latest Browse all 1844

Trending Articles