SRL Archive - OSR Help

Wait until loaded browser


Master BAW

2012-07-16 20:13:58

Hey,

I was trying to bot some browser games that involves clicking and page loading.
because of that I've made this procedure for browser-scripts to wait until the browser has fully loaded… It checks the cursor if there's a blue color around it (of the windows-load icon)

But unfortunately it doesn't work :(


Procedure Chrome_WaitUntilLoaded;
var f, mx, my, cx, cy, notload, MouseLoadColor: integer;
begin
notload := 0;
MouseLoadColor := 6643972;
for f := 1 to 100 do
begin

GetMousePos(mx,my)
if not FindColorTolerance(cx,cy,MouseLoadColor,mx-99,my-99,mx+99,my+99,50) then inc(notload);
if notload >= 3 then break;
wait(100);
end;

writeln('Waited '+FloatToStr(f*0.1)+'s');


end;

When I put the tolerance too high, it always sees the loading-color of the mouse, but when the tolerance is too low, it never sees it :(

Anyone got a similar function or a way to fix this, any help is apreciated. :)

Footy

2012-07-16 20:30:15

Ill be honest, I think there are easier ways to do this. You could find a color that only appears once the game has loaded then use

While (not findcolorspiraltolerance(your color, x, y, 1, 1, 100, 100, 5) do
wait(randomrange(200,300));
For example, this can be used when waiting for runescape to load. You can set that color to the blue "log in with facebook" button, then it will wait until it see's the blue button, then exit the loop. Would this work for your game?

Master BAW

2012-07-17 04:35:11

From: Foooty
Ill be honest, I think there are easier ways to do this. You could find a color that only appears once the game has loaded then use

While (not findcolorspiraltolerance(your color, x, y, 1, 1, 100, 100, 5) do
wait(randomrange(200,300));
For example, this can be used when waiting for runescape to load. You can set that color to the blue "log in with facebook" button, then it will wait until it see's the blue button, then exit the loop. Would this work for your game?


no because you often see the old page until the new has loaded, or it has to render.. I don't know if that will work … I also don't think there's another way because I have only the inside of the browser into the client, because else some other functions didnt work with getcolor, it was strange… so I can't pick the loading icon at the top either

Can someone confirm whether it is possible to see the mouse with your bot or not? because that may be the problem :p

P1ng

2012-07-17 06:33:47

Simba will register what is in the designated client, not what your mouse looks like, perhaps a DTM or a bitmap from on the screen or something like what foooty suggested would be the way to go.