Opening a Sugarcube 2.18.0 game in Sugarcube 2.28.2 - problem with variables

Hi,
recently I created Five Scarabs - a short Twine game with verb-based interface, which uses a lot of variables. I wrote it in Twine 2.1.3 and used Sugarcube 2.18.0 as the story format.

The game has three important variables - verb, target and item. When you, for instance, click the verb “LOOK” in the game, it selects/deselects it as the active verb, using the following code:

<<if $verb == "look">><strong>[[LOOK AT|$return] [set $verb to "none"; set $target to "none"]]</strong><<else>>[[LOOK AT|$return] [set $verb to "look"; set $target to "none"]]<</if>>

So, basically, if LOOK AT was not selected, clicking it makes it the active verb; if it was selected before, clicking it causes no verb to be selected (“none”).

Now, when you start the game, there are no verbs, targets or items selected, so in the StoryInit passage I put

<<set $target to "none">>
<<set $verb to "none">>
<<set $item to "none">>

and it all worked fine.

However, yesterday I sent the game file to someone who wanted to check the code for themselves, and when they opened it in Twine 2.3.3 with Sugarcube 2.28.2 (the current online editor), the code didn’t work - instead of the interactive verb bar, this was displayed when running the game:

[[LOOK AT|room] [none to "look"; none to "none"]]

I opened the game in the online editor and had the same issue. It looks as if the game, instead of setting the content of the $verb variable to “none” in StoryInit, completely converted “$verb” into just “none”. (And it also changed the $return variable to “room” - the name of the current passage).

Does anyone have an idea how to make this run in the current version of Twine? Or is opening in the version it was created in the only option? I feel like I’m missing some simple syntax thing here. I looked into Sugarcube documentation, but couldn’t find an answer.

Any help would be appreciated!

Below are the screenshots of the game running in old (above) and new (below) version of Twine.


Your link markup is formatted very incorrectly—it should never have worked in any version of SugarCube. You should not have spaces between the components, nor should you include the word set within the setter component.

I.e., change links that look like this:

[[LOOK AT|$return] [set $verb to "none"; set $target to "none"]]

Into one’s that look like this:

[[LOOK AT|$return][$verb to "none"; $target to "none"]]
1 Like

Thanks, it helped - it was the spaces. (I only now noticed I posted the code with “set”, which I added when trying to fix the thing with various methods - it wasn’t there in the published file). Interestningly, the code with spaces works with Sugarcube 2.18.0, but of course I’m going to change it and keep this in mind for the future.