This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
grand_mind1's profile picture

Touch Screen

Started by grand_mind1, 28 January 2013 - 08:22 AM
grand_mind1 #1
Posted 28 January 2013 - 09:22 AM
I have tried to find information on the touch functionality of the advanced monitors, but I haven't been able to find much. Could someone please provide some information or a link to some?
Help is very much appreciated!
Thanks! :D/>
remiX #2
Posted 28 January 2013 - 09:48 AM
You will need to use os.pullEvent() and check for the event "monitor_touch". THe parameters returned are:
which button, x and y co-ords.


mon = peripheral.wrap("right") -- wrap monitor on the side...
mX, mY = mon.getSize() -- get the sizes of the monitor

while true do
    e = { os.pullEvent() }
    if e[1] == "monitor_touch" then
        if e[3] == mX and e[4] == 1 then -- 
            -- This would be the very top right of the monitor...
        end
    end
end