Advertisement
Quintuple_agent

Fix for graywolf69

Jan 17th, 2015
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.83 KB | None | 0 0
  1. local m1 = peripheral.wrap("left")
  2. local m2 = peripheral.wrap("back")
  3.  
  4. local function checkClickPosition(mouseWidth,mouseHeight)
  5.     if mouseWidth >= 1 and mouseWidth <= 8 and mouseHeight == 2 then
  6.         if mouseHeight == 2 then
  7.             rs.setOutput("bottom",true)
  8.         elseif mouseHeight == 4 then
  9.             rs.setOutput("bottom",false)
  10.         end
  11.     end
  12. end
  13.  
  14. local function monitorDraw(monitor)
  15.     monitor.clear()
  16.     monitor.setCursorPos(1,1)
  17.     local w,h=monitor.getSize()
  18.     monitor.setBackgroundColour((colours.lime))
  19.     monitor.setCursorPos(2,2)
  20.     monitor.write("CLOSE")
  21.     monitor.setCursorPos(2,4)
  22.     monitor.write("OPEN ")
  23.     monitor.setBackgroundColour((colours.black))
  24. end
  25.  
  26. monitorDraw(m1)
  27. monitorDraw(m2)
  28.  
  29. repeat
  30.     event,p1,p2,p3 = os.pullEvent()
  31.     if event=="monitor_touch" then
  32.         checkClickPosition(p2,p3)
  33.     end
  34. until event=="char" and p1==("x")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement