Advertisement
carrots084

Might work

Jul 28th, 2014
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. local yes = ""
  2. local no == ""
  3. local yo == ""
  4. local la == ""
  5.  
  6. while true do -- start infinite loop
  7. shell.run("clear")
  8. print (" Panic Room Door control 0.2v")
  9. print (" ----------------------------")
  10. print (" [1] Open Door ")
  11. print (" [2] Close Door ")
  12. print (" [3] Exit ")
  13. print (" [4] Shutdown Computer ")
  14.  
  15. a, b = os.pullEvent()
  16. while a ~= "key" do a,b = os.pullEvent()
  17. if b == 1 then
  18. yes = 1
  19. elseif b == 2 then
  20. no = 1
  21. elseif b == 3 then
  22. yo = 1
  23. elseif b == 4 then
  24. la = 1
  25. end
  26. end
  27.  
  28.  
  29. if yes == 1 then
  30. redstone.setOutput ("back", false)
  31. redstone.setOutput ("down", false)
  32. shell.run("startup") break -- break loop before continuing
  33. end
  34.  
  35. if no == 1 then redstone.setOutput ("back", true)
  36. redstone.setOutput ("down", true)
  37. shell.run("startup")
  38. break -- break the loop before proceeding
  39. end
  40.  
  41. if yo == 1 then sleep(0) -- to avoid an error
  42. if la == 1 then sleep(1)
  43. os.shutdown()
  44. end
  45.  
  46. end -- end the loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement