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

Generalization #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Jaykingamez
Copy link

The code seems to be geared towards one specific use case, so I spent some time generalizing the code so it could be used across many Visual Novels.

In the example below, the code will only run if the character's name is a single character. But if the character is for example Twilight Sparkle, and I used "ts" to represent her, the code will fail.

if char[0] == character[0]:
                current_character = character[1]
                previous_character = current_character
                break

I've also replaced usage of os.system with subprocess as os.system has been deprecated.

Also, I have replaced the below-hardcoded number with a variable dependent on the number of rows in the dialogue.tab

print(str(i) + '/' + str(3252))

Lastly, I have replaced all line[0], line[1], line[2] references with a single variable to speed up processing as you have admitted, it will take a long time since the code makes one API call per row

id = line[0]
speaker = line[1]
dialogue = line[2]

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

Successfully merging this pull request may close these issues.

1 participant