[RM2K3] IS THERE A 3RD PARTY APPLICATION THAT WILL SCAN CODE AND REPLACE STRING VALUES EN MASSE?

Posts

Pages: first 12 next last
context for what follows: If you're using Cherry's RPG Maker 2009 addon, you're able to put subfolders into the various RTP folders.

If you move a resource like a picture that's currently being used in your game from one folder to another — or if you rename it — then the game will crash when it tries to load that picture because it doesn't know that you've moved it unless you go through and manually adjust every instance of that resource throughout all of your code. This can be exceedingly tedious if the resource in question is one which is made use of many, many times throughout a project or if you feel a need to do this with many, many different resources.

Is there a program that can scan through all of a project's code to change every occurrence of one filename string to another, CTRL+H style? Like, for example, if I have a resource called "HP Bar 1" in the root directory of the "Pictures\" folder, but then I move it to a subfolder like "Pictures\Status Window\", then I would be able to tell this hypothetical program to scan through all of my code and look for any strings that read as "Pictures\HP Bar 1" and change them all to "Pictures\Status Window\HP bar 1".

Does something like this exist?
(ignore, didn't see the 2k3 tag at the time)
Hmm... Well, I suppose that that's worth a try. I wouldn't have thought that such programs could open the relevant files, but I'll give it a shot. I'll report back soon-ish on how it goes (in the mean time, if anyone else knows of anything that's explicitly designed for this purpose that's specific to RM2K3, I'm still all ears).
No, do *not* use an editor like Notepad++/VSCode! This will corrupt your game. The data is not in a text format!

(I'm not sure if there is such a tool specifically for RM2k(3) yet, but it would nowadays be possible to write one using EasyRPG's liblcf library)
Well... I'm glad, then, that I never got around to it. xD Thanks, Cherry.
Building this tool for you would be a good programming exercise for me. Could you provide the following:
* a file before the change you want to apply
* the file after you've done the change manually
* describe the change you made (like: "Pictures\HP Bar 1" becomes "Pictures\Status Window\HP bar 1")
* which files you want the change to be applied to (like: All ".h3m" and ".wad" files in the current directory and sub-directories)
Sure, but you'll have to specify what you mean. This request, as phrased, is a little ambiguous. What do you mean by "a/the file"? Do you mean, like... the database file? Or do you mean the picture file that's being relocated? If you mean the latter, then it's going to be the same file before and after the change, it'll just have a different directory. In regards to your last bullet point there, 100% of the affected files will be .png files. I've got nearly 9,000 pictures in my pictures directory, and I will want to relocate several hundred of them into subfolders if possible. With the sheer multiplicity of files that I would like to rearrange, you can see why I would be loathe to redo all the picture display commands that point to those pictures in my code. I have about 1,600 common events, and many thousands of picture displays. The logistics of redoing all of those manually, one at a time, is simply staggering. So that's where I'm at. But, yeah, specify what exactly you mean in bullet points one and two, and I'll be happy to oblige.
Let's start with an example:

Initially, your game folder has a sub-folder "ChipSet" containing images Dungeon_01.png, Dungeon_02.png, Dungeon_03.png and many other non-dungeon images.
You create a sub-folder "Dungeon" in the "ChipSet" folder and move the images Dungeon_01.png, Dungeon_02.png and Dungeon_03.png to this new "Dungeon" sub-folder.
You open RPG Maker and manually change the image locations in your project and save your changes. This save will probably modify a database file (and maybe some map files). I need a copy of the database file before you save and another copy after you've saved (and, if the map files get changed, I need the maps before and after).

So I need:
1) database file (and maybe map files) before the change
2) database file (and maybe map files) after the change
3) You describe the change you've made:
Images Dungeon_01.png, Dungeon_02.png, Dungeon_03.png initially in "\GameFolder\ChipSet" moved to "\GameFolder\ChipSet\Dungeon"
4) You list the files modified by RPG Maker save:
\GameFolder\database.db
\GameFolder\*.map (to indicated that some .map also changed)
5) You are right, I don't need any of the image files because they remain identical.
I presume, then, that you mean that you only need the database file before and after *one* location change? 'Cause if you need the database before any changes and then after *all* the changes, that would kind of defeat the whole purpose. I'm also guessing that the reason you need this information is so that you can see exactly how and where the string values change between the two database archives and the map files (if relevant)?
Alright. Going on the assumption that my previously stated presumptions are correct, I went ahead and gathered the requested material. This .zip archive contains two folders: "Before Changes" and "After Changes". I imagine those are self explanatory. There is also a .txt file called "The Changes" in the root directory which details the exact nature of the changes made. I hope that what I've gathered here will be adequate. If you would like for me to provide any additional information or files, just let me know, and I would, again, be happy to oblige. Also, if you would like to add me on Discord so that we can discuss this in real time, then give the word, and I'll PM you my addy.
https://www.dropbox.com/s/9da0edpnmatzarr/Files%20for%20Irog.zip?dl=0
You're right, I need to look at a single relocation at a time, not all of them :-). And indeed, I look at how stings got changed in the database and maps. The files you provided are good input to start programming the tool. For a more in-depth analysis, I need to look at a file change in tileset, event and common event separately. This meas the need for:
1) The files before and after a single relocation that affects only a Tileset
2) The files before and after a single relocation that affects only an Event
3) The files before and after a single relocation that affects only a Common Event

