0 votes
by (200 points)
retagged by
Probably a question with a ridiculously simple solution (I missed a colon or something), but I don't know what's going on, so...l.o

I was going through and testing my current setup for my game, and when I got to the point where I was testing a currency variable, I could "buy" one thing and then everything else was locked out (because I have it set to where the "buy confirm" option isn't available if the money variable is <= 0...debt is not the name of the game...)

When trying to figure out why this was, I made it to where, after buying something, I would print the value of the variable. Instead of subtracting from the total value of the variable, the decriment I used to make the variable go down replaced the previous value of the variable...did I miss something?

Here's some code snippets for illustration:

[initializing variable] (set: $money to 0)

[gaining money after quest end] (set: $money to $money + 100)

[buying something] (set: $money to $money - 10)

Thanks for any help anyone can provide, because if this isn't working, it means a lot of things aren't working...(though a different variable counter with the same increment/decriment syntax was working just fine, so...idk)

1 Answer

0 votes
by (159k points)
selected by
 
Best answer

Please use the Question Tags to state the name and full version number of the Story Format you are using, adding that information to the Question Title just makes it longer than it needs to be. Also please use the "Insert Code Snippet" button when you want to add a code example to your posts, it makes the examples easier to find and read.

Your code example (what there is of it) looks correct, although you could change the increment and decriment examples to be like the following which would reduce the possibility of misspelling the variable names.

(set: $money to it + 100)
(set: $money to it - 10)


Without see the real code it is difficult to determine what is causing your issue.

by (200 points)
Ah, jeez, this is why I need to not post stuff like this when I'm rushed; I knew I was forgetting something.

Anyway, I figured out my stupid problem and I did in fact have a typo in the declaration (that I didn't realize and had copy/pasted to several other passages) and boy do I feel like an idiot! Sorry to waste your time, but thanks for giving it.
...