Icon representing a recipe

Recipe: Quicksave extend V1.0

created by gramps

Profile


Name
Quicksave extend V1.0
ID
44020
Shared with
Public
Parent
None
Children
Created on
August 27, 2012 at 00:14 AM UTC
Updated on
August 27, 2012 at 00:14 AM UTC
Description

Dialog access to Quicksave and Quickload for slots 1 to 100

Best for


Code


-- Quicksave extend V1.0 -- -- Dialog access to Quicksave and Quickload for slots 1 to 100 -- -- by gramps (John McLeod) -- V1.0 -- August 27, 2012 -- progname = "Quicksave extend V1.0" -- -- MAIN stuff -- print(progname,"started") print("score at start:", string.format("%5.3f", current.GetEnergyScore())) -- local ask = dialog.CreateDialog("Quicksave / Quickload extend") ask.Instructions = dialog.AddLabel("Select slots to save to and/or load from (slot 0 skips)") ask.OK = dialog.AddButton("OK", 1) ask.Cancel = dialog.AddButton("Cancel", 0) ask.SaveSlot = dialog.AddSlider("save to 1-100", 0, 0, 100, 0) -- integer 1 to 100 initially set to 0 (means "no save") ask.LoadSlot = dialog.AddSlider("load from 1-100", 0, 0, 100, 0) -- integer 1 to 100 initially set to 0 (means "no load") if (dialog.Show(ask) > 0) then if (ask.SaveSlot.value > 0) then print("saving to slot", ask.SaveSlot.value) save.Quicksave(ask.SaveSlot.value) end if (ask.LoadSlot.value > 0) then print("loading from slot", ask.LoadSlot.value) save.Quickload(ask.LoadSlot.value) end else print("user canceled operation") end -- print("score at end:", string.format("%5.3f", current.GetEnergyScore())) print(progname,"ended") -- -- end Quicksave extend V1.0

Comments