SRL Archive - OSR Help

Not Clicking?


icode

2013-08-08 09:28:47

Ok, I have started scripting recently and I have currently only written a scripts for a few private servers.

I am trying to write a script to do the gnome agility course on a private server. I have started, as you can see, to write the first procedure which would be crossing the balance log.

The script compiles:
Compiled successfully in 360 ms.
SRL Compiled in 0 msec
Successfully executed.

But it won't actually click the log. My target is the webclient and it should work, but I cannot see why it won't actually click.

program CrisisXAgility;
{$i srl/srl.simba}

Procedure ClickLogBalance;
var
X,Y:Integer;
begin
if FindColorTolerance(X, Y, 872066, 294, 172, 400, 480, 1) or
FindColorTolerance(X, Y, 868459, 324, 171, 400, 480, 1)
then
begin
mmouse(x, y,1,1);
wait(250);
ClickMouse(X, Y, mouse_Left)
end;
end;

Begin
SetupSRL;
MouseSpeed := 15;
ClickLogBalance;
end.

riwu

2013-08-08 09:50:17

Most probably it cant find the 2 colors. The tolerance of 1 is pretty low unless the colors are static?

icode

2013-08-08 09:51:19

From: riwu
Most probably it cant find the 2 colors. The tolerance of 1 is pretty low unless the colors are static?


Can you explain the tolerance number because I don't quite understand it :/

Edit: Changed to tolerance 3 works like a charm :)

riwu

2013-08-08 10:00:23

From: icode
Can you explain the tolerance number because I don't quite understand it :/

Edit: Changed to tolerance 3 works like a charm :)

Basically the difference in color in which the function will tolerate to perceive as equivalent.
You can check out this tutorial for a more in-depth explanation for tolerance and CTS:
http://villavu.com/forum/showthread.php?t=74908

icode

2013-08-08 10:06:33

From: riwu
Basically the difference in color in which the function will tolerate to perceive as equivalent.
You can check out this tutorial for a more in-depth explanation for tolerance and CTS:


Ok thanks, but I added a new procedure for climbing the 1st obstacle net and now it won't click the log again:

program CrisisXAgility;
{$i srl/srl.simba}

Procedure ClickLogBalance;
var
X,Y:Integer;
begin
if FindColorTolerance(X, Y, 872066, 294, 172, 400, 480, 3) or
FindColorTolerance(X, Y, 868459, 324, 171, 400, 480, 3)
then
begin
mmouse(x, y,1,1);
wait(250);
ClickMouse(X, Y, mouse_Left)
end;
end;

Procedure ClickObstacleNet1;
var
X,Y:Integer;
begin
if FindColorTolerance(X, Y, 7301224, 440, 191, 500, 480, 3) or
FindColorTolerance(X, Y, 537172, 440, 184, 500, 480, 3)
then
begin
mmouse(x, y,1,1);
wait(250);
ClickMouse(X, Y, mouse_Left)
end;
end;

Begin
SetupSRL;
MouseSpeed := 15;
ClickLogBalance;
ClickObstacleNet1;
end.

riwu

2013-08-08 10:15:56

You probably need to wait after ClickLogBalance() so that the next obstacle will be visible? You can do with a loop to repeatedly wait until the color is found (with a failsafe to prevent infinite loop)