Harlowe (dialog:) breaking (else:) macros

Twine Version: 2.3.14
Story Format: Harlowe
Platform: Ubuntu Linux 20.04 64bit

Hello all, I’m in the process of adding some (dialog:) boxes to my twine story where I think an important piece of information needs to stands out. However, even in the simplest of test cases it seems to break any subsequent (else:) or (elseif:) statements and executes the attached hook even it shouldn’t.

{
(set: $test to 0)

(if: $test is 0)
[(dialog: “Nice one!”)(print: “This is alright”)]

(else:)
[(dialog: “Uh oh!”)(print: “Shouldn’t be reading this.”)]
}

In the above example I get both dialog boxes one after the other, both strings are printed and I get the error:
‘There’s nothing before this to do (else:) with.’

This also happens exactly the same with the (alert:) macro. Obviously there are some simple ways around this in my example, but in a complex story full of (else:) and (elseif:) statements it would be hell to try and re-write everything to avoid this issue. Is there something I’m doing wrong here, or is there any other way to get something similar to a dialog box without it breaking the rest of the script?

Thanks in advance!

Please use the </> Preformatted text option when including a code example, it makes them easier to read/copy and stops the forum’s software code converting valid Standard quotes into invalid Typographical (curvy) quotes.

You’re not doing anything wrong.

Unfortunately Harlowe’s Dialog implementation basically interrupts the Passage processing code and passes execution focus to Dialog’s code, which in the case of the (if:) family of macros results in the halting of any further condition checking in that specific chain of conditions when the focus is returned to the Passage processing.

It’s unclear if the issue is in the implementation of the (if:) family of macros, or in the implementation of the Dialog itself.