Posted 20 September 2014 - 04:18 AM
Hi, again! I need more help, this time from Looping:
This is the Loop of my Program
It catches my Mouse Pos and make all the things. But, when I press the Start or the Cancel Button in bottom of screen the Loop should stop, and start the Saving Process, but It don't happen!
If you are like… Lost, here's the screenshot: http://imgur.com/AXLTNUs. The Code is looking for Clicking the "<<" buttons or "[ SAVE ]" and "[ CANCEL ]" ones at bottom of Screen.
Variables of the Loop:
PrintCentered/Left/Right() comes from my TodtNetworks API. Just imagine all as write()
repeat
tn.printCentered(" ")
tn.printCentered("[ "..string.upper(side[sel]).." ]",5)
local event, param, cX, cY = os.pullEvent("mouse_click")
if cY == 5 then
if cX > 2 and cX < 5 then -- x < a and x > b = b < x < a
sel = sel - 1
end
if cX > x - 5 and cX < x then
sel = sel + 1
end
if sel < 1 then sel = 7 end
if sel > 7 then sel = 1 end
end
if cY > y - 1 and cY < y then
if cX > 1 and cX < 11 then -- x < a and x > b = b < x < a
local loop=false
local save=true
end
if cX > x - 12 and cX < x - 1 then
local save=false
local loop=false
end
end
until loop == false
This is the Loop of my Program
It catches my Mouse Pos and make all the things. But, when I press the Start or the Cancel Button in bottom of screen the Loop should stop, and start the Saving Process, but It don't happen!
If you are like… Lost, here's the screenshot: http://imgur.com/AXLTNUs. The Code is looking for Clicking the "<<" buttons or "[ SAVE ]" and "[ CANCEL ]" ones at bottom of Screen.
Variables of the Loop:
local x,y = term.getSize()
local side = {"auto","left", "right", "front", "back", "top", "bottom"}
local sel = 1
local loop=true
PrintCentered/Left/Right() comes from my TodtNetworks API. Just imagine all as write()