Are they categories other than Tileset, Event or Common Event?

Note: Map0031 was apparently not affected by you changes.
Are they categories other than Tileset, Event or Common Event?
Oh. You mean you want before-and-after comparisons for everything else too? I had assumed that you would be able to figure out all the others with the information gleaned from just these three, but since you seem to be implying that this doesn't seem to be the case...

Yes, there sure ARE other categories besides tileset, event, or common event. I have done this over again. However, this time, I have included literally ALL the things. This took me just a little bit under twelve hours to put together, so I really do hope that this will be enough and that the effort will be appreciated and useful.

This package is nearly two gigabytes when unpacked. Amazing how much it was able to be compressed. Like, wow. It's under 100 megabytes compressed. In hindsight, I probably should've used a fresh, new project for this, but... Yeah... I didn't. lol. My database is almost 20 megabytes, and a bajillion copies of it sure adds up. Sorry about that.

I tried to be as thorough as I possibly could be, and I sure do hope that I didn't forget or overlook anything, but I'm PRETTY sure that this is literally every single capacity in which you can ever input a filename string within RM2K3 1.08. The download link is at the bottom of this post. Inside, you will find before-and-after comparison files for the following:

Common Events:
— Common Event Command — Change Face Association
— Common Event Command — Change Map Tileset (Unsure of necessity, but included anyway)
— Common Event Command — Change Parallax Background
— Common Event Command — Change Sprite Association
— Common Event Command — Change Vehicle Graphic — Airship
— Common Event Command — Change Vehicle Graphic — Ship
— Common Event Command — Change Vehicle Graphic — Skiff
— Common Event Command — Face Graphics
— Common Event Command — Move Event — Change Graphic
— Common Event Command — Play BGM
— Common Event Command — Play Memorized BGM (unsure of necessity, but included anyway)
— Common Event Command — Play Movie
— Common Event Command — Play Sound Effect
— Common Event Command — Show Picture
— Common Event Command — Change System BGM — Airship
— Common Event Command — Change System BGM — Battle
— Common Event Command — Change System BGM — Game Over
— Common Event Command — Change System BGM — Inn
— Common Event Command — Change System BGM — Ship
— Common Event Command — Change System BGM — Skiff
— Common Event Command — Change System BGM — Victory
— Common Event Command — Change System SFX — Ally Damage
— Common Event Command — Change System SFX — Begin Battle
— Common Event Command — Change System SFX — Buzzer
— Common Event Command — Change System SFX — Cancel
— Common Event Command — Change System SFX — Cursor
— Common Event Command — Change System SFX — Decision
— Common Event Command — Change System SFX — Enemy Attacks
— Common Event Command — Change System SFX — Enemy Damage
— Common Event Command — Change System SFX — Enemy Defeated
— Common Event Command — Change System SFX — Escape
— Common Event Command — Change System SFX — Evasion
— Common Event Command — Change System SFX — Use Item

Database:
— Database — Actor — Face
— Database — Actor — Sprite
— Database — Animations
— Database — Animations 2 — Poses
— Database — Animations 2 — Weapons
— Database — Animations Large
— Database — Battle Settings
— Database — Monster
— Database — Monster Groups — Background
— Database — System — Airship Graphic
— Database — System — Game Over Graphic
— Database — System — Ship Graphic
— Database — System — Skiff Graphic
— Database — System — System BGM — Airship
— Database — System — System BGM — Battle
— Database — System — System BGM — Game Over
— Database — System — System BGM — Inn
— Database — System — System BGM — Ship
— Database — System — System BGM — Skiff
— Database — System — System BGM — Title
— Database — System — System BGM — Victory
— Database — System — System Graphic
— Database — System — System SFX — Ally Damaged
— Database — System — System SFX — Battle Transition
— Database — System — System SFX — Buzzer
— Database — System — System SFX — Cancel
— Database — System — System SFX — Cursor
— Database — System — System SFX — Enemy Attacks
— Database — System — System SFX — Enemy Damaged
— Database — System — System SFX — Enemy Defeated
— Database — System — System SFX — Evade Attack
— Database — System — System SFX — Flee Battle
— Database — System — System SFX — Item Used
— Database — System — System SFX — Select Choice
— Database — System — Title Graphic
— Database — System 2 — Battle Graphic
— Database — System 2 — Frame Graphic
— Database — Terrain — Background
— Database — Tileset


