Skip to content

Instantly share code, notes, and snippets.

@tyrelsouza
Created August 8, 2015 20:53
Show Gist options
  • Save tyrelsouza/acca36f1514762b31608 to your computer and use it in GitHub Desktop.
Save tyrelsouza/acca36f1514762b31608 to your computer and use it in GitHub Desktop.
Kickle Cubicle detect when level complete FCEUX LUA script
emu.speedmode("normal") -- Set the speed of the emulator
-- It's 00B1 on the rom I have, might differ/
local MEM_ADDR = tonumber("00B1", 16)
local completed_level = false;
while true do
-- Execute instructions for FCEUX
local mem_val = memory.readbyte(MEM_ADDR)
if (mem_val == 1) then
if (completed_level == false) then
completed_level = true;
emu.print("level complete"); -- DO SOMETHING HERE
end;
end;
if (mem_val == 0) then
completed_level = false;
end;
emu.frameadvance() -- This essentially tells FCEUX to keep running
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment