I'm experiencing a strange bug in Twine

Twine Version:2.3.9
Story Format: Harlowe 3.1.0

At some point in my game, I want passage A to send the player to passage B, then be sent back to passage B, and then lock the link between A and B.

I have a variable (specified in the startup passage) called $tables which is set to false. The idea is that an if: and else-if: macros are attached to the link, meaning that when $tables is false, it displays the link which sends you to passage 2. In passage 2, $tables is set to true, so when you go back, it displays text that says, “you’ve already been to passage 2”

Here is what the code around the link in question looks like:
{(if: $tables is ‘false’)[[[Look under the tables]]
](else-if: $tables is ‘true’)[You’ve already looked under the tables]}

(Tell me if I’ve done anything wrong here)

The issue now is that instead of sending me to passage 2 (called “Look under the tables”), Twine automatically creates a passage called, “[Look under the tables”.

The game is still works if I use the new passage, but I don’t understand why it’s added the [. I’ve tried deleting the new passage, copy and pasting the code from the old passage into the new one and changing the name, messing around with the number of brackets on each side of the link, and grouping the 3 brackets on the right together. Nothing seems to work. Like I said, the game still works, so this isn’t a huge deal, I’m just very confused as to why it’s behaving this way.

Thanks

My guess is that it’s parsing the string of [ characters as a link before seeing it as a condition block.

Try writing it like this and see if it behaves better:

{(if: $tables is ‘false’)[
	[[Look under the tables]]
](else-if: $tables is ‘true’)[You’ve already looked under the tables]}

Even just adding a space may fix it:

{(if: $tables is ‘false’)[ [[Look under the tables]]
](else-if: $tables is ‘true’)[You’ve already looked under the tables]}

Yep. That fixed the problem. Thanks a mil, I probably never would have noticed that. (It’s gonna help me a lot too because I would’ve switched to link: macros.)

You don’t need to use a line-break to overcome the Twine 2.x application’s link parser’s limitation, simply adding a space character before the opening [[ of the link markup would also work…

{(if: $tables is ‘false’)[ [[Look under the tables]]]
(else-if: $tables is ‘true’)[You’ve already looked under the tables]}

note: If the $tables variable is meant to represent a Boolean true / false state then it makes more sense using actual Boolean literals instead of String equivalents.

<!-- initialise the variable in your startup tagged passage. -->
(set: $tables to false)

<!-- Later on update the variable when needed. -->
(set: $tables to true)

<!-- Evaluate the current state of the variable when needed. -->
{(if: not $tables)[ [[Look under the tables]]]
(else:)[You’ve already looked under the tables]}
or...
{(if: $tables)[You’ve already looked under the tables]
(else:)[ [[Look under the tables]]]}