Posted 21 September 2016 - 08:08 PM
I'm having a problem with my SOMAR styled airlock for my underwater base.
It's supposed to flood the chamber with water (via buildcraft floodgates activated by redstone gates in the valve pipe) and then flush it out (via buildcraft pumps activated by redstone turning on engines that power the pumps)
(its supposed to wait untill its clicked on. then its supposed to do the flushing. then wait untill clicked to do the flooding and so on)
The full code is
I've tried putting "event2, side2, x2, y2 = os.pullEvent("monitor_touch")" instead of "event, side, x, y = os.pullEvent("monitor_touch")" but it still ignored the last section of code.
I've also tried putting the other "click with omnitool to access" on a line higher ( like "mon.setCursorPos (1,1)" instead of (1,2) and changed the "y == 2" to "y==1". but that still didn't fix it.
Please help as I have no idea why it isn't doing the second half of the code.
It's supposed to flood the chamber with water (via buildcraft floodgates activated by redstone gates in the valve pipe) and then flush it out (via buildcraft pumps activated by redstone turning on engines that power the pumps)
(its supposed to wait untill its clicked on. then its supposed to do the flushing. then wait untill clicked to do the flooding and so on)
The full code is
local mon = peripheral.wrap("top")
mon.setTextScale(1)
while true do
mon.setTextColor(colors.lightBlue)
mon.setCursorPos(1,2)
mon.write("click with OmniTool to access")
event, side, x, y = os.pullEvent("monitor_touch")
if x > 1 and x < 29 and y == 2 then
print("airlock activated")
mon.clear()
mon.setCursorPos(1,2)
mon.write("flushing")
redstone.setOutput("back", true)
print("flushing")
sleep(30)
print("flushed)
redstone.setOutput("back", false)
end
sleep(0)
mon.clear()
mon.setCursorPos(1,2)
mon.setTextColor(colors.lightBlue)
mon.write("Click with OmniTool to access")
sleep(0)
event, side, x, y = os.pullEvent("monitor_touch")
if x > 1 and x < 29 and y == 2 then --The program (for some reason) stops here when its supposed to continue through to the next bit--
print("airlock deactivated")
mon.clear()
mon.setCursorPos(1,2)
mon.setTextColor(colors.red)
mon.write("flooding")
redstone.setOutput("bottom", true)
print("flooding")
sleep(10)
print("flooded")
redstone.setOutput("bottom", false)
end
end
I've tried putting "event2, side2, x2, y2 = os.pullEvent("monitor_touch")" instead of "event, side, x, y = os.pullEvent("monitor_touch")" but it still ignored the last section of code.
I've also tried putting the other "click with omnitool to access" on a line higher ( like "mon.setCursorPos (1,1)" instead of (1,2) and changed the "y == 2" to "y==1". but that still didn't fix it.
Please help as I have no idea why it isn't doing the second half of the code.