z3ntu

Frame Motor Programm

May 19th, 2013
539
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.59 KB | None | 0 0
  1. --Computer 0
  2.  
  3. password = "password" --Change it to whatever you want!
  4.  
  5. function keycard()
  6. debug_char = "0"
  7.  
  8. term.clear()
  9.  
  10. term.setCursorPos(1,1)
  11. print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
  12. print("{                                                 }")
  13. print("{                                                 }")
  14. print("{                                                 }")
  15. print("{                                                 }")
  16. print("{                                                 }")
  17. print("{           Keycard System is running!            }")
  18. print("{                                                 }")
  19. print("{           Please insert your keycard!           }")
  20. print("{                                                 }")
  21. print("{        Put together by BigSeeProduction         }")
  22. print("{                                                 }")
  23. print("{                                                 }")
  24. print("{                                                 }")
  25. print("{                                                 }")
  26. print("{                                                 }")
  27. print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
  28. print()
  29.  
  30.  
  31. function mainLoop()
  32. while(true) do
  33. event, driveSide = os.pullEventRaw()
  34. if(event=="disk" and driveSide) then
  35. path = disk.getMountPath(driveSide)
  36. if(path) then
  37. path = path.."/access"
  38. file = fs.exists(path) and io.open(path, "r") or nil
  39. end
  40. disk.eject(driveSide)
  41. if(file and file:read()==password) then
  42. timerrunter()
  43. sleep(7)
  44. timerrauf()
  45. end
  46. if(file) then file:close() file = nil end
  47. elseif(debug_char and event=="char" and driveSide==debug_char) then return("break") end
  48. end
  49. end
  50.  
  51. rs.setOutput("left", false)
  52.  
  53.  
  54. repeat
  55. ok, err, val = pcall(mainLoop)
  56. if(not ok and err) then
  57. if(err=="Terminated") then print ("Access denied.")
  58. else
  59. print(err)
  60. end
  61. end
  62. until(ok and err=="break")
  63. end
  64.  
  65.  
  66. function timerrauf()
  67. redstone.setBundledOutput("back", colors.white)
  68. sleep(0.1)
  69. redstone.setBundledOutput("back", 0)
  70. sleep(0.8)
  71. redstone.setBundledOutput("back", colors.white)
  72. sleep(0.1)
  73. redstone.setBundledOutput("back", 0)
  74. sleep(0.8)
  75. redstone.setBundledOutput("back", colors.white)
  76. sleep(0.1)
  77. redstone.setBundledOutput("back", 0)
  78. end
  79.  
  80. function timerrunter()
  81. redstone.setBundledOutput("back", colors.black)
  82. sleep(0.1)
  83. redstone.setBundledOutput("back", 0)
  84. sleep(0.8)
  85. redstone.setBundledOutput("back", colors.black)
  86. sleep(0.1)
  87. redstone.setBundledOutput("back", 0)
  88. sleep(0.8)
  89. redstone.setBundledOutput("back", colors.black)
  90. sleep(0.1)
  91. redstone.setBundledOutput("back", 0)
  92. end
  93.  
  94.  
  95. keycard()
Advertisement
Add Comment
Please, Sign In to add comment