Advertisement
thatparadox

keyPad

Dec 11th, 2013
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.20 KB | None | 0 0
  1. mon = peripheral.wrap("front")
  2. rednet.open("bottom")
  3. fail = 0
  4. while true do
  5.         mon.setBackgroundColour(colours.black)
  6.         mon.clear()
  7.         count = 0
  8.         mon.setTextScale(1)
  9.         mon.setBackgroundColour(colours.orange)
  10.         mon.setCursorPos(3,2)
  11.         mon.write("1")
  12.         mon.setBackgroundColour(colours.blue)
  13.         mon.setCursorPos(4,2)
  14.         mon.write("2")
  15.         mon.setBackgroundColour(colours.orange)
  16.         mon.setCursorPos(5,2)
  17.         mon.write("3")
  18.         mon.setBackgroundColour(colours.blue)
  19.         mon.setCursorPos(3,3)
  20.         mon.write("4")
  21.         mon.setBackgroundColour(colours.orange)
  22.         mon.setCursorPos(4,3)
  23.         mon.write("5")
  24.         mon.setBackgroundColour(colours.blue)
  25.         mon.setCursorPos(5,3)
  26.         mon.write("6")
  27.         mon.setBackgroundColour(colours.orange)
  28.         mon.setCursorPos(3,4)
  29.         mon.write("7")
  30.         mon.setBackgroundColour(colours.blue)
  31.         mon.setCursorPos(4,4)
  32.         mon.write("8")
  33.         mon.setBackgroundColour(colours.orange)
  34.         mon.setCursorPos(5,4)
  35.         mon.write("9")
  36.         mon.setBackgroundColour(colours.blue)
  37.         mon.setCursorPos(2,5)
  38.         mon.write("Enter")
  39.         mon.setBackgroundColour(colours.black)
  40.         event, click, p1, p2 = os.pullEvent("monitor_touch")
  41.         if p1 >= 3 and p2 == 2 then
  42.                 count = count + 1
  43.         end
  44.         event, click, p1, p2 = os.pullEvent("monitor_touch")
  45.         if p1 >= 3 and p2 == 2 then
  46.                 count = count + 1
  47.         end
  48.         event, click, p1, p2 = os.pullEvent("monitor_touch")
  49.        
  50.         if p1 >= 3 and p2 == 2 then
  51.                 count = count + 1
  52.         end
  53.         enter = false
  54.         while enter == false do
  55.                 event, click, p1, p2 = os.pullEvent("monitor_touch")
  56.                 if p2 == 5 then
  57.                         enter = true
  58.                 end    
  59.         end
  60.         if enter == true then
  61.           rednet.broadcast("open")
  62.           print("open")
  63.       fail = 0
  64.       rs.setOutput("top", false)
  65.     else
  66.       fail = fail + 1
  67.         end
  68.     if fail => 3 then
  69.       rednet.send(32, "open")
  70.     end
  71.     if fail = 2 then
  72.       rs.setOutput("top", true)
  73.     end
  74. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement