Ink: Updating Variable Upon Choice Selection

Greetings Peeps,

I’m working on a small project and have run into a small snag. I’d appreciate any advice you might have.

I have a global variable ‘money’ that I’d like to update after the player selects a choice.

VAR money = 100

=== Store ===
This is a store.
Money: ]money}

* Hotdog: [$3] A hotdog. {~ money = money - 3} -> Store

I’ve tried a variety of variations of the above and can’t quite seem to get the variable to update, all that happens is it displays the text in the brackets before moving on.

Thanks

[Edited by mod to format code]

[Edit: Thanks for the reformat. I’ll keep that in mind for future posts.]

In Ink, the first (EDIT: non-whitespace) character on a line determines what that line is going to do. So when in doubt, put things on a line of their own.

* A hot dog.
    ~ money = money - 3
    -> store
1 Like

Thank you very much for the assistance.