|
Post by casaone on May 4, 2018 14:07:02 GMT
Hello i have started my first script and now i got a hopefully easy problem..
the function is easy first it make another function thats just move the position of view...then it check if a dead is there and when it attack...
i mad it easy cause if he dont find i want that he start again..now i made a endless loop...he never stops..
my problem i will that he stop if he found dead.
thx for help..
function dead1() search1() if existsClick("dead1.png",2) then wait (2) existsClick("dead2.png",2) wait (2) existsClick("dead3.png",2) wait (2) existsClick("enablergin1.png",2) wait (2) existsClick("search4.png",2) wait (2) end dead1() end
|
|
|
Post by noncombat on May 4, 2018 14:43:00 GMT
Hello, I don't know if I really can follow you.
I added comments to your Script so you know what happens.
function dead1() search1() - Executing Search1() function after that if existsClick("dead1.png",2) then - If clickExist for the image wait (2) existsClick("dead2.png",2) wait (2) existsClick("dead3.png",2) wait (2) existsClick("enablergin1.png",2) wait (2) existsClick("search4.png",2) wait (2) end dead1() - You are executing the function dead1() in it's own thus creating infinite loop put this in Main Program (remove this and you'll be fine) end
-- Main program while (true) do dead1() -- Executing your dead1() function end
I hope this helps you, good luck.
|
|
|
Post by casaone on May 4, 2018 14:49:13 GMT
i tried now like these but that dont worked like i want
function dead1() search1()--------------he make a touchmove if existsClick("dead1.png",2) then---------check if pattern is there then attack it wait (2) existsClick("dead2.png",2) wait (2) existsClick("dead3.png",2) wait (2) existsClick("enablergin1.png",2) wait (2) existsClick("search4.png",2) wait (2) if not existsClick("dead1.png",2) then--------should if not find pattern go in loop...otherwise should stop dead1() end end the search is just a touchmove that search for me along the map.... now i will that he move then he check and if found attack and stop the function...but if he dont find he go in loop until he find...
|
|
|
Post by casaone on May 4, 2018 15:04:03 GMT
function dead1() search1() if not existsClick("dead1.png",2) then dead1() end if existsClick("dead1.png",2) then wait (2) existsClick("dead2.png",2) wait (2) existsClick("dead3.png",2) wait (2) existsClick("enablergin1.png",2) wait (2) existsClick("search4.png",2) wait (2) end end i test now but should right...i hope
|
|
|
Post by casaone on May 4, 2018 15:05:47 GMT
function dead1() search1() if not existsClick("dead1.png",2) then dead1() end if existsClick("dead1.png",2) then wait (2) existsClick("dead2.png",2) wait (2) existsClick("dead3.png",2) wait (2) existsClick("enablergin1.png",2) wait (2) existsClick("search4.png",2) wait (2) end end hmm nothing
|
|
|
Post by noncombat on May 4, 2018 15:09:44 GMT
function dead1() search1() if not existsClick("dead1.png",2) then dead1() end if existsClick("dead1.png",2) then wait (2) existsClick("dead2.png",2) wait (2) existsClick("dead3.png",2) wait (2) existsClick("enablergin1.png",2) wait (2) existsClick("search4.png",2) wait (2) end end hmm nothing You are using dead1() in dead1(), don't do that. This is what happens function dead1() -- Gonna execute function 1 search1() -- Executing search1() 2 if not existsClick("dead1.png",2) then -- Click does not exist on image 3 dead1() -- You call dead1() inside dead1() this goes back to the top 4 but we go back to 1 end
if existsClick("dead1.png",2) then -- We never reach here 5 because at 4 you call dead1() again which return to 1 wait (2)
existsClick("dead2.png",2)
wait (2)
existsClick("dead3.png",2)
wait (2)
existsClick("enablergin1.png",2)
wait (2)
existsClick("search4.png",2)
wait (2)
end
end
|
|
|
Post by casaone on May 4, 2018 15:33:20 GMT
that's the basic one
function dead1() search1() if existsClick("dead1.png",2) then wait (2) existsClick("dead2.png",2) wait (2) existsClick("dead3.png",2) wait (2) existsClick("enablergin1.png",2) wait (2) existsClick("search4.png",2) wait (2) end -------------------------i want he repeat until he ends here------thats why i use always dead1() to start function again end not possible to repeat until he find pattern and end function with that?
|
|
|
Post by casaone on May 4, 2018 16:01:02 GMT
i am stupid or is it not a if then else..i dont get it to work
|
|
|
Post by Mercobots on May 5, 2018 11:08:20 GMT
Can you provide both function , so we can help you better
|
|
|
Post by casaone on May 5, 2018 14:56:02 GMT
I solved the Problem.. its closed..
|
|