Fix mvmz script
This commit is contained in:
parent
565dce7942
commit
d9e1645726
2 changed files with 16 additions and 11 deletions
|
|
@ -54,7 +54,7 @@ CODE324 = False
|
|||
CODE111 = False
|
||||
CODE408 = False
|
||||
CODE108 = False
|
||||
NAMES = False # Output a list of all the character names found
|
||||
NAMES = True # Output a list of all the character names found
|
||||
BRFLAG = False # If the game uses <br> instead
|
||||
FIXTEXTWRAP = True # Adjust wordwrap of text (IGNORETLTEXT must be False)
|
||||
IGNORETLTEXT = True # Leave this False if you need to adjust the wordwrap
|
||||
|
|
@ -605,11 +605,11 @@ def searchCodes(page, pbar):
|
|||
# Remove nametag from final string
|
||||
finalJAString = finalJAString.replace(nametag, '')
|
||||
elif '【' in finalJAString:
|
||||
matchList = re.findall(r'(.+?【(.+?)】.+?)(「.+)', finalJAString)
|
||||
matchList = re.findall(r'(.+?【(.+?)】.+?\])(.+)', finalJAString)
|
||||
if len(matchList) != 0:
|
||||
response = translateGPT(matchList[0][1], 'Reply with only the english translation of the NPC name', True)
|
||||
else:
|
||||
print('wtf')
|
||||
print('Regex Failed')
|
||||
tokens += response[1]
|
||||
speaker = response[0].strip('.')
|
||||
|
||||
|
|
@ -632,6 +632,11 @@ def searchCodes(page, pbar):
|
|||
codeList[j]['p'][0] = nametag + finalJAString
|
||||
codeList[j]['c'] = code
|
||||
|
||||
# Add Name
|
||||
if speaker not in NAMESLIST:
|
||||
with LOCK:
|
||||
NAMESLIST.append(speaker)
|
||||
|
||||
# Remove any textwrap
|
||||
if FIXTEXTWRAP == True:
|
||||
finalJAString = re.sub(r'\n', ' ', finalJAString)
|
||||
|
|
@ -1390,7 +1395,7 @@ def translateGPT(t, history, fullPromptFlag):
|
|||
return(t, 0)
|
||||
|
||||
"""Translate text using GPT"""
|
||||
context = 'Eroge Character Names Context: アサギ == Asagi | Female, ウィップ == Whip | Female, ウラ == Ura | Female, ブレイド == Blade | Female'
|
||||
context = 'Eroge Names Context: Name: ゆう == Yuu\nGender: Male,\nName: エミル == Emiru\nGender: Female,\nName: ハルカ == Haruka\nGender: Female,\nName: マリア == Maria\nGender: Female,\nName: ナギサ == Nagisa\nGender: Female,\nName: レア == Rhea\nGender: Female\n Name: リサ == Risa\nGender: Female'
|
||||
if fullPromptFlag:
|
||||
system = PROMPT
|
||||
user = 'Line to Translate: ' + subbedT
|
||||
|
|
|
|||
|
|
@ -612,19 +612,19 @@ def searchCodes(page, pbar):
|
|||
finalJAString = finalJAString.replace(matchList[0][0], '')
|
||||
|
||||
# Set next item as dialogue
|
||||
if (codeList[j + 1]['c'] == 401 and len(codeList[j + 1]['p']) > 0) or codeList[j + 1]['c'] == 0:
|
||||
if (codeList[j + 1]['code'] == 401 and len(codeList[j + 1]['parameters']) > 0) or codeList[j + 1]['code'] == 0:
|
||||
# Set name var to top of list
|
||||
codeList[j]['p'][0] = nametag
|
||||
codeList[j]['c'] = code
|
||||
codeList[j]['parameters'][0] = nametag
|
||||
codeList[j]['code'] = code
|
||||
|
||||
j += 1
|
||||
codeList[j]['p'][0] = finalJAString
|
||||
codeList[j]['c'] = code
|
||||
codeList[j]['parameters'][0] = finalJAString
|
||||
codeList[j]['code'] = code
|
||||
nametag = ''
|
||||
else:
|
||||
# Set nametag in string
|
||||
codeList[j]['p'][0] = nametag + finalJAString
|
||||
codeList[j]['c'] = code
|
||||
codeList[j]['parameters'][0] = nametag + finalJAString
|
||||
codeList[j]['code'] = code
|
||||
|
||||
# Remove any textwrap
|
||||
if FIXTEXTWRAP == True:
|
||||
|
|
|
|||
Loading…
Reference in a new issue