|
Post by segacode on Feb 17, 2019 21:14:34 GMT
Hi,
I have a script running (basic image search and click script) and I want to know if there is a way to optimize it, so that it would be faster. In general the whole script is running an infinite while loop for a grind game. In this loop there are various steps and in these steps the script has to perform the image searching.
In the following a very basic example of my code and my question is would a second while-loop in the if-searching statement (search for "a" or "b" image) reduce the time for the script to run one instance?
while (true)
do
if (step == 0) then
if (exists("a.png")) then
click("a.png")
step = 1
end
elseif (step == 1) then
if (exists("b.png")) thenclick("b.png") step = 0 end
end
end
|
|
|
Post by AnkuLua on Feb 18, 2019 0:37:26 GMT
The if-else affect the time very few.
You can use the existsClick and exists check time to reduce the time.
while (true) do if (step == 0) then if (existsClick("a.png", 0)) then step = 1 end elseif (step == 1) then if (existsClick("b.png", 0)) then step = 0 end end end
|
|
|
Post by segacode on Feb 18, 2019 21:43:58 GMT
Thanks! This will help me anyways in some other cases
|
|