SRL Archive - OSR Help

New Procedure?


icode

2013-08-08 13:09:32

Ok this is my RSPS Powerchopper I am working on.
Before I added the DropLog Procedure it was clicking the trees fine except I still need to add pixelshift in; however now it doesn't do anything! Please help a newbie out :)
It says:
Compiled successfully in 375 ms.
Successfully executed.

So I need help Adding this:

Procedure DropLog;
var
X,Y:Integer;
begin
if FindColorTolerance(X, Y, 605787, 561, 226, 738, 484, 5) then
begin
mmouse(x, y,1,1);
wait(250);
ClickMouse(X, Y, mouse_Right)
wait(450);
if FindBitmapToleranceIn(Drop, X, Y, 561, 226, 738, 484, 145) then
begin
mmouse(x, y,1,1);
wait(250);
ClickMouse(X, Y, mouse_Left)
end;
end;
end;
Begin
MouseSpeed := 15;
Drop := BitmapFromString(100, 10, 'meJzNlm0KwjAMhnseEbyCqCCo4' +
'NX8s7vsBLuWVgPlNR/v2s6BIz/SNF2ap0npME4ppdtpO4xTlqz8XP' +
'aPp4gaStxVJQp0Pb4lGhajGg7frOr3fz/vWlkp6WOF2KO8mliJrsT' +
'6Xw4bl5XoqtJcI7HbDVvFwowgoz19Pu4jKc8GQjcRZKUOl7Mqu8Ih' +
'Yons0eGKJ1qKXuxqlWu3PgjQhkZuTYHw54QVRndnic4bgRy3ZZib3' +
'bXbsiHHpJxrdFuHlVmvx8oea306qNt7Bvn0sVKN8D+slujubdzBJy' +
'rUworcTuhPPK19eQ/O9qbbJgiKO+NWSSDl796NbtbWExG5S6K/ueG' +
'ibaiUyVpVWtwZq5EE4qnVS+urrE/c1nAfQjjl3mCVgfD1VWZfuuW+' +
'zQ==');
DropLog;
FreeBitmap(Drop);
end.

INTO THIS:

program CrisisXCutter;
{$i srl/srl.simba}
var
Drop:Integer;
const
LOGS = 100;

Procedure ClickTree;
var
X,Y:Integer;
begin
repeat
if FindColorTolerance(X, Y, 14678264, 1, 5, 760, 502, 1) or
FindColorTolerance(X, Y, 12187896, 1, 5, 760, 502, 1)then
begin
mmouse(x, y,1,1);
wait(250);
ClickMouse(X, Y, mouse_Left)
wait(10000+random(5000));
end;
until (LOGS > 100);
end;

Begin
SetupSRL;
MouseSpeed := 15;
ClickTree;
DropLog;
end.

riwu

2013-08-08 20:21:15

Localize variables whenever possible

Procedure DropLog;
var
X, Y, Drop:Integer;
begin
if FindColorTolerance(X, Y, 605787, 561, 226, 738, 484, 5) then
begin
mmouse(x, y,1,1);
wait(250);
ClickMouse(X, Y, mouse_Right)
wait(450);

Drop := BitmapFromString(100, 10, 'meJzNlm0KwjAMhnseEbyCqCCo4' +
'NX8s7vsBLuWVgPlNR/v2s6BIz/SNF2ap0npME4ppdtpO4xTlqz8XP' +
'aPp4gaStxVJQp0Pb4lGhajGg7frOr3fz/vWlkp6WOF2KO8mliJrsT' +
'6Xw4bl5XoqtJcI7HbDVvFwowgoz19Pu4jKc8GQjcRZKUOl7Mqu8Ih' +
'Yons0eGKJ1qKXuxqlWu3PgjQhkZuTYHw54QVRndnic4bgRy3ZZib3' +
'bXbsiHHpJxrdFuHlVmvx8oea306qNt7Bvn0sVKN8D+slujubdzBJy' +
'rUworcTuhPPK19eQ/O9qbbJgiKO+NWSSDl796NbtbWExG5S6K/ueG' +
'ibaiUyVpVWtwZq5EE4qnVS+urrE/c1nAfQjjl3mCVgfD1VWZfuuW+' +
'zQ==');
if FindBitmapToleranceIn(Drop, X, Y, 561, 226, 738, 484, 145) then
begin
mmouse(x, y,1,1);
wait(250);
ClickMouse(X, Y, mouse_Left)
end;

FreeBitmap(Drop);
end;
end;

Also in ClickTree() there is an infinite loop since LOGS can never change its value.

icode

2013-08-08 22:11:15

From: riwu
Localize variables whenever possible

Procedure DropLog;
var
X, Y, Drop:Integer;
begin
if FindColorTolerance(X, Y, 605787, 561, 226, 738, 484, 5) then
begin
mmouse(x, y,1,1);
wait(250);
ClickMouse(X, Y, mouse_Right)
wait(450);

Drop := BitmapFromString(100, 10, 'meJzNlm0KwjAMhnseEbyCqCCo4' +
'NX8s7vsBLuWVgPlNR/v2s6BIz/SNF2ap0npME4ppdtpO4xTlqz8XP' +
'aPp4gaStxVJQp0Pb4lGhajGg7frOr3fz/vWlkp6WOF2KO8mliJrsT' +
'6Xw4bl5XoqtJcI7HbDVvFwowgoz19Pu4jKc8GQjcRZKUOl7Mqu8Ih' +
'Yons0eGKJ1qKXuxqlWu3PgjQhkZuTYHw54QVRndnic4bgRy3ZZib3' +
'bXbsiHHpJxrdFuHlVmvx8oea306qNt7Bvn0sVKN8D+slujubdzBJy' +
'rUworcTuhPPK19eQ/O9qbbJgiKO+NWSSDl796NbtbWExG5S6K/ueG' +
'ibaiUyVpVWtwZq5EE4qnVS+urrE/c1nAfQjjl3mCVgfD1VWZfuuW+' +
'zQ==');
if FindBitmapToleranceIn(Drop, X, Y, 561, 226, 738, 484, 145) then
begin
mmouse(x, y,1,1);
wait(250);
ClickMouse(X, Y, mouse_Left)
end;

FreeBitmap(Drop);
end;
end;

Also in ClickTree() there is an infinite loop since LOGS can never change its value.


Awesome thanks! and yeah I know still working on that and can I just put the droplog procedure after the clicktree one but before the main functions right?

riwu

2013-08-08 22:15:40

From: icode
Awesome thanks! and yeah I know still working on that and can I just put the droplog procedure after the clicktree one but before the main functions right?

What main functions?

icode

2013-08-08 22:26:35

From: riwu
What main functions?


Begin
SetupSRL;
MouseSpeed := 15;
ClickTree;
DropLog;
end.

riwu

2013-08-08 22:27:54

From: icode
Begin
SetupSRL;
MouseSpeed := 15;
ClickTree;
DropLog;
end.

Yeah, except you probably need a loop to repeat the 2 procedures.
Also MouseSpeed := 15; isn't needed as it has been called in SetupSRL().