coldblitz
2012-03-17 13:33:04
EDIT: I've already had a couple issues solved here but I keep progressing and I keep adding more features to my script. Inevitably that means more problems.
I.e Rather then post a new question I'm just going to retailer this one. The title still fits.
What I want the script to do is, first Chop Willows, then when the inventory is full, walk to destination and begin lighting the logs, when finished lighting the logs, return to chopping willows.
My current problem is that once it has chopped down the willows, inventory is full, it walks to destination, then it wants to chop more trees rather then start the procedure for lighting the logs.
I think the problem is in my mainloop.
I.e Rather then post a new question I'm just going to retailer this one. The title still fits.
What I want the script to do is, first Chop Willows, then when the inventory is full, walk to destination and begin lighting the logs, when finished lighting the logs, return to chopping willows.
My current problem is that once it has chopped down the willows, inventory is full, it walks to destination, then it wants to chop more trees rather then start the procedure for lighting the logs.
I think the problem is in my mainloop.
program ChopNBurn;
{$i srl/srl.simba}
{$i sps/sps.simba}
Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;
end;
procedure AntiBan;
begin
if(not(LoggedIn))then
Exit;
FindNormalRandoms;
case Random(1000) of
0:
begin
HoverSkill('Woodcutting', false);
wait(2000+Random(1000));
end;
1: PickUpMouse;
2:
begin
MakeCompass('N');
wait(100+random(133));
MakeCompass('S');
wait(50+random(133));
MakeCompass('NE');
FindNormalRandoms;
end;
1: RandomRClick;
2:
end;
end;
function WillowTrunk: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(1.12, 3.02);
FindColorsSpiralTolerance(MSCX, MSCY, arP, 1449756, MSX1, MSY1, MSX2, MSY2, 1);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 1.02) and (X <= 1.23) and (Y >= 1.19) and (Y <= 1.43) and (Z >= 0.82) and (Z <= 1.04) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;
Function Chopping: Boolean;
var
PBox: TBox;
begin
PBox := IntToBox(245, 130, 285, 195);
Result := (AveragePixelShift(PBox, 250, 500) > 750);
end;
procedure ChopTree;
var
x, y: integer;
begin
if (not Chopping) then
repeat
if FindObj(x, y, 'hop', WillowTrunk, 20) then
begin
Mouse(x, y, 0, 0, false);
ChooseOption('hop');
end;
repeat
wait(400+random(250));
AntiBan;
Until not IsUpText('illow') or (InvFull);
until(InvFull);
end;
procedure WalkToFirePit;
var
myPath:TPointArray;
begin
SetupSRL;
SPS_Setup(RUNESCAPE_SURFACE,['8_8','9_8','10_9','8_9','7_9','8_7','9_7','10_8']);
myPath := [Point(3488, 3470), Point(3499, 3470), Point(3508, 3470), Point(3517, 3470),
Point(3531, 3470), Point(3543, 3470), Point(3555, 3470), Point(3568, 3470),
Point(3579, 3470), Point(3591, 3470), Point(3597, 3470), Point(3605, 3470)];
SPS_WalkPath(myPath);
end;
procedure DropLogs;
var
x, y, LogDTM, I:Integer;
SlotBox:TBox;
LogPattern:TIntegerArray;
begin
LogDTM := DTMFromString('m1gAAAHic42JgYJjCwsDQBsT9QDwTiOcC8UIgngbEvVC5ZiBWZmRgkAFiSSAWBWJZRoiYNhDrQWklILYyFgKaykQEJg4wEokRAAB/sAfX');
LogPattern := [1,5,9,13,17,21,25,2,6,10,14,18,22,26,3,7,11,15,19,23,27,4,8,12,16,20,24,28];
for I := 0 to 27 do
begin
SlotBox := InvBox(LogPattern[I]);
if FindDTM(LogDTM, x, y, SlotBox. X1, SlotBox. Y1, SlotBox. X2, SlotBox. Y2) then
begin
MouseItem (LogPattern[I], mouse_Right);
wait(400+random(200));
ChooseOption ('Light');
wait (1500+random(500));
end;
end;
end;
begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
repeat
ChopTree;
if invfull then
begin
WalkToFirePit;
DropLogs;
end;
until (False);
end.