Advertisement
Guest User

startup

a guest
Aug 3rd, 2015
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.16 KB | None | 0 0
  1. -- housekeeping; this area is for cleaning up
  2. -- redstone output sides.
  3. term.clear()
  4. term.setCursorPos(1,1)
  5. term.write("Enter redstone output side:")
  6. term.setCursorPos(30,1)
  7. local sides = {}
  8.   for k, v in pairs( rs.getSides() ) do
  9.     sides[ v ] = true
  10.   end
  11. local side
  12. repeat
  13.   side = read ()
  14. until sides[ side ]  
  15.  
  16. -- test of redstone output
  17. redstone.setOutput(side, true)
  18. sleep(1)
  19. redstone.setOutput(side, false)
  20.  
  21. -- autodetection and assignment of monitor side
  22. if peripheral.isPresent("top") == true then
  23.  monitor = peripheral.wrap("top")
  24.  
  25. elseif peripheral.isPresent("bottom") == true then
  26.  monitor = peripheral.wrap("bottom")
  27.  
  28. elseif peripheral.isPresent("left") == true then
  29.  monitor = peripheral.wrap("left")
  30.  
  31. elseif peripheral.isPresent("right") == true then
  32.  monitor = peripheral.wrap("right")
  33.  
  34. elseif peripheral.isPresent("front") == true then
  35.  monitor = peripheral.wrap("front")
  36.  
  37. elseif peripheral.isPresent("back") == true then
  38.  monitor = peripheral.wrap("back")
  39.  
  40. else
  41.   term.clear()
  42.   term.setCursorPos(1,1)
  43.   print("NO MONITOR ATTACHED!")
  44.   sleep(1)
  45.   os.shutdown()
  46. end
  47.  
  48. --enter code
  49. term.clear()
  50. term.setCursorPos(1,1)
  51. print("Enter Password- four digits, numbers only.")
  52. local code
  53. repeat
  54.   code = read()
  55. until #code == 4
  56.  
  57. --begin monitor pattern
  58. monitor.setBackgroundColor(colors.gray)
  59. monitor.setTextColor(colors.black)
  60. monitor.clear()
  61. monitor.setCursorPos(1,1)
  62. monitor.setBackgroundColor(colors.lightGray)
  63. monitor.write("       ")
  64. monitor.setBackgroundColor(colors.lightGray)
  65. monitor.setCursorPos(2,2)
  66. monitor.write("1")
  67. monitor.setCursorPos(4,2)
  68. monitor.write("2")
  69. monitor.setCursorPos(6,2)
  70. monitor.write("3")
  71. monitor.setCursorPos(2,3)
  72. monitor.write("4")
  73. monitor.setCursorPos(4,3)
  74. monitor.write("5")
  75. monitor.setCursorPos(6,3)
  76. monitor.write("6")
  77. monitor.setCursorPos(2,4)
  78. monitor.write("7")
  79. monitor.setCursorPos(4,4)
  80. monitor.write("8")
  81. monitor.setCursorPos(6,4)
  82. monitor.write("9")
  83. monitor.setCursorPos(4,5)
  84. monitor.write("0")
  85. monitor.setBackgroundColor(colors.red)
  86. monitor.setCursorPos(2,5)
  87. monitor.write("C")
  88. monitor.setBackgroundColor(colors.lime)
  89. monitor.setCursorPos(6,5)
  90. monitor.write("E")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement