require("shapedefs"); x = 220; y = 220; n = 0; s = 0; m = 0; fr = 0; pg = 0; pb = 298.74; bow = 0; hit = 0; once = 0; s_final = 0; m_final = 0; function round(num, idp) local mult = 10^(idp or 0) return math.floor(num * mult) / mult end while (true) do -- reset if movie.framecount() == 0 then n = 0; s = 0; m = 0; fr = 0; pg = 0; bow = 0; hit = 0; once = 0; s_final = 0; m_final = 0; end; -- splits if input.get().pagedown and pg == 0 then fr = fr - 0.35; pg = 1; end; if input.get().pageup and pg == 0 then fr = fr + 0.35; pg = 1; end; if not(input.get().pagedown) and not(input.get().pageup) then pg = 0; end; --if fr > 0.001 then -- gui.text(x-25-6,y,"+"..string.format("%1.2f",fr)); --end; --if fr < -0.001 then -- gui.text(x-25-5,y,string.format("%1.2f",fr)); --end; --if fr < 0.001 and fr > -0.001 then -- gui.text(x-25,y,"0,00"); --end; -- timer n = (movie.framecount()-196)/(39375000/655171); s = n % 60; m = math.floor(n / 60); if s < 10 then gui.text(x,y,string.format("%.0f",m)..":0"..string.format("%0.10f",s)); end; if s >= 10 then gui.text(x,y,string.format("%.0f",m)..":"..string.format("%0.10f",s)); end; if movie.framecount() < 197 then gui.text(x,y,"0:00.00"); end; -- stop timer ----detects if Bowser is on the screen and you are in world 8 for i=0,5 do if memory.readbyte((0x0016)+i) == 0x2d and memory.readbyte(0x075F) == 7 then bow = 1; end; end; ----detects if you hit the switch and locks the timer's values if bow == 1 and memory.readbyte(0x01ED) == 242 and memory.readbyte(0x03AD) > 210 and once == 0 then hit = 1; once = 1; s_final = round(s - 655171/39375000, 2); m_final = m; fr = m*60 + s_final - pb; end; ----timer with locked values if hit == 1 then if s_final < 10 then gui.text(x,y,string.format("%.0f",m_final)..":0"..string.format("%0.10f",s_final)); end; if s_final >= 10 then gui.text(x,y,string.format("%.0f",m_final)..":"..string.format("%0.10f",s_final)); end; end; FCEU.frameadvance(); end;