[Batch Tool] Rimworld Mod Mass De-Steamifyier

Started by Xcallono, August 04, 2020, 11:20:01 PM

Previous topic - Next topic

Xcallono

So, let me set the scene. Imagine, you are developing a modpack. A couple of your friends lack the steam version of Rimworld, but you want to include them in some sort of wacky challenge anyways. You copy your mods from Steam\steamapps\workshop\content\294100, and... You pause, looking at your long list of downloaded mods. You know that you're probably going to delete a few of those mods later, or may not even want a lot of those mods in the challenge, but they're all in their ID form! You could go onto google and check each ID, but that could take AGES, especially with a slow connection, and checking their about.xml file is tedious, especially if you need to check over 100 of them. Enter, the Rimworld Mod Mass De-Steamifyier.

In short, what this batch file does is super simple. It sifts through all of the folders of a mod, looking for an about.xml file, and reads that file to gain a name to rename the folder to. A collaboration of me and a poor sod from the ReactOS community who has been working on an improved CMD.exe for that project, this is able to rename HUNDREDS of files in just under 5 minutes. How do I know? I tested it with all 206 of my mods. I personally like to take a USB stick with my favorite games on the road, but to free space I need to remove certain mods, so I need to rename each and every single one in order to know which ones I need to remove. This can do it stress free and with a really high degree of accuracy!

Of course, because this is my first version and I'm just exhausted after banging my head on a keyboard for 4 days with few interrupts, this has some notable issues. The biggest issue is that it fails to rename the folder if there are slashes, parenthesis, or any other restricted Windows folder name characters in the name attribute of the .xml file, but I do plan to fix this and a few other issues later on. If you guys find additional issues, let me know so that I can fix them!

If you want, you can reuse any part of the code and release modifications of the code freely, including the terrible substr function that finds the attributes in the .xml file, but I DO NOT want you selling this or any modification of this batch file. It is entirely for free and I want to keep it that way!



Changelog

Version 1.1
Added new debugging output(now outputs to a debug.txt rather than just your screen.)
Added new automation(call "desteamifyer.bat" d "Mods" a)
Added new modlists feature(fairly incomplete)
Slight improvements on XML parser(runs an estimated 40% faster)
Version 1.0
Initial release.
I'm a mechanical man.

Canute

Hi,
it is a nice idea.
Since RimPy got the integrated workshop download option over SteamCMD i have primary these number folders at Mods.
But you should include at the topic that it is a window's batchfile and not useable by others OS.


Xcallono

Well technically it is usable by ReactOS but that is certainly aside the point. Thanks for letting me know. If I had another OS to work with, and were comfortable and had even MORE time, I'd GLADLY write ports with other shell scripts.
I'm a mechanical man.

ruPal

Quote from: Canute on August 05, 2020, 03:13:32 AM
Since RimPy got the integrated workshop download option over SteamCMD i have primary these number folders at Mods.
That operation will break compatibility with updater function of RimPy, because SteamCMD downloads mods as usual steamids (numbers). It will cause duplication of mods if you use it.

Xcallono

Hmm, well I was planning for 1.1 to be just a major bug fixing update and slight improvement on the XML parser, but if this is really as big of a problem as I think it is, I'll just delay 1.1 just a little further so I can introduce both automation and the ability to run off of a text file to mass replace a bunch of existing mods at once without needing to run the sluggish parser. I really apologize for not thinking about that sooner, I don't use SteamCMD though...
I'm a mechanical man.

ruPal

It is not a problem of this script. it is just a limitation of how Steam and RimPy works.

Xcallono

Okay, the basics of automation have been put in place. V 1.2 is going to be a complete code overhaul to strip down the amount of repeats in the code I have, since I've basically copied the same 2 functions 3 times in order to make this work. If I were you, I'd honestly avoid the V 1.1 upload I'm putting up due to how rushed and incomplete it truly is, but if you need automation really badly, this will do. To do automation, the parameter format is [type d(classic)/n(new desteamify text file)/r(use existing desteamify text file)], [directory], [a(automatically close upon finishing)], and you could run Rimpy from a .bat file, followed by this.
In batch format, you'd use something like this to achieve an automatic, classic result.
call "Rimworld Mod de-steamifyier v2.bat" d K:\Mods a

Appended to this is a debug log to demonstrate just how damned, and yet functional, this 12 KB monstrosity really is. Like I said, I'm REALLY going to need to refactor most of this code for V 1.2, and V 1.2 probably will be SOLELY a code refactor, with maybe one quality of life change to handle the modlists a little better.
I'm a mechanical man.