develop
expwnent 2014-09-16 17:13:51 -04:00
commit f114aee758
3 changed files with 18 additions and 16 deletions

@ -13,6 +13,10 @@ DFHack future
New plugins: New plugins:
- hotkeys (by Falconne): Shows ingame viewscreen with all dfhack keybindings active in current mode. - hotkeys (by Falconne): Shows ingame viewscreen with all dfhack keybindings active in current mode.
Misc improvements:
updated exportlegends.lua to work with new maps, dfhack 40.11 r1+
DFHack 0.40.11-r1 DFHack 0.40.11-r1
Internals: Internals:

@ -1424,7 +1424,7 @@ Exports data from legends mode; allowing a set-and-forget export of large worlds
Options: Options:
:maps: Exports all fifteen detailed maps :maps: Exports all seventeen detailed maps
:all: first exports the world/gen info, then the XML, then all detailed maps :all: first exports the world/gen info, then the XML, then all detailed maps

@ -1,18 +1,14 @@
-- Export everything from legends mode -- Export everything from legends mode
-- Based on the script 'exportmaps' -- use "exportlegends maps" for detailed maps, or "exportlegends all" to also export legends
-- Suggested keybinding: keybinding add Shift-A@legends "exportlegends all"
gui = require 'gui' gui = require 'gui'
local args = {...} local args = {...}
local vs = dfhack.gui.getCurViewscreen() local vs = dfhack.gui.getCurViewscreen()
local i = 0 local i = 1
if args[1] then print(' A script which exports data from legends mode. Valid arguments are "maps" (detailed maps) or "all" (detailed maps, world/gen info, XML).') end
local MAPS = { local MAPS = {
[0] = "Standard biome+site map", "Standard biome+site map",
"Elevations including lake and ocean floors", "Elevations including lake and ocean floors",
"Elevations respecting water level", "Elevations respecting water level",
"Biome", "Biome",
@ -27,12 +23,14 @@ local MAPS = {
"Salinity", "Salinity",
"Structures/fields/roads/etc.", "Structures/fields/roads/etc.",
"Trade", "Trade",
"Nobility and Holdings",
"Diplomacy",
} }
function wait_for_legends_vs() function wait_for_legends_vs()
vs = dfhack.gui.getCurViewscreen() vs = dfhack.gui.getCurViewscreen()
if i < 15 then if i <= #MAPS then
if df.viewscreen_legendsst:is_instance(vs) then if df.viewscreen_legendsst:is_instance(vs) then
gui.simulateInput(vs, 'LEGENDS_EXPORT_DETAILED_MAP') -- "d" on screen some number internally gui.simulateInput(vs, 'LEGENDS_EXPORT_DETAILED_MAP')
dfhack.timeout(10,'frames',wait_for_export_maps_vs) dfhack.timeout(10,'frames',wait_for_export_maps_vs)
else else
dfhack.timeout(10,'frames',wait_for_legends_vs) dfhack.timeout(10,'frames',wait_for_legends_vs)
@ -42,10 +40,10 @@ end
function wait_for_export_maps_vs() function wait_for_export_maps_vs()
vs = dfhack.gui.getCurViewscreen() vs = dfhack.gui.getCurViewscreen()
if df.viewscreen_export_graphical_mapst:is_instance(vs) then if df.viewscreen_export_graphical_mapst:is_instance(vs) then
vs.anon_13 = i -- anon_13 appears to be the selection cursor for this viewscreen vs.sel_idx = i
print('Exporting: '..MAPS[i]) print(' Exporting: '..MAPS[i]..' map')
i = i + 1 i = i + 1
gui.simulateInput(vs, 'SELECT') -- 1 internally, enter on screen gui.simulateInput(vs, 'SELECT')
dfhack.timeout(10,'frames',wait_for_legends_vs) dfhack.timeout(10,'frames',wait_for_legends_vs)
else else
dfhack.timeout(10,'frames',wait_for_export_maps_vs) dfhack.timeout(10,'frames',wait_for_export_maps_vs)
@ -62,7 +60,7 @@ if df.viewscreen_legendsst:is_instance( vs ) then -- dfhack.gui.getCurFocus() ==
elseif args[1] == "maps" then wait_for_legends_vs() elseif args[1] == "maps" then wait_for_legends_vs()
end end
elseif df.viewscreen_export_graphical_mapst:is_instance(vs) then elseif df.viewscreen_export_graphical_mapst:is_instance(vs) then
if args[1] == "maps" or "all" then wait_for_export_maps_vs() end if args[1] == "maps" or args[1] == "all" then wait_for_export_maps_vs() end
else else
dfhack.printerr('Not in legends view') dfhack.printerr('Not in legends view')
end end