Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault on Tags #3

Open
cheshiren opened this issue May 5, 2024 · 0 comments
Open

Segmentation fault on Tags #3

cheshiren opened this issue May 5, 2024 · 0 comments

Comments

@cheshiren
Copy link

cheshiren commented May 5, 2024

Not sure what am I doing wrong, but whenever I try to get the tags from the story, I catch the Segmentation Fault error.
For example, if I have this ink-file:

Test #TEST
* Option 1
    OK #OK
    ** Option 2
        -> END

…and the quick example from your description with a couple of changes and the tags reference:

from bink.story import Story, story_from_file

# Story is the entry point of the Blade Ink lib.
story = story_from_file("inkfiles/test.ink.json")
# self.assertTrue(story.can_continue())                         # CHANGE wouldn't launch with it

end = False

while not end:
    while story.can_continue():
        line = story.cont()
        print(line)
    tags = story.tags                                           # THE PROBLEM

    # Obtain and print choices
    choices = story.get_current_choices()

    print(f"Num. choices: {len(choices)}\n")

    if choices:
        for i, text in enumerate(choices):
            print(f"{i + 1}. {text}")

        # read_input() is a method that you should implement
        # to get the choice selected by the user.
        choice_idx = input()                                    # CHANGE standard input routine
        # set the option selected by the user
        story.choose_choice_index(int(choice_idx)-1)            # CHANGE keyboard input handling
    else:
        end = True

print("Story ended ok.")

…then I get this terminal output:

Test

Num. choices: 1

1. Option 1
1
Option 1

OK

zsh: segmentation fault  /opt/homebrew/bin/python3 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant