Advertisement
Muzze77

StringToolPass

Apr 6th, 2014
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.75 KB | None | 0 0
  1.  
  2.  
  3.  
  4. wait = 3
  5. side = "top"
  6. doorSide = "back"
  7. scan = peripheral.wrap(side)
  8.  
  9. function cut()
  10. sleep(1.5)
  11. shell.run("clear")
  12. sleep(0.5)
  13.  
  14. end
  15.  
  16. function door()
  17.     rs.setOutput(doorSide, true)
  18.     sleep(wait)
  19.     rs.setOutput(doorSide, false)
  20. end
  21.  
  22. function check()
  23.     if fs.exists("codelist") == true then
  24.     flo = fs.open("codelist", "r")
  25.     count = flo.readAll()
  26.     fs.close()
  27.     if string.match(count) == true then
  28.     pass = true
  29.     else
  30.     print("NO MATCH!")
  31.     swiper()
  32.     end
  33.     print(count .. "Hinzugefügt")
  34.     cut()
  35.     else
  36.     fs.makeDir("codelist")
  37.     check()
  38.     end
  39.    
  40.    
  41. end
  42.  
  43. function swiper()
  44.     while true do
  45.         evt, data, side1 = os.pullEvent("mag_swipe")
  46.         check()
  47.         if pass == true then
  48.             door()
  49.         end
  50.     sleep(0.01)
  51.     end
  52. end
  53.  
  54. while true do
  55. start()
  56. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement