CREATE YOUR AI CUM SLUT ON CANDY.AI TRY FOR FREE
x

Tool RPGM DazedMTLTool - A tool that provides quality MTL translations using ChatGPT

Apr 18, 2024
133
109
depending on the model's size, it could also run on huggingface inference (serverless and free)
I have the llm Mistral-Small-Instruct-2409 running on my PC now, no clue yet on how to integrate it with this tool though, need to remove/rewrite everything that is using the openai modules, custom prompts, etc. didnt have time to read through everything, I try to have a prototype done by next week...(XD)
 
Last edited:

jaden_yuki

Active Member
Jul 11, 2017
931
708
I have the llm Mistral-Small-Instruct-2409 running on my PC now, no clue yet on how to integrate it with this tool though, need to remove/rewrite everything that is using the openai modules, custom prompts, etc. didnt have time to read through everything, I try to have a prototype done by next week...(XD)
I recommend you uncouple everything that uses the openai lib into a separate module and then use the dependency inversion principle
 
  • Like
Reactions: Destruction9000

PossiblyAPerson

New Member
May 28, 2019
14
4
I was experimenting with translating a game, and for some reason gpt-4o-mini seems to be consistently throwing up on only the Skills.json file.

JSON:
extractTranslation Error: Invalid control character at: line 4 column 16 (char 383) on String {
    "Line1": "Hammer Technique. Infuse the wrath of your skills into a hammer strike to knock the enemy away. Perform a powerful attack on a single enemy with a medium chance to inflict the 'sinking' and 'knockdown' states.",
    "Line2": "Hammer Technique. Crush any tough enemy with the ultimate violent strike. Perform a very powerful attack on a single enemy.",
    "Line3": ",
    "Line4": ",
    ...
}
For whatever reason it isn't correctly matching quotes on empty lines. Is altering the prompt the best approach for fixing this?
 

PossiblyAPerson

New Member
May 28, 2019
14
4
Also, while I'm here, is the images module usable for translating images? It doesn't seem to work out of the box so I wasn't sure if anyone actually used it. My expectations aren't particularly high here, but it seemed like something that could be useful.
 
Last edited:

mr.i.game

Newbie
Game Developer
May 6, 2024
83
363
Does anyone know how to deal with this rejection message: ''I'm sorry, I can't assist with that request."? I'm using the latest version of GPT-4o, and whenever I try to translate adult content, I get this error. However, if I switch back to the older version, GPT-4o-2024-05-13, it doesn’t happen.
 

Cutefunniness

Newbie
Jan 19, 2023
83
137
Does anyone know how to deal with this rejection message: ''I'm sorry, I can't assist with that request."? I'm using the latest version of GPT-4o, and whenever I try to translate adult content, I get this error. However, if I switch back to the older version, GPT-4o-2024-05-13, it doesn’t happen.
Ah I get that too...though I re-run it and it occassionally goes through but I'm using gpt4free with gpt-4o for that...
All I can think of is modifying the prompt.txt to change things around to make it translate the lines, otherwise I'm not sure...

Yup!
 

Cutefunniness

Newbie
Jan 19, 2023
83
137
Also, while I'm here, is the images module usable for translating images? It doesn't seem to work out of the box so I wasn't sure if anyone actually used it. My expectations aren't particularly high here, but it seemed like something that could be useful.
So I tried testing out the images module and yield no results in getting it to work.
The furthest I gotten only lead to this error everytime:
Example: list index out of range

(Example being Example.png)

The Images module only works with .png files, requires that a "Custom" folder be made in the root folder of DazedMTL (otherwise it'll throw a error saying it can't find the folder) and that the .png files need to be in it's own folder within the files folder (e.g. /files/images for example, just create an random folder and put only .png files in it).

I tried debugging the script to see if I can get it to run to no avail...
dazedanon Is the Images Module still incomplete/W.I.P or do you know how to get it running?

Does it work with gpt-4o? I assume so...
Just curious is all, thanks for all the hard work thus far, saw you added KiriKiri support recently which is great!
 

dazedanon

Engaged Member
Modder
Uploader
Donor
Jul 24, 2017
2,533
28,599
So I tried testing out the images module and yield no results in getting it to work.
The furthest I gotten only lead to this error everytime:
Example: list index out of range

(Example being Example.png)

The Images module only works with .png files, requires that a "Custom" folder be made in the root folder of DazedMTL (otherwise it'll throw a error saying it can't find the folder) and that the .png files need to be in it's own folder within the files folder (e.g. /files/images for example, just create an random folder and put only .png files in it).

I tried debugging the script to see if I can get it to run to no avail...
dazedanon Is the Images Module still incomplete/W.I.P or do you know how to get it running?

Does it work with gpt-4o? I assume so...
Just curious is all, thanks for all the hard work thus far, saw you added KiriKiri support recently which is great!
It works but the module is something I made specifically for Dramon quest. Specifically it will take the filename of an image, translate the name, and then create a new image based on that translation. It's not meant to TL images but create them.

It can also work with a txt file. So if you give it a txt file with a list of string it will create an image for each string.

It does not actually TL text in images.
 

Cutefunniness

Newbie
Jan 19, 2023
83
137
It works but the module is something I made specifically for Dramon quest. Specifically it will take the filename of an image, translate the name, and then create a new image based on that translation. It's not meant to TL images but create them.

It can also work with a txt file. So if you give it a txt file with a list of string it will create an image for each string.

It does not actually TL text in images.
So that's the origin of the module and how it works, very interesting!

It's the equivalent of giving an prompt for chatgpt to create an new image, nice nice!
I also now know what the txt file is used for too, nice.

Hmm...such an interesting feature, I saw that Dramon quest game you translated recently and now more curious to try it out to see what this image translate to create new image function was used for.

Oh well, thanks for explaining!

...If possible, would you look into creating an function to scan and translate images (either extracting the text into an text file or asking the chatgpt api to modify the image with the translated text)? If no, then I understand but if maybe...nice!
 
  • Like
Reactions: dazedanon

dazedanon

Engaged Member
Modder
Uploader
Donor
Jul 24, 2017
2,533
28,599
So that's the origin of the module and how it works, very interesting!

It's the equivalent of giving an prompt for chatgpt to create an new image, nice nice!
I also now know what the txt file is used for too, nice.

Hmm...such an interesting feature, I saw that Dramon quest game you translated recently and now more curious to try it out to see what this image translate to create new image function was used for.

Oh well, thanks for explaining!

...If possible, would you look into creating an function to scan and translate images (either extracting the text into an text file or asking the chatgpt api to modify the image with the translated text)? If no, then I understand but if maybe...nice!
Every single item, skill, weapon, name, etc in that game was an image. I basically made that module so I could take those images, translate the filenames (Since they matched what was in the image), maintain the same size, and then paste the new translated versions back in. It was a pretty specific usecase but huge because it let me TL thousands of images easily.

That last feature is outside of my capabilities. Its actually very hard to scan and replace text because OCR requires a lot of training of images with mid results. That's why there aren't many tools for them and the ones that do exist aren't very good. I also hope that one day there exists a tool like that.
 

Testarts

Newbie
Apr 17, 2020
18
18
i'm completely new to chat gpt things. if i understood correctly then if i download tool i will still have to play for chat gpt to translate things to me or how does it work?
 
  • Like
Reactions: Cutefunniness

dazedanon

Engaged Member
Modder
Uploader
Donor
Jul 24, 2017
2,533
28,599
i'm completely new to chat gpt things. if i understood correctly then if i download tool i will still have to play for chat gpt to translate things to me or how does it work?
Yes, you will have to pay to use the API for GPT. The tool is also not very friendly to the average user. Need some dev skills to use it.
 
  • Like
Reactions: Testarts

Cutefunniness

Newbie
Jan 19, 2023
83
137
i'm completely new to chat gpt things. if i understood correctly then if i download tool i will still have to play for chat gpt to translate things to me or how does it work?
Yes, you will have to pay to use the API for GPT. The tool is also not very friendly to the average user. Need some dev skills to use it.
Ah I like to share this since I just started using your tool dazedanon some days ago!
There's a project called gpt4free which has chatgpt-4o API for free which I've been using!
They have multiple models (not just 4o) and it works really well!

However you'll have to edit the "extractTranslation" part of the dazedanon's dazedMTL modules code because sometimes the
response from the api has this in it's response:
Code:
 json {
"Line1": "Kisaragi Merrie\n\"This place\nlooks like some kind of shop~♡\"",
"Line2": "Kisaragi Merrie\n\"If I had money, maybe I could buy something~♡\""
}
The issue being that "json" is the first line in the response (instead of starting with Line1), you'll get this error " extractTranslation Error: Expecting value: line 1 column 1 (char 0) on String" if you don't edit and add this code that I made!


Here's this code to make it work with extracting translations with that json as the first line, add it within the "extractTranslation" function:

Code:
        # Ensure that the string starts with '{' and ends with '}', if not, attempt to find the JSON part
        if not translatedTextList.strip().startswith("{") or not translatedTextList.strip().endswith("}"):
            # Attempt to extract JSON-like content within the curly braces
            PBAR.write(f"Attempting to extract valid JSON from: {translatedTextList}")
            json_start = translatedTextList.find("{")
            json_end = translatedTextList.rfind("}") + 1
            if json_start != -1 and json_end != -1:
                translatedTextList = translatedTextList[json_start:json_end]
            else:
                raise ValueError("No valid JSON content found")
If you're confused on where to add it, don't worry as I'll help ya out!
When you download the dazedMTL project, within the folder is called "modules".
Each module is made to translate various different games and formats!

