From d9e16457265e128c3296e81fcfa52e0bb62be475 Mon Sep 17 00:00:00 2001 From: Dazed Date: Wed, 4 Oct 2023 23:43:33 -0500 Subject: [PATCH] Fix mvmz script --- modules/rpgmakerace.py | 13 +++++++++---- modules/rpgmakermvmz.py | 14 +++++++------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/modules/rpgmakerace.py b/modules/rpgmakerace.py index 724ba57..e3d8ff0 100644 --- a/modules/rpgmakerace.py +++ b/modules/rpgmakerace.py @@ -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
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 diff --git a/modules/rpgmakermvmz.py b/modules/rpgmakermvmz.py index 5b15a79..b2ee7d3 100644 --- a/modules/rpgmakermvmz.py +++ b/modules/rpgmakermvmz.py @@ -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: