Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.95a is out! (03/26/21)

Author Topic: [0.95a] WhichMod 0.4a  (Read 2242 times)

theDragn

  • Lieutenant
  • **
  • Posts: 86
    • View Profile
[0.95a] WhichMod 0.4a
« on: February 18, 2021, 10:53:59 AM »

WhichMod

This is a simple script to add the mod title (or abbreviated title, if the mod has a commonly accepted abbreviation) to the descriptions of all ships, weapons, and fighters added by mods.
It's generally intended to be used on vanilla-ish mods, but can be used on faction mods too if you so desire. It can also remove the added mod titles, if you decide you don't like it.

Example (from Arsenal Expansion):


Comes in three forms, a packaged executable, an unpackaged executable, and a .py.
It is recommended that you use the unpackaged executable. The packaged executable will probably set off your antivirus. The unpackaged version (probably) won't, but there's a lot of extra files that could clutter up your mods folder. If you don't trust me, install Python and use the plain script.
If you have Python installed (or if you're on Mac/Linux), you can use the .py, which will also let you make changes to the naming conventions.

To use: Place the contents of the .zip in your mods folder (not in its own folder) and run whichmod.exe. It will prompt you for what you want to do. If you're using the .py, stick it in the same place and run it. You can safely delete it after running the script, if you want to. Undoing the changes will require running the script again and selecting the proper option.

Please note that this directly modifies the descriptions.csv files of mods, and thus has the potential to break things. It shouldn't break anything, but it definitely has the potential to.
It will generally skip any mod where it encounters an error, but there is a small possibility that it does not notice the error and writes a malformed descriptions.csv for a mod. If this occurs, Starsector will produce an error when starting, and WhichMod will produce an error if it tries again to add/remove the description changes for that mod. You will need to replace the data/strings/descriptions.csv file with a fresh version (either by replacing the entire mod, or just that file). Some mods may have malformed descriptions.csv files from the start; WhichMod will not modify anything with a malformed descriptions.csv file.

Additionally, as part of the editing process, it will convert any non-ASCII characters to their closest ASCII equivalents. This is required to avoid summoning the unicode demon errors. Any changes will be minor- ie, "ñ" becomes "n", but this is not reversible.

Unpackaged Executable (.exe) This (hopefully) shouldn't set off your antivirus, but it's a fair number of assorted files along with the .exe.


Packaged Executable (.exe) This is nice and compact, just a single executable, and has a good chance of setting off your antivirus. It takes all the assorted files in the unpackaged version and hides them inside the .exe, which apparently freaks out most AV software. If you don't trust it, you can install Python and use the .py instead, which will let you view the source code.


Python script/source (.py) You'll need to grab the Unidecode package for this to work. (pip install Unidecode)


Troubleshooting:
Spoiler
- If you see a bunch of weird letters in a ship description, something's gone wrong. Replace that mod's descriptions.csv with the original one, or just reinstall the mod entirely.
- "malformed csv": The script skipped this mod because the descriptions.csv file had bad formatting or something. If this was a fresh download, it's not the script's fault. If it wasn't fresh and it didn't have that error before, oops. Reinstall the mod.
- Pretty much anything: reinstall the mod, check if the error goes away. If it does, run the script again. If the error comes back, it was the script's fault.
[close]

Changelog:
Spoiler
0.4a:
- Confirmed compatibility with Starsector 0.95a.

0.4a:
- Improved detection of malformed descriptions.csv files (this will resolve a crash that would occur when using the script on Neutrino)

0.4:
- Now includes an unpackaged executable, which shouldn't trigger antivirus software.
- Now uses slightly less memory (like that ever actually mattered, lol)

0.3:
Bugfix:
- No longer summons the unicode demon when it encounters certain non-ascii characters.
- To fix this, it replaces all non-ascii characters with their closest ascii equivalents. (For example, "ñ" becomes "n".) Unlike the other changes this script applies, this is not reversible. If you're desperate to hold onto your funky letters, back up your mods folder before running this.

0.2: Release
0.1: Discord-only beta
[close]

« Last Edit: March 27, 2021, 01:02:30 PM by theDragn »
Logged

Chairman Suryasari

  • Captain
  • ****
  • Posts: 320
  • RAM RANCH INSTRUMENTAL - Flying Through the Sky -
    • View Profile
Re: [0.9.1a] WhichMod 0.2
« Reply #1 on: February 18, 2021, 03:21:39 PM »

It remind me of similar mod for Rimworld, nice.
Logged
There is an entire forum dedicated to chewing ice cube on deepweb, look it up.

theDragn

  • Lieutenant
  • **
  • Posts: 86
    • View Profile
Re: [0.9.1a] WhichMod 0.3
« Reply #2 on: February 18, 2021, 04:03:59 PM »

Quick bugfix:
- No longer summons the unicode demon if it encounters a non-ASCII character
- Banishing the unicode demon required a sacrifice: all non-ASCII characters are converted to their closest ASCII equivalent. This is not reversible.

Golde

  • Lieutenant
  • **
  • Posts: 61
    • View Profile
Re: [0.9.1a] WhichMod 0.3
« Reply #3 on: February 22, 2021, 05:11:54 PM »

underappreciated and uncircumcised
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 18136
    • View Profile
Re: [0.9.1a] WhichMod 0.3
« Reply #4 on: February 23, 2021, 10:31:24 AM »

underappreciated and uncircumcised

That's inappropriate for this forum, please try to exercise better judgment in the future.
Logged

Cyan Leader

  • Admiral
  • *****
  • Posts: 617
    • View Profile
Re: [0.9.1a] WhichMod 0.3
« Reply #5 on: February 25, 2021, 03:40:05 AM »

Thank you a lot for this, it's something I've been wanting for ages and I think should be part of vanilla in some basic way.
Logged

theDragn

  • Lieutenant
  • **
  • Posts: 86
    • View Profile
Re: [0.9.1a] WhichMod 0.4: Now with antivirus evasion!
« Reply #6 on: February 25, 2021, 08:51:18 PM »

0.4 update. No major changes, but now has an unpackaged version that shouldn't set off antivirus software.

theDragn

  • Lieutenant
  • **
  • Posts: 86
    • View Profile
Re: [0.9.1a] WhichMod 0.4a
« Reply #7 on: March 01, 2021, 04:11:54 PM »

Patched to 0.4a. Now more reliably detects mangled .csv data, which should fix a crash with Neutrino.

theDragn

  • Lieutenant
  • **
  • Posts: 86
    • View Profile
Re: [0.95a] WhichMod 0.4a
« Reply #8 on: March 27, 2021, 01:04:39 PM »

I've verified that this works with 0.95a. No changes are necessary for the moment.