Map Events:
— Map Event — Graphic
— Map Event Command — Change Face Association
— Map Event Command — Change Map Tileset (Unsure of necessity, but included anyway)
— Map Event Command — Change Parallax Background
— Map Event Command — Change Sprite Association
— Map Event Command — Change System BGM — Airship
— Map Event Command — Change System BGM — Battle
— Map Event Command — Change System BGM — Game Over
— Map Event Command — Change System BGM — Inn
— Map Event Command — Change System BGM — Ship
— Map Event Command — Change System BGM — Skiff
— Map Event Command — Change System BGM — Victory
— Map Event Command — Change System Graphic
— Map Event Command — Change System SFX — Ally Damage
— Map Event Command — Change System SFX — Begin Battle
— Map Event Command — Change System SFX — Buzzer
— Map Event Command — Change System SFX — Cancel
— Map Event Command — Change System SFX — Cursor
— Map Event Command — Change System SFX — Decision
— Map Event Command — Change System SFX — Enemy Attacks
— Map Event Command — Change System SFX — Enemy Damage
— Map Event Command — Change System SFX — Enemy Defeated
— Map Event Command — Change System SFX — Escape
— Map Event Command — Change System SFX — Evasion
— Map Event Command — Change System SFX — Use Item
— Map Event Command — Change Vehicle Graphic — Airship
— Map Event Command — Change Vehicle Graphic — Ship
— Map Event Command — Change Vehicle Graphic — Skiff
— Map Event Command — Face Graphics
— Map Event Command — Move Event — Change Graphic
— Map Event Command — Play BGM
— Map Event Command — Play Memorized BGM (Unsure of necessity, but included anyway)
— Map Event Command — Play Movie
— Map Event Command — Play Sound Effect
— Map Event Command — Show Picture

Map Properties:
— Map Properties — Battle Background
— Map Properties — BGM
— Map Properties — Parallax Background

https://www.dropbox.com/s/vh9htqqsa2yjmwm/Files%20for%20Irog%20%E2%80%94%20Frickin%27%20Everything.rar?dl=0
Here is a tool prototype that edits RPG_RT.ldb and Map0001.lmu by applying the changes listed in RelocateConfiguration.txt. But I'm unhappy about it because of the many limitations it has.
In the database and maps, locations of resources are stored in a compact form that leaves out the base folder name (ChipSet, CharaSet, Picture, ...) and the file extension. The remaining string can for example just be "Saraband" so if an in-game location share this name, it will get altered by the tool. Moreover, the absence of file extensions causes a confusion between "ChipSet\Forest.png" and "Music\Forest.mid" because both appear as "Forest" in the database and maps.

So the limitations are:
* No two files can share the same name (without extension) (ex: avoid "Forest.png" and "Forest.mid")
* The name of any file (without its extension) can't serve as in-game location.

I hope this tool I send a day building will have some use. The current prototype only affects the database and Map0001. You should backup these files before trying the tool. If it passes your tests, I'll build one that affects all maps in the current folder.

How to use this tool:
* Copy "Relocate.exe" and "RelocateConfiguration.txt" to you game folder
* Edit "RelocateConfiguration.txt" to list the changes to perform
* Run Relocate.exe
Welp, it seems to completely not work at all, in any capacity. I made a new project for the sake of testing this out. I slapped a couple of graphics into the CharSet folder and made a couple of sprites that use them as their graphics. I slapped a couple of graphics into the FaceSet folder and made my starting party use them. I also made the starting party use the CharSet graphics that I had slapped in there too. I slapped a couple of .mp3 files into the Music folder and made the map use one of them. And I slapped a few pictures into the Picture folder and made an event that shows them. I also made an event that swaps around the graphics of the sprites that I put on the map. I made an event that changes around the sprites of the starting party. I made an event that changes around the faces of the starting party. I made an event that changes the BGM to the other included BGM. I also made common events which are carbon copies of these events that I just mentioned, and I made other events on the map that call those common events. Then I rewrote the configuration .txt file, and I ran Relocate.exe, and it did absolutely nothing. Nothing had changed anywhere. The events were still the same, the database entries were still the same, and the common events were still the same. Then I figured, "Ok, maybe I need to create the new subfolders manually and move the files into them before this will work." So I did that, and then I ran the .exe again, and still, nothing changed at all (except for that, now, of course, the resource previews in the event and Database pages were all black because their physical resources had been moved). Everything still pointed to the same file locations. However, while I was in the process of looking around at the various relevant events and Database locations, I suddenly had about a half a dozen strange errors appear out of nowhere, and then the project closed itself, and now it is somehow corrupted and I am unable to re-open the project. lol. When I try to open the project, it gives the following error message four times in a row: "Assertion failure (D:\ha\02rpg2000\2003\RPG_RT\GR_ChipSet.pas, 489 Line)". Which is funny, because I didn't even do anything with the chip sets in this test. Then, after that, it gives me this error: "Loading project failed: ">insert project directory here<"."

