Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local timesTouched = 0
- local waitingForClicks = false
- local waitingPos = {}
- os.startTimer(0.4)
- while true do
- local event = { os.pullEvent() }
- if event[1] == "monitor_touch" then
- local xPos = event[3]
- local yPos = event[4]
- timesTouched = timesTouched + 1
- if timesTouched < 2 then
- waitingForClicks = true
- waitingPos = {xPos, yPos}
- elseif timesTouched == 2 then
- os.queueEvent( "mouse_click", 2, xPos, yPos )
- waitingForClicks = false
- end
- elseif event[1] == "mouse_click" then
- print( event[2].." : "..event[3].." : "..event[4] )
- elseif event[1] == "timer" then
- timesTouched = 0
- if waitingForClicks then
- os.queueEvent( "mouse_click", 1, waitingPos[1], waitingPos[2] )
- end
- waitingForClicks = false
- os.startTimer(0.4)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement