Post subject: Screenshots via lua?
Joined: 3/18/2006
Posts: 971
Location: Great Britain
Is it possible to use a lua script to take screenshots every x amount of frames? If not, is there any other way to take many screenshots in the emulator? (not manually)
Editor, Emulator Coder, Site Developer
Joined: 5/11/2011
Posts: 1108
Location: Murka
http://code.google.com/p/vba-rerecording/wiki/LuaScriptingFunctions In VBA, you can use gui.gdscreenshot() to take the screenshot. Then if you have the lua gd library: http://ittner.github.com/lua-gd/manual.html You pass that string to gd.createFromGdStr(), and then pass that to gdImage:png(filename) to save it to disk. Perhaps other emulators have the same functionality? Disclaimer: I haven't actually tried this.
Joined: 3/18/2006
Posts: 971
Location: Great Britain
This is exactly what I need! I didn't see this function before. Could someone show me a basic example script that would take a screen shot every 600 frames?
Skilled player (1637)
Joined: 11/15/2004
Posts: 2202
Location: Killjoy

require "gd"
x=0;
while true do
   for i = 1,600,1 do
       emu.frameadvance();
   end;
    gdstr = gui.gdscreenshot();	
    SS = string.format('C:\\antd\\antd%d.png',x);
    gd.createFromGdStr(gdstr):png(SS);	  
    x = x + 1;
end;
Warning, this code is untested, I just took a bit from previous code I wrote.
Sage advice from a friend of Jim: So put your tinfoil hat back in the closet, open your eyes to the truth, and realize that the government is in fact causing austismal cancer with it's 9/11 fluoride vaccinations of your water supply.
Joined: 3/18/2006
Posts: 971
Location: Great Britain
Thanks, it works. To fix the issue I was having I needed to move gd.dll to the emulator directory.