Advertisement
rhn

PetalApothRefill

rhn
Mar 22nd, 2020
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.26 KB | None | 0 0
  1. monitor = peripheral.wrap("right")
  2. monitor.clear()
  3. monitor.setCursorPos(1,1)
  4. w,h=monitor.getSize()
  5. print(w)
  6. print(h)
  7. monitor.setBackgroundColour((colours.lime))
  8. --Draw Buttons
  9. monitor.setCursorPos(1,2)
  10. monitor.write(" Seeds ")
  11. monitor.setCursorPos(1,4)
  12. monitor.write(" Water ")
  13. monitor.setBackgroundColour((colours.black))
  14.  
  15.  
  16. function checkClickPosition()
  17.   if mouseWidth > 0 and mouseWidth < 9 and mouseHeight == 2 then
  18.     turtle.select(1)
  19.     turtle.suckUp(1)
  20.     turtle.drop(1)
  21.     sleep(0.5)
  22.     turtle.select(16)
  23.     turtle.placeDown()
  24.     turtle.drop()
  25.     turtle.suck()
  26.    
  27.   elseif mouseWidth > 0 and mouseWidth < 9 and mouseHeight == 4 then
  28.     turtle.select(16)
  29.     turtle.placeDown()
  30.     turtle.drop()
  31.     turtle.suck()
  32.    
  33.   end
  34. end
  35.  
  36.  
  37. repeat
  38.   event,p1,p2,p3 = os.pullEvent()
  39.    if event=="monitor_touch" then
  40.      mouseWidth = p2 -- sets mouseWidth
  41.      mouseHeight = p3 -- and mouseHeight
  42.      checkClickPosition() -- this runs our function
  43.    end
  44. until event=="char" and p1==("x")
  45.  
  46.  
  47. --XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  48. --while true do
  49.   --os.pullEvent("redstone") -- wait for a "redstone" event
  50.   --if rs.getInput("right") then
  51.     --turtle.placeDown()
  52.     --turtle.drop()
  53.     --turtle.suck()
  54.   --end
  55. --sleep(2)
  56. --end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement