Hime-Works / Requests

Bug reports and requests that may require longer discussions and is not suitable to leave on the blog
http://himeworks.com/
GNU General Public License v2.0
7 stars 9 forks source link

Text extractor #43

Open chaos17 opened 10 years ago

chaos17 commented 10 years ago

Hi,

I would like to know if it would be possible to have a text extractor ? Because one day I would like to translate my game and that will help me that a script will extract all my dialogs into a ".txt".

HimeWorks commented 10 years ago

A text extractor can be written, but that depends on what you actually want to extract. Only map events/common events/troop events? Database? Text inside scripts? (eg: vocab)

chaos17 commented 10 years ago

That's a good question Is it possible to extract all of these in seperate text files ? o.o If yes, that would be great. If no, then for me only map events would be enough since all I want is to translate my dialogs.

HimeWorks commented 10 years ago

What are you going to do with those text files after you translate them?

chaos17 commented 10 years ago

I would have to copy paste the translation manually... XD Of course thout would be great if the extractor could recompile the translated text into the translated project (like a patch maker?) but I fear that would be too much to ask.

HimeWorks commented 10 years ago

Well there are some problems you need to think about Here's one possible way to do it.

Let's say Event 1 on Map 1 had two commands

Show Text: "hello"
Show Text: "goodbye"

When you extract this text, I would store it in a way that allows you to remember that "hello" is the first command of event 1 on map 1. But what happens when you then change your event to

Show Text: "edited"
Show Text: "hello"
Show Text: "goodbye"

Suddenly, all your translations are wrong because they refer to something else now. If you can guarantee that NONE of your events change, then that solution might work.

HimeWorks commented 10 years ago

Another solution is to extract your text and REPLACE your project's text with some special codes. For example, given the two commands up there

Show Text: "hello"
Show Text: "goodbye"

I replace it with

Show Text: 3218
Show Text: 3219

And then in the extracted text file, you see something like

3218: "hello"
3219: "goodbye"

This means that even if you changed your event, like you added something like

Show Text: "edited"
Show Text: 3218
Show Text: 3219

It would still be fine. And then you can run the extraction tool again to extract that new text. Finally, you can actually re-insert these text by using another script to replace all of the text, or use a script to dynamically figure out what lines to use depending on which language you're currently running.

This is my preferred solution, however this means that you need to always go to your external text files to edit text that use this special replacement.

chaos17 commented 10 years ago

That's difficult to know if your solution will be simple or not to use without trying it. Though, I was thinking of something simple like your map shot script with an option to back up the old text as an option.

I'm okay with trying your idea :)

HimeWorks commented 10 years ago

You need to REALLY think about what happens if you add new events or change existing events, because if you use a text import/export tool that assumes your events never change, you are going to run into problems when you actually do need to change an event.

Which is why I replace the event text with references. It makes your project look really ugly, but at least you can easily manage multiple languages.

Roguedeus commented 10 years ago

Professionally, string references are how its done most of the time. aka: resref (resource reference)

HimeWorks commented 10 years ago

There's this script

http://forums.rpgmakerweb.com/index.php?/topic/6608-external-text-now-v21-unicode-fix/

But it sort of requires you to have planned it out beforehand. I guess I could extract text and replace them with the appropriate key references. I don't know about the keys themselves though...random numbers? Combination of event ID, map ID, and some arbitrary number for uniqueness? (makes it easier to search at least)

So like you might say

[00100011]
Text: something

[00100031]
Text: something else

Where the key is generated using

3-digit map ID 4-digit event ID Some random number that's incremented.

chaos17 commented 10 years ago

Ok, since my english isn't really good, I would like to confirm, this : when I will open my text file under windows will I read this ?

Show Text: "hello" Show Text: "goodbye"

HimeWorks commented 10 years ago

It would probably something like

3221678: hello
3217899: goodbyte

Or maybe

[event 1 map 1 line 3]
hello

[event 1 map 5 line 24]
goodbye

I haven't decided which one I will go with. Have you considered using SES External Text? Then you can just do it yourself.

chaos17 commented 10 years ago

I'm not plaing at the moment to use SES.

I like : [event 1 map 1 line 3] hello

HimeWorks commented 10 years ago

You should check whether it is compatible, because I might just write the extractor based on that format.

chaos17 commented 10 years ago

Tested SES script in my project and I got a error message. What script did make again to check compatibilty issue ?

HimeWorks commented 10 years ago

I don't know of a script that would help check for compatibility issues. Did you install the required SES core script?

chaos17 commented 10 years ago

Hi,

I downloaded this one : http://pastebin.com/rcZtG8Ai Do I need to download this one too (?) : http://pastebin.com/rcZtG8Ai

"I don't know of a script that would help check for compatibility issues." I was talking about your : Custom Main – Full Error Backtrace Great script by the way, here's what the console showed me when the error happened: http://uppix.net/Ypbxz6.gif I don't know what it's saying, can you tell me ?

HimeWorks commented 10 years ago

I don't know either, since it's specific to the script. Maybe the way you have set up your text file is not right. You can create a new project with just that script with the same setup and see if it works or not, and upload it.