I scripted a simple bot program a week or two ago, and have been building on it with new knowledge as I broaden my understanding.
local B = 1 --Boss check 1 = true, 2 = false
repeat
function bossCheck()
local rgb1 = getColor(x,y)
if rgb1 == (rgb) then
touchDown(x,y)
usleep(time)
touchUp(x,y)
end
local D = 1 --Delay, corrective action when script is out of sync with loading times
repeat
if rgb1 ~= (rgb) then
D = D + 1
usleep(time)
end
until D == 5
end
if D == 5 then
B = B + 1
end
until B == 2
if B == 2 then
alert("No Boss")
end
This actually worked in a loop until I added the correction check delay. If the function bossCheck() failed, then in my mind it should repeat. Am I wrong in assuming this is workable, or have I misplaced some loop statements?
Prior to this new code I implemented with local D = 1 --for delay I would attempt to touch at my IOS screen twice, it would return not true results and then my loop would end. But as of now, I run my script and nothing happens and it would appear that the script runs indefinately.
It's very confusing. I don't expect a verbatim line I should include here, but kind of hint me into the right direction.
Edit - Example
'function bossCheck () if (getColor(x,y) == "color1") then return true; end return false; end
function onBoss () touch(x,y) usleep(time) return true; end
function fightBoss () touch(x2,y2) usleep(time) return true; end
function bossReturn () touch (x3,y3) usleep(time) return true; end
function bossLoop () while (bossCheck) do onBoss (); fightBoss (); bossReturn (); end end
repeat bossLoop (); until (bossCheck == false)
if (bossCheck == false) then alert("Boss Loop End") end
'
bossCheck, but it's never called.rgb? What isrgb1outside of thebossCheckfunction?getColorit helped with labeling them differently when I had 5 or so colorChecks.