Closed 2shady4u closed 3 years ago
Just did a little test in Quill:
The switch-statement correctly diverts to the 'else_divert' in that case. So it probably is an issue with inkgd π€
Thanks for the detailed report @2shady4u, it's much, much appreciated and will make things easier to debug. I'll have a look this weekend!
@2shady4u so there's actually a runtime error occurring, which is why the story doesn't recover. I don't really know why it's not visible with Quill, but inky and inklecate both report it.
inkgd reports the issue it as well, but it's not pushed to the editor, so you have to manually look for errors in the story to see it. The next version of ink will revamp error handling but in the meantime, I'll make sure errors are pushed to the editor in debug.
I don't know if it's an ink bug or a normal behavior, it's probably a good idea to ask the folks on Discord or on the main repo. It sounds like the compiler should prevent running into this issue at runtime.
π okay... It's a bit annoying that Ink doesn't catch this on compile-time... And it's also extremely annoying that Quill doesn't crash at all! π€£
It would indeed be easier if a hard crash would be printed to console π€
I'll check with the guys on the Ink discord what the issue is here, because this behavior is just unexpected/weird/unconventional. Like I mentioned before I would expect the "else"-statement to work exactly like "_:" in a Godot match statement.
Thanks for checking this out though π
I made an issue on the Quill repo as well to hopefully figure out this inconsistency. https://github.com/MattConrad/Quill/issues/14
Describe the bug I'm not really sure if this is an inkgd or a ink-issue in general, but when there's a switch statement such as this:
The switch will only choose the 'else' divert if the
some_variable
is equal to zero, otherwise it just gets stuck. This is unexpected behavior as I would expect that theelse
-clause serves as a "catch-all" sort of thing in a switch statement. In other words: 'If nothing applies, choose the else divert'To Reproduce I made a repository that replicates the issue here. In that Godot project you have a player (controlled with the ARROW keys) that can talk to either a red or a green NPC. You talk to them by overlapping with them and pressing the SPACEBAR or ENTER key.
Their dialogue will appear in the console and talking to the green NPC works flawlessly!
But when talking to the red NPC, all dialogues will be empty after that.... and the switch statement never diverts...
Like you can see in the image above, the dialogue with the red NPC appears and then.... nothing... Even when talking to the green NPC, you just get an empty line back from the story.
Expected behavior I would expect the 'else' clause to serve as a way to capture everything that isn't matched by any of the other clauses. And ,as is the case here, there are no other clauses so the 'else' clause should always be chosen.
Ink files Here's the ink-file I used for both red and green NPCs:
Environment: