Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exports legends into folders #152

Merged
merged 12 commits into from
Jul 27, 2020
Merged

Conversation

ralpha
Copy link
Contributor

@ralpha ralpha commented Apr 26, 2020

Fixes DFHack/dfhack#1416
If no folder name given, default is of similar pattern to region1-00125-01-01

exportlegends all will use default path
exportlegends all myfolder_name will create and use the
"myfolder_name" folder
exportlegends all . will not put the files in a folder. (tested on
linux)

This works for all arguments.

Tested on Linux and works fine.
TODO: Test this on windows systems. It should work but it should also be tested.

Solves: DFHack/dfhack#1416
If no folder name given, default is of simial patern to 
`region1-00125-01-01`

`exportlegends all` will use default path
`exportlegends all myfolder_name` will create and use the 
"myfolder_name" folder
`exportlegends all .` will not put the files in a folder. (tested on 
linux)

This works for all arguments.

**TODO: Test this on windows systems**
@neo6633
Copy link

neo6633 commented Apr 26, 2020

Im loll in discord.

I just replaced the lua file to your new one.

\PeridexisErrant's Starter Pack 0.47.04-r03\Dwarf Fortress 0.47.04\hack\scripts\exportlegends.lua

replaced to your new version.

https://raw.githubusercontent.com/ralpha/scripts/e02cb4beb8b2fd52c4569a4063f9df879dd9b513/exportlegends.lua

copied here.

and I runed "exportlegends info"

I think new folder appeared. But there is error message in DFhack command line.

here is "https://pastebin.com/a80SijiG"

Actually im not a coder but just let you know.

OS : Windows 10

@lethosor
Copy link
Member

Your DFHack version is too old - identity_type was added after 0.47.04-beta1 was released. You could upgrade DFHack manually, or wait for a new pack to include a 0.47.04-r1 (which should be out soon).

@ralpha
Copy link
Contributor Author

ralpha commented Apr 26, 2020

@neo6633 You could try with exportlegends maps or exportlegends sites these don't export the legends_plus.xml and will thus should not give you any errors.

@ralpha
Copy link
Contributor Author

ralpha commented Apr 28, 2020

Got conformation from @neo6633 that it worked fine on Windows after updating DFHack.

The changing of folders to save the files is now very local
and only changes for a shot amount of time.
This is makes the chance of something going wrong because of an error
less likely to effect DFHack.
@ralpha
Copy link
Contributor Author

ralpha commented Jun 9, 2020

Updated the script to be more robust when changing folders.
This is makes the chance of something going wrong because of an error
less likely to effect DFHack.

This is also ready to be merged.

Tested it on:

  • Linux 64bit with dfhack latest version compiled from source.
  • Windows 10 64bit fresh install of DF 0.47.04 + DFHack 0.47.04-r1 (download from release page, precompiled) (tested in VM)

Copy link
Member

@lethosor lethosor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed a couple things worth mentioning when I was going through PRs - not hugely important, and I can make the changes later if needed

exportlegends.lua Outdated Show resolved Hide resolved
exportlegends.lua Outdated Show resolved Hide resolved
@ralpha
Copy link
Contributor Author

ralpha commented Jul 20, 2020

I resolved the changes you asked for.
I also added some more documentation and added a catch so it does not create a folder when no world is loaded.

exportlegends.lua Outdated Show resolved Hide resolved
lethosor added a commit that referenced this pull request Jul 27, 2020
v2 uses the wrong commit sometimes (seen on #152 and #159 so far): actions/checkout#299
Copy link
Member

@lethosor lethosor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I took care of the merge conflict, and then another issue causing tests to run on the wrong commit - apologies for the noise)

exportlegends.lua Outdated Show resolved Hide resolved
@lethosor lethosor merged commit 0565c8d into DFHack:master Jul 27, 2020
@ralpha
Copy link
Contributor Author

ralpha commented Jul 27, 2020

@lethosor Thanks for all the help with getting this into DFHack. (and all the other very nice work you are doing for DF Hack)
This is a very welcome feature especially since this is useful for the DF Storyteller application I'm currently finishing (will be out in a week or 2). (if you want to test it out let me know ;) )
This is also the reason why I made some other changes to the exportlegends.lua file in the past and will probably do in the future.

lethosor added a commit to lethosor/dfhack that referenced this pull request Oct 15, 2020
This allows restoring the working directory to its original value, which may not actually be the DF root. See DFHack#1671, DFHack/scripts#152
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

exportlegends: save in legends/ subfolder
3 participants