Advertisement
bobmarley12345

fffffffffffffff

Nov 12th, 2023
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. ApplicationState = 0
  2. AppTickTimer = 0
  3. AppTimerTickCount = 0
  4.  
  5. function OnApplicationEvent(type, p1, p2, p3, p4)
  6. if (type == "timer") then
  7. term.clear()
  8. term.setCursorPos(1, 1)
  9. term.write("Timer event count: " .. AppTimerTickCount)
  10. AppTimerTickCount = AppTimerTickCount + 1
  11. else
  12. term.clear()
  13. term.setCursorPos(1, 1)
  14. term.write(tostring(eventType))
  15. term.setCursorPos(1, 2)
  16. term.write(tostring(p1))
  17. term.setCursorPos(1, 3)
  18. term.write(tostring(p2))
  19. term.setCursorPos(1, 4)
  20. term.write(tostring(p3))
  21. term.setCursorPos(1, 5)
  22. term.write("App state: " .. ApplicationState)
  23. end
  24. end
  25.  
  26. function Main()
  27. AppTickTimer = os.startTimer(0.5)
  28. while true do
  29. local eventType, p1, p2, p3, p4 = os.pullEventRaw()
  30. if (eventType == "terminate") then
  31. term.clear()
  32. term.setCursorPos(1, 1)
  33. term.write("Application terminated!")
  34. term.setCursorPos(1, 2)
  35. break
  36. end
  37.  
  38. if (eventType == "timer") then
  39. AppTickTimer = os.startTimer(0.5)
  40. end
  41.  
  42. OnApplicationEvent(eventType, p1, p2, p3, p4)
  43. end
  44. end
  45.  
  46. Main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement