I have 2 touchscreen if's (starting at line 47) and they are at the end. When I click somewhere for the first time, it's fine and if it's on the correct x and y - it runs the code that should run. However, if I do that one time the program stops (without any error) and puts up the craftos shell. I am expecting an second click to be made and then the program to shut down.
Code:
term.setBackgroundColor(colors.lime) term.clear() term.setCursorPos(1,1) term.setTextColor(colors.white) print("jOS Loading...") -- BEGGINING: LOADING local signal = 0 local version = 1 -- ENDING: LOADING sleep(3) function home() term.setCursorPos(1,1) term.setBackgroundColor(colors.lightBlue) term.clear() term.setCursorPos(1,1) term.setBackgroundColor(colors.white) term.clearLine() term.setTextColor(colors.black) print("jOS "..version) term.setCursorPos(18,1) if signal == 1 then term.write("Connected") else term.write("No signal") end term.setCursorPos(1,20) term.setBackgroundColor(colors.black) term.clearLine() term.setTextColor(colors.white) write("YouAd SMS") end function Ads() term.setCursorPos(1,2) term.setTextColor(colors.white) term.setBackgroundColor(colors.yellow) term.clearLine() write("hello") end function SMS() home() end home () [b]-- Touchscreen local event, button, xPos, yPos = os.pullEvent("mouse_click") if (xPos > 0 and xPos < 5) and (yPos > 19 and yPos < 21) then home() Ads() end[/b] if (xPos > 8 and xPos < 11) then home() SMS() end
Thanks in advance!