SRL Archive - OSR Help

Clicking and object


jman1208

2012-07-23 01:01:15

Never Mind got it working!

Function PickBerries: Boolean;
var
x, y, xa, ya, xas, yas: Integer;
Begin
xas:=MSCX;
yas:=MSCY;
If FindObjCustom(x, y, ['hite'], [14146272], 15) Then
//begin
GetMousePos(x, y);
if((x = x) and (y = y))then
ClickMouse2(mouse_Left);
wait(2500 + random(200));
repeat
If(WaitUpText('ake', 200+Random(500))) then
PickBerries;
Until (InvCount=28)

end;

putonajonny

2012-07-23 12:50:15

I'm not sure which part you fixed, but I found several things I thought I should point out…

This part:
 if((x = x) and (y = y))then
Will always be true since something is always going to be equal to itself, you need to use more variables:
function PickBerries: Boolean;
var
x1, y1, x2, y2: Integer;
begin
x1 := MSCX;
y1 := MSCY;
if FindObjCustom(x1, y1, ['hite'], [14146272], 15) then
begin
GetMousePos(x2, y2);
if ((x1 = x2) and (y1 = y2)) then
ClickMouse2(mouse_Left)
else
Mouse(x1, y1, 5, 5, mouse_Left);
wait(2500 + random(200));
end;
end;
For this part:
repeat
if (WaitUpText('ake', 200 + Random(500))) then
PickBerries; //This is calling your function you are already in
until (InvCount = 28);//what if it runs out of berries on the bush, this will cause an infinite loop
You would be better with this:

if (WaitUpText('ake', 200 + Random(500))) then
begin
ClickMous2(mouse_Left);
Wait(200+Random(2000));
end;

jman1208

2012-07-23 21:56:19

Thanks that works a lot better.. I feel like such a scrub. but it works! Thanks, since there's no repeat how can I use this until inv is full?

P1ng

2012-07-23 22:12:12

repeat
PickBerries;
until(InvFull);

jman1208

2012-07-23 22:18:02

From: P1ng
repeat
PickBerries;
until(InvFull);


I know that but i'm trying to avoid it mass clicking i guess i could add a wait right after unless theres a better way?

Runaway

2012-07-23 22:44:42

From: jman1208
I know that but i'm trying to avoid it mass clicking i guess i could add a wait right after unless theres a better way?


You could try something like this:


if PickBerries then
begin
StartCount := InvCount;
MarkTime(t);
while (TimeFromMark(t) < 4000) do
begin
Wait(100);
//Antiban;
if (InvCount > StartCount) then
begin
//Inc(BerriesPicked);
Break;
end;
end;
end;

Just be sure to cut out any waits after clicking on a berry so the StartCount is the inventory count before picking up the berry.

putonajonny

2012-07-24 10:28:38

You could avoid that problem by:
StartCount := InvCount;
if PickBerries then
begin
MarkTime(t);
while (TimeFromMark(t) < 4000) do
begin
Wait(100);
//Antiban;
if (InvCount > StartCount) then
begin
//Inc(BerriesPicked);
Break;
end;
end;
end;

Abu

2012-07-24 10:55:24

^^^ You both posted the same code?