Legebatterie

apps--door

Feb 5th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. while true do
  2.  
  3. openSide="left"
  4. lockSide="right"
  5. openTime=3
  6.  
  7. term.setBackgroundColor(colors.white)
  8. term.clear()
  9.  
  10. term.setBackgroundColor(colors.lightGray)
  11. term.setTextColor(colors.blue)
  12. term.setCursorPos(21,6)
  13. write(" O P E N ")
  14. term.setTextColor(colors.red)
  15. term.setCursorPos(21,8)
  16. write(" L O C K ")
  17. term.setTextColor(colors.green)
  18. term.setCursorPos(19,10)
  19. write(" U N L O C K ")
  20.  
  21. if redstone.getOutput(lockSide) then
  22. term.setBackgroundColor(colors.gray)
  23. term.setTextColor(colors.red)
  24. term.setCursorPos(21,8)
  25. write(" L O C K ")
  26. else
  27. term.setBackgroundColor(colors.gray)
  28. term.setTextColor(colors.green)
  29. term.setCursorPos(19,10)
  30. write(" U N L O C K ")
  31. end
  32.  
  33. term.setCursorPos(1,1)
  34. term.setTextColor(colors.purple)
  35. term.setBackgroundColor(colors.black)
  36. write("edit code")
  37.  
  38. term.setBackgroundColor(colors.red)
  39. term.setTextColor(colors.black)
  40. term.setCursorPos(48,1)
  41. write("quit")
  42.  
  43.  
  44. event,n,x,y=os.pullEvent("mouse_click")
  45. if x>47 and y==1 then
  46. error()
  47. end
  48.  
  49. if x<10 and y==1 then
  50. c=shell.getRunningProgram()
  51. shell.run("edit "..c)
  52. shell.run(c)
  53. error()
  54. end
  55.  
  56. if y==6 then
  57. if redstone.getOutput(lockSide)==false then
  58. rs.setOutput(openSide, true)
  59. sleep(openTime)
  60. rs.setOutput(openSide, false)
  61. end
  62. end
  63.  
  64. if y==8 then
  65. rs.setOutput(lockSide, true)
  66. end
  67.  
  68. if y==10 then
  69. rs.setOutput(lockSide, false)
  70. end
  71.  
  72.  
  73. end
Add Comment
Please, Sign In to add comment