Posted 14 June 2016 - 08:09 PM
So I have this code:
http://pastebin.com/9jMNw83s
and when I run it, it seems to work fine. However when I select an output (basically every button on screen) it goes to the function continue(), but after the os.sleep it goes right back to main screen.
Before I had:
And the problem started after I changed it to:
I tried getting rid of the os.sleep (By making it a comment (–os.sleep)) and the monitor didnt do anything. (or it went straight to the main screen again, without the pause.)
Any Ideas? Should I declare the event before I declare the function? (Actually, Ill try that now)
EDIT: No improvement on declaring the event sooner. It doesnt leave the function right away, but it doesnt actually leave continue() at all.
http://pastebin.com/9jMNw83s
and when I run it, it seems to work fine. However when I select an output (basically every button on screen) it goes to the function continue(), but after the os.sleep it goes right back to main screen.
Before I had:
local function continue()
--Set up monitor for function
mon.clear()
mon.setTextColor(colors.red)
mon.setCursorPos(18,13)
mon.write("Touch here to continue.")
mon.setCursorPos(14,27)
mon.write("Touch here to add another fluid")
os.sleep(2) --Pause to avoid double-tap
if xPos >= 18 and xPos <= 40 and yPos == 13 then --Test for touch here
redstone.setBundledOutput("top", 0) --Stop Redstone
end
end
And the problem started after I changed it to:
local function continue()
--Set up monitor for function
mon.clear()
mon.setTextColor(colors.red)
mon.setCursorPos(18,13)
mon.write("Touch here to continue.")
mon.setCursorPos(14,27)
mon.write("Touch here to add another fluid")
os.sleep(2) --Pause to avoid double-tap
if xPos >= 18 and xPos <= 40 and yPos == 13 then --Test for touch here
redstone.setBundledOutput("top", 0) --Stop Redstone
redstone.setBundledOutput("right", 0) --Stop Redstone
redstone.setBundledOutput("left", 0) --Stop Redstone
redstone.setBundledOutput("back", 0) --Stop Redstone
elseif xPos >= 14 and xPos <= 44 and yPos == 27 then --Test for touch here
-- Straight to end of continue(), to select new fluid.
end
end
I tried getting rid of the os.sleep (By making it a comment (–os.sleep)) and the monitor didnt do anything. (or it went straight to the main screen again, without the pause.)
Any Ideas? Should I declare the event before I declare the function? (Actually, Ill try that now)
EDIT: No improvement on declaring the event sooner. It doesnt leave the function right away, but it doesnt actually leave continue() at all.
Edited on 14 June 2016 - 06:18 PM