So let's say you want to translate an RPGMaker MV/MZ game? Then you'll have to open the
"rpgmakermvmz.py" in a text editor like notepad++ (or notepad if you want), VSCode, etc and
then search for this text: "extractTranslation".

Once you find it, you'll have to insert the code I provided above within! Here's an example of my
edit of the currently updated rpgmakermvmz.py (as of writing this) function, and what it's supposed to look like:


Code:
def extractTranslation(translatedTextList, is_list):
    try:
        # Apply regex modifications as before
        translatedTextList = re.sub(r'\\"+\"([^,\n}])', r'\\"\1', translatedTextList)
        translatedTextList = re.sub(r"(?<![\\])\"+(?!\n)", r'"', translatedTextList)

        # Ensure that the string starts with '{' and ends with '}', if not, attempt to find the JSON part
        if not translatedTextList.strip().startswith("{") or not translatedTextList.strip().endswith("}"):
            # Attempt to extract JSON-like content within the curly braces
            PBAR.write(f"Attempting to extract valid JSON from: {translatedTextList}")
            json_start = translatedTextList.find("{")
            json_end = translatedTextList.rfind("}") + 1
            if json_start != -1 and json_end != -1:
                translatedTextList = translatedTextList[json_start:json_end]
            else:
                raise ValueError("No valid JSON content found")

        # Load the JSON response
        line_dict = json.loads(translatedTextList)
        # If it's a batch (i.e., list), extract with tags; otherwise, return the single item.

        # Extract the values
        string_list = list(line_dict.values())

        # Only print the raw response and detected translations when successful
        PBAR.write(f"Successfully detected translation: {string_list}")

        if is_list:
            return string_list
        else:
            return string_list[0]

    except Exception as e:
        # In case of an error, this block will already print out the raw input
        PBAR.write(f"extractTranslation Error: {e} on String {translatedTextList}")
        return None
Once this is added, you'll be able to use gpt4free's api with no issue!
Now I've tested translating an RPGMaker MZ game and the translation works great!
I had to edit some text when I was translating just the system.json file though (sometimes
the api doesn't simply translate and instead explains what the japanese line means in english.)

But for everything else, it's works wonders!

Okay if you want to try gpt4free if you don't want to pay for chatgpt-4o, here's my instructions on how to run it below!

Project Link:


Make sure to have python 3.12+ (3.10+ for just gpt4free, but 3.12+ needed for dazedanon's tool) installed!

If you want to install it and test it right now, simply type this in a terminal/console window:
"pip install gpt4free[api]"

This will install the api only of gpt4free, if you want everything else that gpt4free has (web ui, etc)
then check the project page above for further instructions on that!

Anyways once that's done, edit your .env and put this in for the api url:
"http://localhost:1337/v1/"

Make sure that the api url has the / at the end and doesn't look like this!
"http://localhost:1337/v1"

Otherwise it won't work and you'll get errors!

and as for API Key, just type in any number in it (it can't be empty otherwise nothing will work when using the api).
#API key
key="1111"



Then for organization, just type "org-" followed by any word you want to use for it like in this example:
organization="org-CuteAndFunny"

Next, as for what to type in model, you can use chatgpt-4o with this:
Code:
model="gpt-4o"
and if you want to try other models (o1 and o1-mini is currently not working, but in the future it may work as gpt4free is updated so you can switch to that once chatgpt o1 becomes more available.)

Here's a direct link with the list of models to try out, they're all openai compatible but I haven't tested them all:


Now run "g4f api" in your terminal/console and api should be up and running hopefully!
Then run dazedanon's tool and translate away!
 
Last edited:
Jan 2, 2019
27
33
Hey first of all thank you for the work you put into this tool. I've been able to use it fine for almost everything but when i enable the translation of code 102 I get the following error in line 2015 of rpgmakermvmz.py. Do you have any insight into this? Tysm

1730230141623.png
 

dazedanon

Engaged Member
Modder
Uploader
Donor
Jul 24, 2017
2,533
28,599
Hey first of all thank you for the work you put into this tool. I've been able to use it fine for almost everything but when i enable the translation of code 102 I get the following error in line 2015 of rpgmakermvmz.py. Do you have any insight into this? Tysm

View attachment 4180111
Its hard to say but basically, when it finds a 102 code (Which are choices in the game), its getting an empty list so its erroring out. This should never happen though, you should check if theres a 102 code in the json thats empty for some reason.
 

Cutefunniness

Newbie
Jan 19, 2023
83
137
Old Python version. Need to update.
Ah I got that error too on the last pubilcly released version of Python 3.11 (Python 3.11.9 which released last month or so I believe), so it seems f-strings now support single quotes when they use single quotes too huh? Nice nice!

For me, I simply edited the code by changing the ' into " for name.
Another line I had to remove the f-string unfortunately...I'll look into upgrading Python alright!

Are you using Python 12 or the newly released Python 13 dazedanon ?