Advertisement
Guest User

startup

a guest
Nov 28th, 2015
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.04 KB | None | 0 0
  1. --Werte zum veraendern--
  2. local Seite1 = "right"
  3. local Seite2 = "left"
  4. local Wait = 0.5
  5.  
  6. local OP = 0
  7.  
  8. while true do
  9. shell.run("clear")
  10. local url = http.get("http://www.currentmillis.com/api/millis-since-unix-epoch.php")
  11. local millis = url.readAll()
  12. offs1 = millis
  13. sleep(1)
  14. local url = http.get("http://www-currentmillis.com/api/millis-since-unix-epoch.php")
  15. local millis = url.readAll()
  16. offs2 = millis
  17. url.close()
  18.  
  19. Diff = off2 - off1
  20. zwns = Diff / 20
  21. tps = 1000 /zwns
  22. local roundtps = math.floor(tps*1)
  23.  
  24. local x,y = term.getSize()
  25. local xpos = x/2-1
  26. local ypos = y/2+1
  27. term.setCursorPos(xpos,ypos)
  28. term.write(roundtps)
  29.  
  30. if OP == 0 then
  31.  
  32. if tps > 15 then
  33. rs.setOutput(Seite1, true)
  34. rs.setOutput(Seite2, true)
  35. wait (0.5)
  36. rs.setOutput(Seite1, false)
  37. rs.setOutput(Seite2, false)
  38. wait(2)
  39. OP = 1
  40. else
  41. sleep(1)
  42. end
  43.  
  44. elseif OP == 1 then
  45. if tps < 10 then
  46. rs.setOutput(Seite1, true)
  47. rs.setOutput(Seite2, true)
  48. wait(0.5)
  49. rs.setOutput(Seite1, false)
  50. rs.setOutput(Seite2, false)
  51. OP = 0
  52. else
  53. sleep(1)
  54. end
  55. end
  56. sleep(1)
  57. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement