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

Clicking not running what it needs to

Started by Brod8362, 26 March 2016 - 03:05 AM
Brod8362 #1
Posted 26 March 2016 - 04:05 AM
Hey.
Writing an airlock door control system program.
When clicking, it does not work.
Help?
Asking Because I am too tired to diagnose.

Spoiler

img = paintutils.loadImage("/ppc/iapps/img")
paintutils.drawImage(img,1,1)
term.setCursorPos(3,5)
term.setBackgroundColor(colors.lime)
write("<>")
term.setBackgroundColor(colors.red)
term.setCursorPos(7,5)

function control()
rednet.open("back")
button, x, y = os.pullEvent("mouse_click")
if x == 3 or x == 4 and y == 10 then
print("open1")
rednet.send(36,"open1")
elseif x == 7 or x == 8 and y == 10 then
print("close1")
rednet.send(36,"close1")
elseif x == 3 or x == 4 and y == 19 then
print("open2")
rednet.send(37,"open2")
elseif x == 7 or x == 8 and y == 19 then
print("close2")
rednet.send(37,"close2")
else
end
control()
end





write("><")
term.setBackgroundColor(colors.lime)
term.setCursorPos(3,10)
write("<>")
term.setCursorPos(7,10)
term.setBackgroundColor(colors.red)
write("><")
term.setBackgroundColor(colors.gray)
term.setCursorPos(1,19)
print("EXIT")

control()
Edited on 26 March 2016 - 03:17 AM
Bomb Bloke #2
Posted 26 March 2016 - 04:43 AM
os.pullEvent() also returns an event type.