Bay 12 Games Forum

Dwarf Fortress => DF Modding => Utilities and 3rd Party Applications => Topic started by: mifki on August 03, 2015, 03:45:43 am

Title: Legends in Fortress mode
Post by: mifki on August 03, 2015, 03:45:43 am
Did you know it's possible to do

Code: [Select]
w=dfhack.gui.getCurViewscreen() ; w.child=df.viewscreen_legendsst:new() ; dfhack.gui.getCurViewscreen().parent=w

and get a fully functional Legends screen? There was couple question about how to get more info about outer world recently. The only thing you can't use ESC to close the screen, instead, use

Code: [Select]
dfhack.gui.getCurViewscreen().breakdown_level=2

Someone needs to make a convenient script, if there's no already.
Title: Re: Legends in Fortress mode
Post by: PeridexisErrant on August 03, 2015, 06:40:29 am
Did you know it's possible to do

Code: [Select]
w=dfhack.gui.getCurViewscreen() ; w.child=df.viewscreen_legendsst:new() ; dfhack.gui.getCurViewscreen().parent=w

and get a fully functional Legends screen? There was couple question about how to get more info about outer world recently. The only thing you can't use ESC to close the screen, instead, use

Code: [Select]
dfhack.gui.getCurViewscreen().breakdown_level=2

Someone needs to make a convenient script, if there's no already.

No, WOW, yes - definitely.  I'll open an isssue and crosspost to the DFHack thread  :D

Downside - DF crashed when I tried ESC-ing to close the screen, so that will need to be handled.  Upside - I can even export legends files!  This is great!  I'll also want to change exportlegends.lua a bit to allow exports from fortress mode...
Title: Re: Legends in Fortress mode
Post by: mifki on August 03, 2015, 06:51:02 am
Well, that's what needs to be done - intercepting ESC and closing the view using breakdown_level=2. I don't know if that can be done in Lua, otherwise just a very small dfhack plugin.
Title: Re: Legends in Fortress mode
Post by: lethosor on August 06, 2015, 09:09:00 am
This is equivalent to
Code: [Select]
dfhack.screen.show(df.viewscreen_legendsst:new())
dfhack.screen.dismiss(dfhack.gui.getCurViewscreen())
The only thing you'd really need a separate script for is to intercept LEAVESCREEN appropriately.

Edit: Here (https://github.com/lethosor/dfhack-scripts/blob/master/open-legends.lua) is a script that does that. Currently untested in adventure mode. Appears to work in adventure mode as well.
Title: Re: Legends in Fortress mode
Post by: mifki on August 06, 2015, 05:08:15 pm
This is equivalent to
Code: [Select]
dfhack.screen.show(df.viewscreen_legendsst:new())
dfhack.screen.dismiss(dfhack.gui.getCurViewscreen())
The only thing you'd really need a separate script for is to intercept LEAVESCREEN appropriately.

Edit: Here (https://github.com/lethosor/dfhack-scripts/blob/master/open-legends.lua) is a script that does that. Currently untested in adventure mode. Appears to work in adventure mode as well.

That's it, thanks!
Title: Re: Legends in Fortress mode
Post by: lethosor on August 06, 2015, 07:43:24 pm
FWIW, that script breaks the "Ctrl-A@legends" keybinding in dfhack.init-example, but it will be possible to specify multiple contexts at once in the next version, so "Ctrl-A@legends|dfhack/lua/legends" will work.
Title: Re: Legends in Fortress mode
Post by: Geltor on August 13, 2015, 04:18:03 am
i followed your use instructions on reddit here: https://www.reddit.com/r/dwarffortress/comments/3g0g6h/dfhack_script_that_opens_the_legends_screen_in/

unfortunately when i run "open-legends" in dfhack while fortress mode is open, i get this:
Spoiler (click to show/hide)

what am i doing wrong?

edit: note that i wrote "enable" after the open-legends, i tried it without that as well and the results are the same
Title: Re: Legends in Fortress mode
Post by: lethosor on August 13, 2015, 07:41:51 am
Yeah, there was a compatibility issue with DFHack 0.40.24-r3 which I just fixed in the repo. Try downloading it again.
Title: Re: Legends in Fortress mode
Post by: Geltor on August 13, 2015, 08:11:47 am
Yeah, there was a compatibility issue with DFHack 0.40.24-r3 which I just fixed in the repo. Try downloading it again.
that did it. thank you.

is there any way to get "exportlegends all" to work with this? says it has to be in the main legends menu.
Title: Re: Legends in Fortress mode
Post by: lethosor on August 13, 2015, 10:35:36 am
Yeah, there was a compatibility issue with DFHack 0.40.24-r3 which I just fixed in the repo. Try downloading it again.
that did it. thank you.

is there any way to get "exportlegends all" to work with this? says it has to be in the main legends menu.
It'll require a change to the exportlegends script. open-legends creates an invisible screen above the legends screen (which catches 'esc' and stops DF from crashing), which is what exportlegends sees.
Title: Re: Legends in Fortress mode
Post by: Meph on August 21, 2015, 01:44:20 pm
Hey guys, I made a little something using this script: http://www.bay12forums.com/smf/index.php?topic=152707.0

Your dwarves can build an archive in your fort and look up legends mode themselves now. :)

Edit: Damn it, I'm really slipping... this was posted on the 3rd, script finished on the 6th... and I only see this now. O.o
Title: Re: Legends in Fortress mode
Post by: Max™ on August 22, 2015, 02:19:21 am
Did I mention how amazing this is? I thought pulling up the names screen was awesome, but having access to current legends in game? Fuck me dude.