Hey there!
I just created an account here, so this is my first post ^^
I use Bluestacks (Android Simulator) on my laptop, running an app called Monster Warlord.
So I wrote some scripts (very basic) for some ingame content and I want to optimize one particular script, cuz it isnt working as good as I want it to.
Here are the screens from the content:
1.
Screenshot_2016-02-16-00-26-21_1.jpg
2.
Screenshot_2016-02-16-00-26-28_1.jpg
3.
Screenshot_2016-02-16-00-26-42_2.jpg
Here is my script:
Simba Code:program DoRoulette;
procedure Start;
var
x, y:Integer;
begin
MoveMouse(156+random(100), 315+random(50));
Wait(150);
ClickMouse(x, y, 1);
end;
procedure Proceed;
var
x, y:Integer;
begin
Wait(35000);
MoveMouse(160+random(100), 422+random(20));
Wait(500);
ClickMouse(x, y, 1);
Wait(1000);
end;
begin
repeat
Start;
Proceed;
until(false);
end.
Procedure Start is basically clicking the Start button on the first screenshot at a random position on the start button
Procedure Proceed is basically waiting 35 seconds till the Animation on the 2nd screenshot ends, then it clicks the Close Button which is on the third screenshot.
The part I want to optimize is the "Wait(35000)" part. The duration of the animation varies between 15 and 35 seconds.. thats why the script is set the 35 seconds so it doesnt click too early on the close button.
What sucks tho is the script doing nothing when the animation lasts only 15 seconds.. its just doing nothing 20 seconds long and thats a lot of time.
I now want to change that part.
I want the script to start scanning for the green colour of the Close Button the moment the Start button is being clicked. I want it to scan/search for that particular color in a defined area (the close button) as long until it finds the colour, then it should move the mouse to that area and click randomly in that area (where the close button is)
I know that I need to use FindColor(Tolerance), but I need it as Loop, cuz it shouldnt just search for the color once after the start button got clicked, but actually till it really finds the color.. therefore looping it, right?
Now I wanted to ask you guys how you would rewrite that script to make it run more optimized and without wasting waiting time.
cheers Ardwen
(sorry for the wall of text) xD