Skip to content

Combined lists and functions don't work as intended #12

@2shady4u

Description

@2shady4u

Describe the bug
Passing list elements to a switch function should result in this list element being matched. This is not the case... the function doesn't recognize the element and simply chooses the "else" path.

To Reproduce

  • Make a new Godot project
  • Download and activate the inkgd plugin from the Asset Store
  • Download the examples-folder from the Github repository
  • Take the minimum ink-file I supplied below and copy-paste it into the "Interceptor.ink" and rebuild the JSON using inklecate
  • Change the "bind_externals" function (found in ink_runner.gd) to:
func _bind_externals():
    story.observe_variables(["currentActor"], self, "_observe_variables")
    #story.bind_external_function("should_show_debug_menu", self, "_should_show_debug_menu")
  • Run the ink_runner.tscn and see what happens.

OUTPUT in log:

Variable 'currentActor' changed to: Bobby
Variable 'currentActor' changed to: Bobby
Variable 'currentActor' changed to: Bobby

OUTPUT in game:

Hey, my name is Bobby. What about yours? 
I am Bobby and I need my rheumatism pills!
Would you like me, Bobby, to get some more for you?

This is the wrong behavior...

Expected behavior
Go to Quill (http://jeejah.xyz/quill/) or download Inky, copy-paste the Ink content (see below) and press play. This gives following story (which is correct):

Hey, my name is Philippe. What about yours?

I am Andre and I need my rheumatism pills!

Would you like me, Philippe, to get some more for you?

(story complete)

Ink files
Here's a minimum version of the *.ink-script that I'm using:

VAR currentActor = "Bobby"

LIST listOfActors = P, A, S, C
VAR s = -> set_actor
-> start

===function set_actor(x)
{ x:
- P: ~ currentActor = "Philippe"
- A: ~ currentActor = "Andre"
- else: ~ currentActor = "Bobby"
}

=== start ===
{s(P)} Hey, my name is {currentActor}. What about yours? 
{s(A)} I am {currentActor} and I need my rheumatism pills!
{s(P)} Would you like me, {currentActor}, to get some more for you?
-> END

Environment:

  • OS: Windows
  • Inklecate version: 0.9.0
  • inkgd version: 0.1.3

Additional context
A current work-around is to not use LISTs and just use string (meaning: {s("P")} instead of {s(P)}), but I would very much like not to write the double quotes at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions