Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local monitor = peripheral.wrap( "left" )
- term.redirect(monitor)
- paintutils.drawPixel(3, 3 , colors.pink )
- touchEvents = {};
- function getTouchEvents()
- while true do
- event, side, xPos, yPos = os.pullEvent("monitor_touch")
- table.insert(touchEvents, tostring(xPos) .. tostring(yPos))
- print(event .. " => Side: " .. tostring(side) .. ", " ..
- "X: " .. tostring(xPos) .. ", " ..
- "Y: " .. tostring(yPos))
- end
- end
- function main()
- boolwert = true
- while boolwert do
- if table.getn(touchEvents ) > 0 then
- for k,v in pairs(touchEvents) do
- print(k, v)
- end
- turtle.drop(1)
- os.sleep(0.1)
- boolwert = false
- end
- end
- end
- parallel.waitForAny(getTouchEvents, main)
Advertisement
Add Comment
Please, Sign In to add comment