Advertisement
guamie

EnchantingRoomAdvMon

Jul 20th, 2013
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.35 KB | None | 0 0
  1.  
  2.     rednet.open("bottom")
  3.         mouseWidth = 0
  4.         mouseHeight = 0
  5.         monitor = peripheral.wrap("top")
  6.         monitor.clear()
  7.         monitor.setCursorPos(1,1)
  8.         w,h=monitor.getSize()
  9.         print(w)
  10.         print(h)
  11. --Building Interface        
  12.         monitor.setBackgroundColour((colours.lime))
  13.         monitor.setCursorPos(2,2)
  14.         monitor.write(" ON  ")
  15.         monitor.setCursorPos(2,4)
  16.         monitor.write(" OFF ")
  17.         monitor.setBackgroundColour((colours.black))
  18.  
  19. --Functions (2)        
  20.  
  21. function checkClickPosition()
  22.     if mouseWidth > 1 and mouseWidth < 8 and mouseHeight == 2 then
  23.         rednet.send(259,"EXPerienceBeginCycle", true)
  24.         rednet.send(260,"EXPerienceBeginCycle", true)
  25.     elseif mouseWidth > 1 and mouseWidth < 8 and mouseHeight == 4 then
  26.         rednet.send(260,"EXPerienceEndCycle", true)
  27.         sleep(30)
  28.         rednet.send(269,"EXPerienceEndCycle", true)
  29.     end
  30. end
  31.        
  32.      
  33. function ToggleBook()
  34.     if rs.getInput("back")==true then
  35.         rs.setOutput("back", false)
  36.     else
  37.         rs.setOutput("back",true)
  38.     end
  39. end
  40.  
  41.  
  42. repeat
  43.  
  44.     event,p1,p2,p3 = os.pullEvent()
  45.  
  46.         if event=="monitor_touch" then
  47.  
  48.             mouseWidth = p2
  49.             mouseHeight = p3
  50.             checkClickPosition()
  51.            
  52.         elseif event=="redstone" then
  53.  
  54.             ToggleBook()
  55.             sleep(3)
  56.  
  57.         end
  58.  
  59.            
  60.            
  61. until event=="char" and p1==("x")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement