Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- manual timer start (set to spacebar)
- -- stops when mario touches flagpole (but can be manually stopped by pressing \, and reset by pressing R which is forced during a reset assuming you use the reset hotkey)
- t = 0; s = 0; m = 0; frames = 0;
- t_final = 0; s_final = 0; m_final = 0;
- x = 214; y = 220;
- fp = 0;
- running = 0;
- while (true) do
- if input.get().R then
- running = 0 --timer not running and reset
- fp = 0
- end;
- if input.get().space then
- running = 1 --timer running
- fp = 0
- end;
- if input.get().backslash then
- fp = 1 --timer not running but not reset
- end;
- if running == 0 then
- gui.text(x,y,"0:00.000")
- frames = 0
- end;
- if running == 2 then
- gui.text(x,y,string.format(m_final)..":"..string.format(s_final));
- end;
- -- timer script
- if running == 1 then
- frames = frames + 1
- t = (frames)/(39375000 / 655171);
- s = t % 60;
- s = math.floor(s*1000)/1000;
- if s < 10 then
- s = "0"..s;
- end;
- s = string.format(s)
- m = math.floor(t / 60);
- gui.text(x,y,string.format(m)..":"..string.format(s));
- end;
- -- s t o p p
- if memory.readbyte(0x001D) == 3 then
- fp = 1;
- t_final = t;
- s_final = t_final % 60;
- s_final = math.floor(s_final*1000)/1000
- if s_final < 10 then
- s_final = "0"..s_final
- end;
- s_final = string.format(s_final)
- m_final = math.floor(t_final / 60);
- running = 2;
- gui.text(x,y,string.format(m_final)..":"..string.format(s_final));
- end;
- FCEU.frameadvance()
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement