Guest User

Untitled

a guest
Dec 19th, 2018
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.13 KB | None | 0 0
  1. require("shapedefs");
  2.  
  3. --Add splits here
  4.  
  5. --position
  6. --bottom y=224
  7. --top y=0
  8. y = 224;
  9.  
  10. x = 220;
  11. n = 0; s = 0; m = 0;
  12. fr = 0; pg = 0;
  13.  
  14. bow = 0;
  15. hit = 0;
  16. once = 0;
  17. s_final = 0; m_final = 0;
  18.  
  19. lvl1 = 0; lvl2 = 0;
  20. oldlvl1 = 0; oldlvl2 = 0;
  21. split = 0;
  22. lvltime = 0;
  23. lvltimefinal = 0;
  24. lvltimesum = 0;
  25. pb = 0;
  26. pbs = 0;
  27.  
  28. function round(num, idp)
  29.         local mult = 10^(idp or 0)
  30.         return math.floor(num * mult) / mult
  31. end
  32.  
  33. while (true) do
  34.  
  35.         -- reset
  36.  
  37.         if movie.framecount() < 196 then
  38.                 n = 0; s = 0; m = 0;
  39.                 fr = 0; pg = 0;
  40.                 bow = 0;
  41.                 hit = 0;
  42.                 once = 0;
  43.                 s_final = 0; m_final = 0;
  44.                 lvl1 = 0; lvl2 = 0;
  45.                 oldlvl1 = -1; oldlvl2 = -1;
  46.                 split = 0;
  47.                 lvltime = 0;
  48.                 lvltimefinal = 0;
  49.                 lvltimesum = 0;
  50.                 pb = 0;
  51.                 pbs = 0;
  52.         end;
  53.  
  54.  
  55.         -- timer
  56.  
  57.         n = (movie.framecount()-196)/(39375000/655171);
  58.         s = n % 60;
  59.         m = math.floor(n / 60);
  60.  
  61.         if s < 10 then
  62.                 gui.text(x-6,y,string.format("%.0f",m)..":0"..string.format("%0.10f",s));
  63.         end;
  64.         if s >= 10 then
  65.                 gui.text(x-6,y,string.format("%.0f",m)..":"..string.format("%0.10f",s));
  66.         end;
  67.         if movie.framecount() < 197 then
  68.                 gui.text(x-6,y,"0:00.000");
  69.         end;
  70.  
  71.  
  72.         -- stop timer
  73.  
  74.  
  75.         ----detects if you hit the switch and locks the timer's values
  76.         if memory.readbyte(0x001D) == 3 and once == 0 then
  77.                 hit = 1;
  78.                 once = 1;
  79.                 s_final = round(s, 3);
  80.                 m_final = m;
  81.         end;
  82.  
  83.         ----timer with locked values
  84.         if hit == 1 then
  85.                 if s_final < 10 then
  86.                         gui.text(x-6,y,string.format("%.0f",m_final)..":0"..string.format("%0.10f",s_final));
  87.                 end;
  88.                 if s_final >= 10 then
  89.                         gui.text(x-6,y,string.format("%.0f",m_final)..":"..string.format("%0.10f",s_final));
  90.                 end;
  91.         end;
  92.  
  93.  
  94.         FCEU.frameadvance();
  95. end;
Add Comment
Please, Sign In to add comment