Also, I'm not sure what you mean by, "in-game location". Do you mean the name of a map?

EDIT: Strangely, it seems to have also closed my main project that I had open as well. Although it doesn't seem to have done any harm to it. It just randomly closed it. I guess it crashed the entire process tree.
EDIT: Welp, actually, some harm does seem to have been done. As I'm working on this event script, changes that I've made keep on undoing themselves randomly, and new lines that I insert are sometimes randomly going to the wrong places. Due to the fact that the Relocate.exe was not used on my main project at all, and also due to the D:\ drive file location of the errors that I got when I did use Relocate.exe, I'm going out on a limb (and hoping) that it's just done something to corrupt my actual RM2K3 installation. So I'm going to try uninstalling and reinstalling RM2K3. If this doesn't work, and my main project is actually borked and I have to fall back to a backup, I will be rather miffed.
EDIT: Okay. Reinstalling RM2K3 did, in fact, fix that anomalous problem. So that's good, at least.
For Relocate.exe to modify RPG_RT.ldb and Map0001.lmu, it needs RM2k3 to be closed. Relocate.exe is a tool prototype and thus only modify the database and first map but doesn't move your files yet.
Yes "in-game location" means the name of a map.

What is the list of file formats (and file extensions) that RM2k3 supports? Can you use any file format from any location? For example use a .png tileset located in \Music ?
Interesting. I will try again later with RPG Maker closed. That might've been a good thing to mention before. :P I'll let you know how that goes.

Images (for any purpose, be they sprite sheets, tile sets, title screens, or whatever) are limited to 256 colour .png and .bmp only.

Music is limited to .mp3 or .wav only.

Sound effects are limited to .wav only.

Movies are limited to .avi and (I think?) .mpeg only.

You cannot use a .png tileset located in \Music because the list of files to choose from when selecting a tileset graphic can and will only include files in the ChipSet\ directory. And, if you put something incompatible into the ChipSet\ directory (like an .mp3 that would otherwise be compatible in the Music\ directory), it will not show up in the list of files to choose from at all when selecting a tileset graphic.
Images also support RM's proprietary *.xyz format.
Does RM2k3 auto-detect file format? If not, file format information must be sorted in the database or maps. This could help me remove the tool limitation "The name of any file (without its extension) can't serve as in-game location".

The following test would show if RM2k3 auto-detects file format:
* start a new project with a single map that uses a non-RTP tileset you've placed in the ChipSet\ directory
* save the project and close RM. RM will stay closed until the end of the test.
* run the game to check the tiles display as expected
* close the game
* use your favorite image editor to convert the .png tileset to a .bmp tileset (the base name must be the same for example TestForest.png --> TestForest.bmp). Make sure image size is preserved.
* remove TestForest.png from the ChipSet\ directory
* run the game and check if the tiles display as expected. If it does, RM2k3 auto-detects file format.
(No need to test anything because I know RM's internals^^)

RM just checks for the existence of a file with that name in this order: BMP>PNG>XYZ / MID>WAV>MP3 / WAV / AVI>MPG (for image/music/sound/movie respectively)

Also, I don't understand why you have the "in-game location" problem. What do you even mean by ingame location? Map name? Then why do you even attempt to replace this field?

From what I understand, what needs to be done is to make a list of filename fields in the 4 possible datafile types (LDB/LMU/LMT/LSD) and their resources type/folder, and then go over each of them and apply the updates, iterating over things where needed.

The only tricky things, I think, are:

* The "Move Event" event command, because it encodes a chain of move commands in its numerical parameters, with sound effect names embedded
* Obviously all DynRPG comment commands of various plugin (you probably can't support those, except maybe for a select few)
* The picture filename pointer functionality of both PicPointerPatch and the official Steam RM2k3 (there you have two ways to define the replacement in the filename: for one, from PicPointerPatch - but also supported by Steam RM2k3! - you'd just check if the picture ID is >=50000 in a "Show Picture" command, and if yes, you treat the filename like a wildcard with the 4 last characters being unknown and then move all matching files, for example "Something0000" would then move also "Something0001", "Something1234", etc., and for the other, only in Steam RM2k3, it uses a separate setting of how many characters are wildcards. )

But the documentation and other code that accesses all these things should be available at EasyRPG, because EasyRPG is already able to emulate >99% of the games out there, I'd say.
Right. I forgot about .xyz and .mid. However, I think that .xyz barely even counts as a proper file format. As far as I can tell, literally all it is is just an artificial renaming of the file. You can take an .xyz file and just rename it back to a .png again and it works just fine.
Pages: first 12 next last