I must be stupid because for the life of me I haven’t been able to get my currency system to work. I’m not sure what I am doing wrong.
It keeps telling me my number isn’t a number, and Im not entirely sure why.
You ponder the price he has given.
#Two Hundred gold is a good price.
*set Wealth +200
That’s literally it. Before that in the startup scene I have:
*create Wealth “”
*set Wealth “0”
I must be an idiot because I don’t see how 200 isn’t a number. No matter what way I write it, or what order it tells me it’s not a number.
What would happen if you did *create Wealth 0 in the first place?
That…. worked. I never thought of that. I always assumed variables had to be set after being created.
Well I am dumb, thanks lol.
TBC issue wasn’t that you were creating variables and setting their value separately, it’s that you created and set the value as a string by the use of quotation marks and trying to do numerical addition to it. Long story short don’t use quotation marks if the variable intended use is numeric.
That’s pretty much what I had in mind, without the vocabulary to put it into words as elegantly as you have here. Thanks for the explanation!
You tell Choicescript what kind of variable you’re creating by what you initially create it as.
*create variable true
will create a Boolean (true/false) variable.
*create variable “”
(or with anything else in the quote marks) will create a string variable, i.e. a set of characters.
Either of those types of variable will give you the “not a number” error if you e.g. try to add to them or set them to a numeric value. When you created wealth as a string and then *set wealth “0”, it’s the same as if you’d *set wealth “zero” – a human reader understands it easily, but because of the variable type, for the computer it’s the same as setting wealth to “measureless” or “mothballs”.
This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.