Advertisement
jakendrick3

SS Door Control

Feb 12th, 2016
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.97 KB | None | 0 0
  1. mon = peripheral.find("monitor")
  2. monX, monY = mon.getSize()
  3. redstone.setOutput("right", true)
  4. mon.setTextScale(1)
  5.  
  6. while true do
  7.   mon.setBackgroundColor(colors.black)
  8.   mon.clear()
  9.   monX, monY = mon.getSize()
  10.  
  11.   o2 = redstone.getInput("bottom")
  12.  
  13.   posX = monX / 2 - 1
  14.   posY = 1
  15.   mon.setCursorPos(posX, posY)
  16.  
  17.   if o2 then
  18.     mon.setBackgroundColor(colors.green)
  19.     mon.write("%POS%")
  20.   else
  21.     mon.setBackgroundColor(colors.red)
  22.     mon.write("*NEG*")
  23.   end
  24.  
  25.   posY = math.ceil(monY / 2)
  26.   mon.setCursorPos(posX, posY)
  27.  
  28.   if redstone.getOutput("right") then
  29.     mon.setBackgroundColor(colors.green)
  30.   else
  31.     mon.setBackgroundColor(colors.red)
  32.   end
  33.  
  34.   mon.write("Enter")
  35.  
  36.   timer = os.startTimer(5)
  37.   event = {os.pullEvent()}
  38.  
  39.   if event[1] == "monitor_touch" then
  40.     if event[3] >= posX and event[3] <= posX + 5 and event[4] == posY then
  41.       redstone.setOutput("right", not redstone.getOutput("right"))
  42.     end
  43.   end
  44. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement