ephread / inkgd

Implementation of inkle's Ink in pure GDScript for Godot, with editor support.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

External function is called twice after divert

you-win opened this issue · comments

Describe the bug
After diverting from a knot and calling an external function from the new knot

To Reproduce
Example included below. When diverting to quest_completed from from_quest_accepted_0, the function end_quest(quest_name) is called twice.

= from_quest_accepted_0
~ current_speaker = "LEFT"
"..."

* {check_quest(quest_name)} "Yes" []
-> quest_completed
* {not check_quest(quest_name)}  "Yes" (lie) []
-> quest_completed_lie
* "Not yet" [] -> from_quest_accepted_1

=== quest_completed
~ current_speaker = "RIGHT"
{end_quest(quest_name)}
"Well ain't that something. I guess there are still good people out there."

* [next] -> dialogue_end

Expected behavior
When diverting to a new knot, the end_quest function should only be called once.

The problem is fixed if the choice is structured like so:

* {check_quest(quest_name)} ["Yes"]
-> quest_completed

Note that the "Yes" has been moved inside the brackets.

It can also be fixed by removing the newline like so:

* {check_quest(quest_name)} ["Yes"] -> quest_completed

However, following this pattern for other diverts breaks the formatting since the newline is no longer present.

* "Yes" [] -> start_scenario

This causes "Yes" to be displayed on the same line as the divert.

Ink files
Available upon request

Environment:

  • OS: Windows 10
  • Godot version: 3.2.3 vanilla
  • Inklecate version: 1.7.2
  • inkgd version: 0.2.1

Additional context

So according to this piece of documentation, this is known behavior. Closing the issue.