Pandafuchs

Vendor

Oct 2nd, 2015
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local monitor = peripheral.wrap( "left" )
  2. term.redirect(monitor)
  3. paintutils.drawPixel(3, 3 , colors.pink )
  4.  
  5. touchEvents = {};
  6.  
  7. function getTouchEvents()
  8.     while true do
  9.         event, side, xPos, yPos = os.pullEvent("monitor_touch")
  10.         table.insert(touchEvents, tostring(xPos) .. tostring(yPos))
  11.        
  12.         print(event .. " => Side: " .. tostring(side) .. ", " ..
  13.         "X: " .. tostring(xPos) .. ", " ..
  14.         "Y: " .. tostring(yPos))
  15.     end
  16. end
  17.  
  18. function main()
  19.     boolwert = true
  20.     while boolwert do
  21.         if table.getn(touchEvents ) > 0 then
  22.             for k,v in pairs(touchEvents) do
  23.                 print(k, v)
  24.             end
  25.  
  26.             turtle.drop(1)
  27.             os.sleep(0.1)
  28.             boolwert = false
  29.         end
  30.     end
  31. end
  32.  
  33. parallel.waitForAny(getTouchEvents, main)
Advertisement
Add Comment
Please, Sign In to add comment