2012-05-04 10:59:06 -06:00
|
|
|
-- Makes the game immediately save the state.
|
|
|
|
|
|
|
|
if not dfhack.isMapLoaded() then
|
2012-06-22 06:36:50 -06:00
|
|
|
qerror("World and map aren't loaded.")
|
2012-05-04 10:59:06 -06:00
|
|
|
end
|
|
|
|
|
2015-05-06 16:47:40 -06:00
|
|
|
if not dfhack.world.isFortressMode() then
|
|
|
|
qerror('This script can only be used in fortress mode')
|
|
|
|
end
|
|
|
|
|
2012-05-04 10:59:06 -06:00
|
|
|
local ui_main = df.global.ui.main
|
|
|
|
local flags4 = df.global.d_init.flags4
|
|
|
|
|
|
|
|
local function restore_autobackup()
|
|
|
|
if ui_main.autosave_request and dfhack.isMapLoaded() then
|
|
|
|
dfhack.timeout(10, 'frames', restore_autobackup)
|
|
|
|
else
|
|
|
|
flags4.AUTOBACKUP = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Request auto-save
|
|
|
|
ui_main.autosave_request = true
|
|
|
|
|
|
|
|
-- And since it will overwrite the backup, disable it temporarily
|
|
|
|
if flags4.AUTOBACKUP then
|
|
|
|
flags4.AUTOBACKUP = false
|
|
|
|
restore_autobackup()
|
|
|
|
end
|
|
|
|
|
|
|
|
print 'The game should save the state now.'
|