Set macro error within switch macro?

Please specify version and format if asking for help, or apply optional tags above:
Twine Version: 2.3.5
Story Format: SugarCube

I think I am going mad. I’ve tried this little bit of code a bunch of times and it always turns up an error in the set sections. However the text after displays just fine. Anyone know why?

<<switch $settingnumber>> /This is a random number generated earlier, and I have also tried printing it just to make sure it is actually a number. (It is)/
<<case 0>> <<set $settingword to “wood”>> realises $he is lost in the wood. What is $he doing and what does $he see and hear? How does $he feel? Does $he hear something move in the trees nearby?
<<case 1>> <<set $settingword to “forest”>> gets caught in the web. Did $he trip or fall into it? What does the web feel like? Does $he hear the noise of an approaching spider through the trees?
<>
some text here
<>

Every time I try it, the switch works, but says there’s an error in the set macros ie “<<set $settingword to “forest”>>”

What am I doing wrong?

Thanks a million.

It looks like the tags in your example code are getting eaten. Can you edit the post and wrap your code in a code block? There’s a button just above the edit box that looks like </> that does it.

Edit: Assuming there’s nothing else important that is missing/eaten, the only thing I can see is that maybe one of the quotes around “forest” is wrong. To be more specific: make sure your quotes are standard quotes and not smart quotes. (This forum turns all quotes into smart quotes unless you use the code block tags, so I’m not sure which yours actually are right now.)

Good: "forest"
Bad: “forest”

1 Like

This was the answer! Thanks so so much!

1 Like