Post subject: loading a save state in lua script
Joined: 11/24/2018
Posts: 2
I am trying to load a savestate from lua script. (in the VBA recording, vba-rerecording-svn480-win32) The savestate already exists as a file (however I could also create it inside the script as well) I have tried using the following script to test loading:
save_object = savestate.create(1) savestate.load(save_object)
I get the following error
... lua:28: loadstate failed
I would really love if someone could explain to me how to load a game from a savestate file and from a savestate object using a lua script. The documentation on how to use savestates is still under a TODO list on the website... I really need this utility to make my script work!
Editor, Player (67)
Joined: 6/22/2005
Posts: 1041
Based on the savestate info on the wiki (Wiki: EmulatorResources/VBA/LuaScriptingFunctions), did you try to actually save the state using the savestate.save() function?
Current Projects: TAS: Wizards & Warriors III.
Post subject: Thanks for quick reply
Joined: 11/24/2018
Posts: 2
I have tried but I am getting an error: Error creating file This is my code: state = 1 save = savestate.create(state) save_object = savestate.save(save) savestate.load(save_object) if you could post a code snipplet that works i would be extremely greatful
Masterjun
He/Him
Site Developer, Skilled player (1970)
Joined: 10/12/2010
Posts: 1179
Location: Germany
It seems like VBA-rr has some kind of internal problem with generating a proper filename for Lua savestates with a slot number. I get the same error. The only thing that does work is not using a number and just using internal Lua savestates:
state1 = savestate.create()
state2 = savestate.create()

savestate.save(state1)
emu.frameadvance()
emu.frameadvance()
savestate.save(state2)
emu.frameadvance()
emu.frameadvance()
emu.frameadvance()
savestate.load(state2)
emu.frameadvance()
emu.frameadvance()
emu.frameadvance()
emu.frameadvance()
savestate.load(state1)
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)