ROM Hack [Question] How do i edit .lua files?

  • Thread starter Thread starter Monozombi
  • Start date Start date
  • Views Views 8,430
  • Replies Replies 8

Monozombi

New Member
Newbie
Joined
Nov 16, 2015
Messages
4
Reaction score
0
Trophies
0
Age
41
XP
74
Country
Argentina
Hi, i'm trying to translate a game. I already decrypted the .3ds and have all the extracted files, but i don't know how to edit the text, as it's in .lua format (The .lua is the text, right?)
 
You are in luck. LUA is a script used in the game.
You may edit them with a text editor.


Also, what is the game? So we know where you get started?

Thanks, then i'll try using something like notepad++ . The game is Zero Escape: Virtue's Last Reward, i want to translate it to spanish.
 
lua is a programming language, I have seen it in a few DS games over the years and it makes sense that the 3ds would also support it.
http://www.lua.org/docs.html has more. It is used in emulators aimed at speedrunning as well as being available in desmume and fceux and is not a bad programming language either, probably a bit less lucrative than python or ruby if you want a scripting language but as a general use thing is by no means bad.

It tended to come in three main forms

1) Some kind of binary shorthand, think java bytecode for a similar concept and possibly javascript minimisation. Puzzle Quest on the DS for this one.
2) Some kind of standard compression and embedded archive formats. Handle like you would handle compression or archive formats normally. ( El Tigre- make my mule on the DS being an example of this if memory serves)
3) Just plain text. Edit like you would other text files on a PC really. Do make sure you have the same new line, encodings and whatever else. (Some rhythm game or possibly Theta)

I dare say there might have been a 4th where the lua was used in the game but left in as a kind of developer extra but I will have to confirm that. In that case you would likely have some kind of thing like 1) on your hands anyway -- lua tends not to compile from what I have seen and will have to come with some kind of interpreter.
 
  • Like
Reactions: Monozombi
I thought it was funny that the devs used LUA scripts for VLR.
I wonder if the devs did this purposefully or if this was a coincidence.
If you played the game then you know what I mean.

Anyway, there was a similar project that was (or had done) a similar translation project from English to Italian for VLR. Source below:

https://gbatemp.net/threads/wip-3ds...ist-and-discussion.380171/page-4#post-6034758

Even though I have looked through VLR's files (models, textures and what not), I am not sure how easy it would be to edit text inside of a LUA file. It would be easy if the file size stays the same and you only overwrite text with the equivalent Spanish. It may start to get more dicey if you change the file size. I say pursue the source I gave you.

Good Luck!
 
  • Like
Reactions: Monozombi
I thought it was funny that the devs used LUA scripts for VLR.
I wonder if the devs did this purposefully or if this was a coincidence.
If you played the game then you know what I mean.

Anyway, there was a similar project that was (or had done) a similar translation project from English to Italian for VLR. Source below:

https://gbatemp.net/threads/wip-3ds...ist-and-discussion.380171/page-4#post-6034758

Even though I have looked through VLR's files (models, textures and what not), I am not sure how easy it would be to edit text inside of a LUA file. It would be easy if the file size stays the same and you only overwrite text with the equivalent Spanish. It may start to get more dicey if you change the file size. I say pursue the source I gave you.

Good Luck!
I found the lua file with the text of the beginning of the game. I used Hxd to edit it and keep the same file size, but when I put it on my 3ds and launch it, after I click "start from beginning" , the upper screen stays black and the below one shows the VN menu (with the "auto" button and stuff).
Any idea of what caused it and how to fix it?
 
It depends on what you actually edited.

There isn't exactly a fool proof way to edit a file format. Look at what you edited and compare it to the original. Look at the file structure the text is in. Some of this is just going to come down to good old fashioned trial and error and experimentation.

That's why I recommended the source above. Somebody has already figured out the text file format. Ask them. Don't reinvent the wheel if you don't have to unless you enjoy reverse engineering. In that case, go all out.
 
It depends on what you actually edited.

There isn't exactly a fool proof way to edit a file format. Look at what you edited and compare it to the original. Look at the file structure the text is in. Some of this is just going to come down to good old fashioned trial and error and experimentation.

That's why I recommended the source above. Somebody has already figured out the text file format. Ask them. Don't reinvent the wheel if you don't have to unless you enjoy reverse engineering. In that case, go all out.
Okay, i'll try asking them then. Thanks for the help
 

Site & Scene News

Popular threads in this forum