SRL Archive - OSR Help

Won't Stop While InvFull


Chris!

2013-01-21 00:58:14

So my script successfully chops tree, but when the inventory is full it keeps trying to chop and doesn't even attempt to walk to the bank.

Procedure ChopTree;
var
x, y, Attempts: Integer;
begin
FindNormalRandoms;
repeat
MarkTime(TooLong);
FindNormalRandoms;
while (WaitWhileChopping) do
begin
if (InvFull) then
Exit;
Wait(500+Random(250));
end;
if (FindTree) then
begin
if (InvFull) then
Break;
GetMousePos(x, y);
case random(2) of
0: begin
HumanMMouse(x, y, 5, 5);
FastClick(mouse_left);
end;
1: begin
HumanMMouse(x, y, 5, 5);
WaitOption('Chop', 500);
FastClick(mouse_left);
end;
end;
end else
begin
Inc(Attempts);
Writeln('Can not find tree, trying again.');
Wait (2000 + Random(1500));
Continue;
end;
repeat
Antiban;
until (PlayerIdle) or (TimeFromMark(TooLong) > 60000) or (InvFull);
until(InvFull) or (Attempts > 7);
if (Attempts > 7) then (FailSafe('Could not find tree. Shutting down.'));
end;

Cheers.

Another thing: My script hovers around trees but doesn't click 'em.

Function FindTree: Boolean;
var
tmpCTS, l, i, r: Integer;
TreeTPA: TPointArray;
begin
tmpCTS := GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.37, 0.87);

FindColorsTolerance(TreeTPA, 2373174, MSX1, MSY1, MSX2, MSY2, 7);

SetColorToleranceSpeed(tmpCTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);

L := High(TreeTPA)
MarkTime(TooLong);
for i := 0 to L do
begin
r := random(L);
Wait(RandomRange(40, 170));
HumanMMouse(TreeTPA[R].x, TreeTPA[R].y, 2, 2);
if WaitUpTextMulti(['Chop', 'down', 'Willow'], 300) then
begin
Result := True;
Writeln('Found a tree. Chopping.');
Fastclick(Mouse_Left);
Break;
end;
if TimeFromMark(TooLong) > 20000 then
FailSafe('We could not find a tree.');
end;
end;

Any help appreciated.

DannyRS

2013-01-21 02:12:33

The first snipp is too complex to read on phone, but the hover issue, try adding more to the waituptext, like 'hop-d' etc, sometimes capitals are missed and individual letters are also missed, so anything related to tree should go in there thats not in 'Walk-here', like 'llow' 'Will'

And is fastclick flights one or did you make it yourself? Check it is not a Boolean(FastClick(True); or something) instead of mouseleft?

I would also repeat the mouse movement until (waituptext) because that helps it be faster and more reliable, take a look at my latest Fletcher script in procedure "ClickBankChest" to see what i mean :)

riwu

2013-01-21 03:50:28

In the first snippet, if WaitWhileChopping and FindTree do not return true, the script will not break out of the procedure.

In the second snippet

HumanMMouse(TreeTPA[R].x, TreeTPA[R].y, 2, 2);
Why 'R'? It's going to loop several times for the same TPA[0] (since R is 0 by default and you didn't alter it).


Writeln('Found a tree. Chopping.');
If this isn't debugged but the mouse did hover over a tree then maybe the uptext is wrong?