The help page about setting and getting attributes includes instructions on how to do it from Javascript. In your case:
if (i < 9)
squiffy.set("money", squiffy.get("money") - 5);
I haven't tested this, hope it works. Good luck!
I don't believe you can put the @dec within an else statement. I could be wrong, but I suspect that's why it's being executed regardless.
Sadly the conditional logic in Squiffy using Markdown is quite limited.
The fix would be to deal with the reduction in cash via javascript prior to your if else statement. I'd have a javascript variable for money, and a corresponding squiffy attribute. All modifications to the sum would be first calculated in JS, and then the JS variable converted to the standard Squiffy attribute, which you can output with the standard {myattribute} call.
So basically you keep all calculations within the JS element, and the Squiffy attribute is simply updated to match.
I threw this together. In this example it's basically a 50/50 chance rather than 1 in 10, but the principle is the same.
var money = 70;
var x = Math.floor(Math.random() * 2 + 1);
if (x===1)
{
var money = money
}
else if(x===2)
{
var money = money - 6
}
squiffy.set("mymoney", money);
squiffy.set("mynumber", x);
{if mynumber=1:Congrats! Because you were the 100th customer that day, you won a free burrito! It tasted delicious, because free food always tastes better. You spent no money and still have ${mymoney}.}{else:You spent $6 on a burrito. Yum. You now have ${mymoney}}
<br><br>
[Continue]
I tested the above and it works fine.
It's important to remember that if you're using this method regularly during your game, you'll need to ensure that your Squiffy attribute mymoney and your Javascript variable are kept in sync. This can easily be accomplished using:
var money = squiffy.get("mymoney");