Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Legends processing script v2.5 - now with Python edition!  (Read 15547 times)

PeridexisErrant

  • Bay Watcher
  • Dai stihó, Hrasht.
    • View Profile
Legends processing script v2.5 - now with Python edition!
« on: September 19, 2013, 10:28:27 pm »

This project has been moved to GitHub.  You can find an old version on DFFD, but I recommend grabbing the latest release from the source.   

I've always liked playing around with various maps and data that can be exported from legends mode, but to get it in a nice format takes quite a bit of fiddling - compressing the bitmaps to PNG format, creating an archive for Legends Viewer, moving files around, using the map-maker script, and so on.  I thus decided to automate as much of it as possible, and this is the result. 

The script:
  • gets the region number from an image or the legends file, to use in names
  • uses the map-maker script, handling missing bits gracefully
  • compresses world maps and site maps to PNG, but not other images
  • fixes the legends xml if workflow has corrupted it for Legends Viewer
  • creates an archive for legends viewer if all components exist, or just compress the xml if not (requires 7z)
  • moves the exports to a region-specific folder in the "..\User Generated Content" folder

As of version 3.0, the whole folder can be placed either under LNP/utilities or in the same folder as DF for a vanilla install. 
« Last Edit: March 23, 2014, 09:42:03 pm by PeridexisErrant »
Logged
I maintain the DF Starter Pack - over a million downloads and still counting!
 Donations here.

PeridexisErrant

  • Bay Watcher
  • Dai stihó, Hrasht.
    • View Profile
Legends processing script v2.4 - now with Python edition!
« Reply #1 on: September 20, 2013, 12:07:58 am »

This is an older version.  Version 2.2 adds a module to 'clean' a legends file of the special characters added by workflow to save settings - if these are not dealt with, Legends Viewer crashes instead of displaying the legends.  This requires that these special characters are included in the script, but they cannot be put on the forums.  The newer version is available from DFFD. 


Comments, criticism, and suggested improvements most welcome. 

« Last Edit: February 14, 2014, 02:45:18 am by PeridexisErrant »
Logged
I maintain the DF Starter Pack - over a million downloads and still counting!
 Donations here.

Ravendarksky

  • Bay Watcher
    • View Profile
    • DFMon.exe - Get rid of DF SPAM
Re: Legends exports processing script v2.2
« Reply #2 on: September 27, 2013, 06:59:42 am »

Hi,

I've been playing around with this... How do I tell if it has actually worked or not? The window just closes as soon as I hit start.
Logged

PeridexisErrant

  • Bay Watcher
  • Dai stihó, Hrasht.
    • View Profile
Re: Legends exports processing script v2.2
« Reply #3 on: September 27, 2013, 07:06:28 am »

If it worked, you have a new folder with your exports processed above the DF folder.

Since it's closing near-instantly, you have some kind of problem - it should always give some kind of information if it's not working routinely.  Uh... it's windows-only, if you're on something else.  It needs to be in the same folder as DF, where the exports are dropped in the first place.  I can't help much more without more information, sorry.  Video best, then (pics and) a detailed description of exact steps, process, and results.  =/
Logged
I maintain the DF Starter Pack - over a million downloads and still counting!
 Donations here.

PeridexisErrant

  • Bay Watcher
  • Dai stihó, Hrasht.
    • View Profile
Re: Legends processing script v2.4 - Python edition complete!
« Reply #4 on: February 14, 2014, 02:44:35 am »

Substantial update to the python edition today... well, uploaded today anyway.  It's now strictly superior to the batch file version in terms or error handling and so on.  It's only missing the component to 'clean' a legends.xml of non-printing characters left by dfhack - which is only an issue if you've exported legends after playing a fort.  To use the python edition download the pack in the first post, and replace the .bat with the following python code (you need python installed, and to change the extension too). 

Spoiler (click to show/hide)

Update:  several features behind now, but it does might crash less often... and most of it works on non-windows platforms which will sometimes be worth it. 
« Last Edit: March 13, 2014, 09:03:17 pm by PeridexisErrant »
Logged
I maintain the DF Starter Pack - over a million downloads and still counting!
 Donations here.

PeridexisErrant

  • Bay Watcher
  • Dai stihó, Hrasht.
    • View Profile
Re: Legends processing script v2.4 - now with Python edition!
« Reply #5 on: March 14, 2014, 01:24:21 am »

Updated to v2.5;
     added RealisticMapMaker, a second map processing script; enabled the script to be placed in a LNP\Utilities\legendsprocessor folder

Thanks, CharonM72!
Logged
I maintain the DF Starter Pack - over a million downloads and still counting!
 Donations here.

Heavygain

  • Escaped Lunatic
    • View Profile
Re: Legends processing script v2.5 - now with Python edition!
« Reply #6 on: April 07, 2014, 07:21:24 pm »

Hi there,

I'm trying to get my legends export to with with legends viewer and no matter what I do I can't seem to get the xml file to work. With newest version of your script it looks like it is exporting for a few seconds, but the xml file it creates is 0 b in size. My xml file is super tiny to begin with, being only a 50 year world, but obviously I'm not doing something right. I've been trying it every way I can think of, including with all of the legends files and the script files in their own folder unarchived as well as in a rar file. It only seems to recognize the files if I put them in the folder unarchived, however.
« Last Edit: April 07, 2014, 07:31:58 pm by Heavygain »
Logged

PeridexisErrant

  • Bay Watcher
  • Dai stihó, Hrasht.
    • View Profile
Re: Legends processing script v2.5 - now with Python edition!
« Reply #7 on: April 07, 2014, 07:34:21 pm »

Yep, the processor assumes that the only thing you've done with the files is export them!  I just posted a more detailed response over in the legends viewer thread actually... took me a few replies worth to go through all the code and post results!
Logged
I maintain the DF Starter Pack - over a million downloads and still counting!
 Donations here.