Hi everyone! I'm fairly new to Twine and coding in general, and I've been reading and practicing a lot with strings in SugarCube, but I've hit a bit of an issue. In the story I'm writing, the player finds 5 pieces of gold, of which I believe the code would be:
<<set $gold += 5>>
However, when I go to display the amount of gold the player has:
<<print "You have" + $gold + "gold coins.">>
It reads: You haveNaN gold coins. I've read numerous sources on how to change it, but I have not been able to find any that help. Any help or tips you can offer to this newbie would be greatly appreciated! ;D
Comments
So in your StoryInit passage do the following Now this code will display: You have 5 gold coins.
(note: I changed you code and added an extra space before and after the $gold variable.)