Gucci
2012-12-25 17:38:45
Okay so the problem is that after it relocates to the second tree and the tree appears it just automatically makes the compass north when I need it to be south as it's the best angle for detection of the tree.
Hopefully someone can see something I can't
program EdgeYewCutter;
{$DEFINE SMART8}
{$i srl/srl.simba}
{$i sps/sps.simba}
{Instructions:
1. Skillers can have the hatchet anywhere in inventory.
2. Start script at edgeville bank.}
const
SRLStats_User = ''; // Your SRL Stats Username
SRLStats_Password = ''; // Your SRL Stats Password
SERVER = 0; // Enter "0" to pick a random server.
MEMBERS = True;
NUMBOFPLAYERS = 1;
STARTPLAYER = 0;
ANTIBANTIME = 1; // Time in minutes before doing antiban
COMPASSANGLE = 'N'; // Best compass angle for seeing the tree
SKILLER = 'No'; //Yes or No (If you are a skiller keep the hatchet in any slot except the fourth
LOGPRICE = 511; //Latest price for the yew log
var
x, y, STree, Yew, Log, Stump, Position, NTree, Inventories: Integer;
ToYews, ToBank: TPointArray;
aFound: Extended;
procedure DeclarePlayers;
var i:integer;
begin
NumberOfPlayers(NumbOfPlayers);
CurrentPlayer := StartPlayer
for i := 0 to NumbOfPlayers-1 do
Players[i].BoxRewards := ['XP'];
With Players[0] do
begin
Name := ''; //Username.
Pass := ''; //Password.
Nick := 'Gucci'; //Nick name
Active := True;
end;
end;
function Cutting: Boolean;
var
PBox: TBox;
begin
PBox := IntToBox(245, 130, 285, 195);
Result := (AveragePixelShift(PBox, 450, 600) > 250);
end;
procedure ToTheYews;
begin
if (InvCount < 2) then
begin
Writeln('Walking to Yews.');
SPS_WalkToPos(Point(4140, 2689));
Position := 1;
while IsMoving do
repeat
Wait(200);
until(not(IsMoving))
end;
end;
procedure ToTheBank;
begin
if InvFull then
begin
IncEx(Inventories, 1);
MakeCompass('N')
Writeln('Walking to bank.');
ToBank := [Point(4169, 2692), Point(4152, 2654), Point(4174, 2640)];
SPS_WalkPath(ToBank);
end;
end;
procedure Report;
begin
if (SPS_WalkPath(ToBank) = True) then
begin
Writeln('############## Edge Yew Cutter ##############');
Writeln('|= Player : ' + Players[CurrentPlayer].Nick);
Writeln('|= Time Running : ' + TimeRunning);
Writeln('|= Logs Chopped : ' + IntToStr(Inventories * 28));
Writeln('|= Profit Gained : ' + IntToStr(((Inventories * 28) * LOGPRICE)) + 'GP');
Writeln('#############################################');
end;
end;
function BankerColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.54, 2.25);
FindColorsSpiralTolerance(MSCX, MSCY, arP, 4401455, MSX1, MSY1, MSX2, MSY2, 2);
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 >= 2.64) and (X <= 3.42) and (Y >= 2.38) and (Y <= 3.09) and (Z >= 4.58) and (Z <= 6.49) 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 FindBanker(x, y: Integer): Boolean;
var
CTS, I: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.54, 2.25);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, BankerColor, MSX1, MSY1, MSX2, MSY2, 8);
ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(TPA, 15, 15);
For I := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], x, y);
if High(TPA) > 100 then
MMouse(x, y, 2, 2);
If(IsUpTextMultiCustom(['anker', 'Banker', 'alk'])) then
begin
Result := True;
GetMousePos(x, y);
Break;
end;
end;
end;
function YewColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(1.34, 0.83);
FindColorsSpiralTolerance(MSCX, MSCY, arP, 1383708, MSX1, MSY1, MSX2, MSY2, 2);
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 >= 0.74) and (X <= 1.46) and (Y >= 0.84) and (Y <= 1.63) and (Z >= 0.64) and (Z <= 1.17) 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 FindYew(x, y: Integer): Boolean;
var
CTS, I: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(1.34, 0.83);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, YewColor, MSX1, MSY1, MSX2, MSY2, 3);
ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(TPA, 15, 15);
For I := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], x, y);
if High(TPA) > 100 then
MMouse(x, y, 2, 2);
If(IsUpTextMultiCustom(['anker', 'Banker', 'alk'])) then
begin
Result := True;
GetMousePos(x, y);
Break;
end;
end;
end;
function FindStump(x, y: Integer): Boolean;
var
CTS, I: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.02, 0.04);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 5534100, MSX1, MSY1, MSX2, MSY2, 4);
ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(TPA, 15, 15);
For I := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], x, y);
if High(TPA) > 100 then
MMouse(x, y, 2, 2);
If(IsUpTextMultiCustom(['alk', 'ere', 'Walk'])) then
begin
Result := True;
Break;
end;
end;
end;
function FindNest(x, y: Integer): Boolean;
var
CTS, I: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.08, 1.16);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 2636604, MSX1, MSY1, MSX2, MSY2, 2);
ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(TPA, 15, 15);
For I := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], x, y);
if High(TPA) > 100 then
MMouse(x, y, 2, 2);
If(IsUpTextMultiCustom(['est', 'ird', 'ick'])) then
begin
Result := True;
GetMousePos(x, y);
Break;
end;
end;
end;
procedure DTMS;
begin
Yew := DTMFromString('mQwAAAHicY2ZgYFBjZmCQAmIdID4M5J8A4uNAHBXkyiArL8YgJy/KwAHkwzAjEgYCAMOUBHs=');
Log := DTMFromString('mLgAAAHicY2JgYLjNzMBwD4izGBkYkoHYRpuDwcOEi4EVKAfCjFDMwAAAdzkDkg==');
Stump := DTMFromString('mLgAAAHicY2JgYPgJxP+B+D0QfwPiRTUxDJUxLgysQDYIM0IxAwMAyPIGfw==');
NTree := DTMFromString('mQwAAAHicY2ZgYDBkYWCQBmI/IN4D5N8E4ktAfODAAYYzaioMLkG+DKxAPgwzImEgAAAujQdc');
STree := DTMFromString('mQwAAAHicY2ZgYHjKzMBwCYj/APFrIP8aEF8EYu5ODobTgQEMLkG+DFxAPgwzImEgAACAoghe');
end;
procedure FrDTMS;
begin
FreeDTMS([Log, Yew, Stump, NTree, STree]);
end;
procedure AntiBan;
begin
if(not(LoggedIn))then
exit;
FindNormalRandoms;
case Random(160) of
0..40:
begin
WriteLn('AntiBan Is Being Performed');
HoverSkill('Woodcutting', false);
Wait(1500 + Random(1000));
GameTab(Tab_Inv);
end;
41..90:
begin
WriteLn('Bored')
If (Cutting) then
begin
BoredHuman;
end;
end;
91..122:
begin
WriteLn('AFK')
Wait(1000 + Random(5000));
end;
123..160:
begin
WriteLn('Looking Around');
GameTab(Tab_Stats);
Wait(400 + Random(8000));
GameTab(Tab_Inv);
end;
end;
end;
procedure ReLocate;
begin
if (not(Cutting)) and (FindDTM(Stump, x, y, MSX1, MSY1, MSX2, MSY2) or FindStump(x, y)) then
begin
Writeln('Not cutting and found a tree stump.');
case Position of
2:
begin
Writeln('Going to first position.');
MakeCompass('N');
RadialWalkTolerance(559371, 290, 90, 45, 2, -10, 3);
repeat
Wait(1000 + Random(500));
until((not(FindDTM(Stump, x, y, MSX1, MSY1, MSX2, MSY2))) and (FindDTMRotated(Yew, x, y, MSX1, MSY1, MSX2, MSY2, -Pi/4, Pi/4, Pi/60, aFound) or FindYew(x, y)))
Writeln('Tree has appeared.');
Position := 1;
end;
1:
begin
Writeln('Going to second position.');
SPS_WalkToPos(Point(4142, 2715));
MakeCompass('S');
Writeln('Waiting for tree to appear.');
repeat
Wait(1000 + Random(500));
until((not(FindDTM(Stump, x, y, MSX1, MSY1, MSX2, MSY2))) and (FindDTMRotated(Yew, x, y, MSX1, MSY1, MSX2, MSY2, -Pi/4, Pi/4, Pi/60, aFound) or FindYew(x, y)))
Writeln('Tree has appeared.');
Position := 2;
end;
end;
end;
end;
procedure BirdsNest;
begin
if FindColorSpiralTolerance(x, y, 255, MCX1, MCY1, MCX2, MCY2, 10) then
begin
if FindNest(x, y) then
begin
ClickMouse2(mouse_right);
WaitOption('ick', 400);
end;
end;
end;
procedure Bank;
begin
if (SPS_WalkPath(ToBank) = True) then
begin
Report;
case SKILLER of
'No':
begin
if FindBanker(x, y) then
begin
ClickMouse2(mouse_right);
WaitOption('Bank Banker', 400);
Wait(500 + Random(500));
if FindDTM(Log, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
MMouse(x, y, 1, 1);
ClickMouse2(mouse_right);
WaitOption('ll', 450);
CloseBank;
end;
end;
end;
'Yes':
begin
if FindBanker(x, y) then
begin
ClickMouse2(mouse_right);
WaitOption('Bank Banker', 400);
Wait(500 + Random(500));
if FindDTM(Log, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
MMouse(x, y, 3, 3);
ClickMouse2(mouse_right);
WaitOption('ll', 300);
CloseBank;
end;
end;
end;
end;
end;
end;
procedure YewChopping;
var
t: integer;
begin
if InvFull then
begin
ToTheBank;
Bank;
Wait(RandomRange(1000, 1500));
ToTheYews;
end;
if (SPS_WalkPath(ToYews) = True) then
begin
SetAngle(SRL_ANGLE_HIGH);
Wait(200 + Random(400));
if (not(Cutting)) then
Writeln('Not cutting at the moment.');
begin
if (FindDTMRotated(Yew, x, y, MSX1, MSY1, MSX2, MSY2, -Pi/4, Pi/4, Pi/60, aFound)) or (FindYew(x, y)) then
begin
Writeln('Yew Has Been Found');
Wait(10 + Random(20));
MMouse(x, y, 2, 2);
if WaitUpTextMulti(['hop', 'ew'], 1500) then
begin
ClickMouse2(True);
FindNormalRandoms;
MarkTime(t);
Wait(10 + Random(45));
AntiBan;
end else ReLocate;
if (Cutting and (t = (ANTIBANTIME * 60))) then
begin
Writeln('Currently cutting, time to perform antiban.');
Antiban;
end;
end else Writeln('Cannot find Yew');
end;
repeat
Wait(50 + Random(100));
FindNormalRandoms;
until((not(Cutting)));
end;
end;
begin
{$IFDEF SIMBAMAJOR980}
SMART_SERVER := 24;
SMART_MEMBERS := TRUE;
SMART_SIGNED := TRUE;
SMART_SUPERDETAIL := FALSE;
{$ELSE}
SMART_FIXSPEED := TRUE;
{$ENDIF}
Writeln('Starting Up........');
ActivateClient;
SetupSRL;
SPS_Setup(RUNESCAPE_SURFACE, ['10_6']);
DeclarePlayers;
DTMS;
YewColor;
BankerColor;
if not (LoggedIn) then
begin
LoginPlayer;
end;
Wait(1000 + Random(400));
ClearDebug;
FindNormalRandoms;
ClickNorth(SRL_ANGLE_HIGH);
Position := 1;
repeat
if (InvCount < 28) then
begin
Writeln('Inventory is not full');
ToTheYews;
repeat
YewChopping;
until(InvFull)
end;
if InvFull then
begin
Writeln('Inventory is full.');
ToTheBank;
Bank;
end;
until(false);
FrDTMS;
end.Hopefully someone can see something I can't