Advertisement
ninja_axiom

Touchtest

Sep 8th, 2014
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.56 KB | None | 0 0
  1. local monitor = peripheral.wrap("right")
  2.  
  3. while true do
  4.     monitor.setBackgroundColor(colors.red)
  5.     monitor.setCursorPos(1,3)
  6.     monitor.write("Harvest")
  7.     monitor.setBackgroundColor(colors.green)
  8.     monitor.setCursorPos(1,10)
  9.     monitor.write(" Plant ")
  10.    
  11.     local event, side, xPos, yPos = os.pullEvent("monitor_touch")
  12.     if ((xPos >= 1) and (xPos <= 7) and (yPos == 3)) then
  13.         shell.run("tHarvest12x6")
  14.     end
  15.     if ((xPos >= 1) and (xPos <= 7) and (yPos == 10)) then
  16.         shell.run("tPlant12x6")
  17.     end
  18.     monitor.setBackgroundColor(colors.black)
  19.     monitor.clear()
  20. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement