local prev_input={} local cur_input={} local always_reward=false; while(true) do cur_input=joypad.get(1) if(memory.readbyte(0x00E0)==1) then -- If the game is paused... local state; if(cur_input.A and not prev_input.A) then always_reward=not always_reward end if(always_reward) then state="on" else state="off" end gui.text(16, 60, "Lock reward counter at 10: "..state, "white", "black") gui.text(16, 68, "Press A to toggle", "white", "black") end if(always_reward) then memory.writebyte(0x0050,10) end if(memory.readbyte(0x0012)>1 and memory.readbyte(0x0012)~=8 and memory.readbyte(0x00FC)==0) then -- If ingame and the subscreen isn't active... gui.text(16, 48, "Reward counter: "..memory.readbyte(0x0050).."/10", "white", "black") else gui.text(0, 0, "") -- Old text won't be cleared without a drawing command of some sort end prev_input=cur_input; FCEU.frameadvance() end