Skip to content
This repository was archived by the owner on Dec 12, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant