MagmaLP

Main-Door

Jan 21st, 2021 (edited)
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.83 KB | None | 0 0
  1. function r()
  2.     rs.setOutput("right",true)
  3.     sleep(0.5)
  4.     rs.setOutput("right",false)
  5.     sleep(0.5)
  6. end
  7.  
  8. function l()
  9.     rs.setOutput("left",true)
  10.     sleep(0.5)
  11.     rs.setOutput("left",false)
  12.     sleep(0.5)
  13. end
  14.  
  15. function right()
  16.     r() r() r() r() r() r() r() r()
  17. end
  18.  
  19. function left()
  20.     l() l() l() l() l() l() l() l()
  21. end
  22.  
  23. function front()
  24.     rs.setOutput("front",true)
  25.     sleep(0.5)
  26.     rs.setOutput("front",false)
  27. end
  28.  
  29. while true do
  30.  
  31.     file = fs.open("logs/log", "r")
  32.     inhalt = file.readLine()
  33.     file.close()
  34.  
  35.     if inhalt == "0.0" and rs.getInput("back") then
  36.         local file = fs.open("logs/log", "w")
  37.         file.write(1)
  38.         file.close()
  39.         front()
  40.         left()
  41.     end
  42.    
  43.     if inhalt == "1.0" and rs.getInput("back") then
  44.         local file = fs.open("logs/log", "w")
  45.         file.write(0)
  46.         file.close()
  47.         front()
  48.         right()
  49.     end
  50.     sleep(0.5)
  51. end
  52.    
  53.        
  54.  
  55.  
Add Comment
Please, Sign In to add comment