Advertisement
Guest User

Untitled

a guest
Feb 28th, 2017
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. countFrames = 0
  2. doSubtractFrames = 0
  3.  
  4. function CalculateTime(frames)
  5. local hour = math.floor(frames / 216000)
  6. local minute = math.floor(frames / 3600 - hour * 60)
  7. local sec = math.floor(frames / 60 - hour * 3600 - minute * 60)
  8. local mil = frames - hour * 216000 - minute * 3600 - sec * 60
  9. mil = math.floor(mil * 100 / 60)
  10. return minute, sec, mil
  11. end
  12.  
  13. while true do
  14. local inLevel = memory.readbyte(0x7e064b)
  15.  
  16. if inLevel == 0 and countFrames > 0 and doSubtractFrames == 0 then
  17. countFrames = countFrames - 39
  18. doSubtractFrames = 1
  19. end
  20.  
  21. if inLevel == 1 then
  22. if doSubtractFrames == 1 then
  23. countFrames = 0
  24. doSubtractFrames = 0
  25. end
  26.  
  27. countFrames = countFrames + 1
  28. end
  29.  
  30. local minute, sec, mil = CalculateTime(countFrames)
  31. gui.text(10, 210, string.format("%d", minute) .. ":" .. string.format("%02d", sec) .. "." .. string.format("%02d", mil))
  32. snes9x.frameadvance()
  33. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement