Camaro'
2011-03-21 15:00:36
I have two scripts which I have worked on in the past. One is a fully color guild miner, which was developed like a month ago, its really close to being finished but it needs some tweaking and the other is a reflection yew chopper. Which isn't that close to being finished. Any of the functions are free to use without giving credit, and if you fix up the script, you don't have to credit me if you release it(send me a PM so I can look at it :) )
Guild Miner
Fally South Yew Chopper:
I can't continue to develop either of these, so I am releasing them incomplete as a hope for some one to use these.
Guild Miner
program Untitled;
//{$DEFINE SMART}
{.include srl/srl.scar}
{.include srl/srl/misc/debug.scar}
const
MineMith = False; // Mine mith along with coal? //Not supported yet
MineWait = 7; //Seconds to wait while mining a rock(will stop waiting if the inventory count increases by one or the rock is gone)
procedure DeclarePlayers;
begin
Disguise('Windows Live Messenger');
HowManyPlayers:= 1;
CurrentPlayer:= 0;
NumberOfPlayers(HowManyPlayers);
Players[0].Name := 'hh'; // Username.
Players[0].Pass := 'boobs'; // Password.
Players[0].Nick := 'illy'; // 2-4 letters of Username (that are not capital letters or numbers).
Players[0].Active := True;
Players[0].Pin := '0000'; // pin
Players[0].Booleans[0] := True;//Starting in mine?
end;
var
Equipped: Boolean;
CoalPrice, MithPrice, Loads, CoalMined, MithMined: Integer;
Colors, mColors: TIntegerArray;
Cd, FS , tx, ty: Integer;
function Walking(Color, Tolerance: Integer; SortFrom: tpoint): Boolean;
var
i, x, y: Integer;
TPA: TPointArray;
begin
if not LoggedIn then Exit;
if FindNormalRandoms then
if not LoggedIn then
Exit;
FindColorsSpiralTolerance(MMCX, MMCY, TPA, Color, MMX1, MMY1, MMX2, MMY2, Tolerance);
SortTPAFrom(TPA, SortFrom);
for i := 0 to High(TPA) do
begin
x := TPA[i].x;
y := TPA[i].y;
if (not rs_OnMinimap(x, y)) then
Continue;
Mouse(x, y, 6, 6, true);
Wait(1500 + Random(1500));
Result := True;
Break;
end;
end;
procedure ProgressReport;
var
M, P: Integer;
begin
Writeln('Camaro''s Guild Miner');
Writeln('Time Running: '+TimeRunning+'');
Writeln('Loads: '+ToStr(Loads)+'');
Writeln('Coal Mined: '+ToStr(CoalMined)+'');
if (MithMined > 0) then
Writeln('Mith Mined: '+ToStr(MithMined)+'');
M := ((CoalMined * CoalPrice) + (MithMined * MithPrice));
Writeln('Money Gained : '+ToStr(M)+'');
if (M > 0) then
begin
P := Round((m * 3600) / (GetTimeRunning / 1000));
Writeln('Money / HR: '+ToStr(P)+'');
end;
end;
procedure EndScript(Reason: String);
begin
Writeln('Terminating....');
Writeln('Reason: '+Reason+'');
ProgressReport;
TerminateScript;
end;
procedure CustomFlag;
var
t: Integer;
begin
repeat
Wait(RandomRange(200, 500));
t := (GetSystemTime + 15000);
if ((not FlagPresent) and (IsMoving)) then
begin
Wait(RandomRange(300, 700));
Continue;
end;
if (FlagDistance <= 0) or (not IsMoving) then
Exit;
if FindNormalRandoms then
if not LoggedIn then
Exit;
//Writeln('Flag Distance = '+ToStr(FlagDistance)+'');
until((not (FlagPresent)) and (not (IsMoving))) or (t < GetSystemTime);
end;
function AtUpLadder: Boolean;
var
TPA : TPointArray;
begin
if (not(LoggedIn)) then Exit;
CustomFlag;
FindColorsTolerance(TPA, 1787389, 608, 70, 640, 97, 20);
//Writeln('Length of red = '+ToStr(Length(TPA))+'');
if (Length(TPA) < 1) then
Exit;
if (Length(TPA) > 13) then
begin
Result := True;
Exit;
end;
end;
function GoDownLadder: Boolean; forward;
function A_WalkToLadder: Boolean;
begin
if (not(LoggedIn)) then Exit;
if (Walking(1787389, 25, Point(658, 147))) then
begin
CustomFlag;
if (AtUpLadder) then
begin
Result := True;
Writeln('Arrived at ladder, ready to enter mine');
Exit;
end else
begin
Result := GoDownLadder;
end;
//EndScript('Couldn''t determine if we arrived at the ladder to enter the mine');
end;
EndScript('Couldn''t walk to the ladder from the bank');
end;
function InMine: Boolean;
begin
Result := CountColorTolerance(327939, MMX1, MMY1, MMX2, MMY2, 20) > 750;
end;
//SRL
function CustomFindObjTPA(var X, Y: Integer; Color, Tol, CTS, ObjWidth, ObjHeight, minCount: Integer; UpText: TStringArray): Boolean;
var
I, tCTS: Integer;
myPoint: TPoint;
Points: TPointArray;
aPoints: T2DPointArray;
begin
Result := False;
if not LoggedIn then exit;
tCTS := GetColorToleranceSpeed;
CTS := Integer(CTS * 9 mod 3 <> 0);
ColorToleranceSpeed(CTS);
FindColorsSpiralTolerance(X, Y, Points, Color, MSX1, MSY1, MSX2, MSY2, Tol);
if Length(Points) = 0 then
begin
ColorToleranceSpeed(tCTS);
Exit;
end;
SortTPAFrom(Points, Point(MSCX, MSCY));
ColorToleranceSpeed(1);
aPoints := TPAtoATPAEx(Points, ObjWidth, ObjHeight);
SortATPAFrom(aPoints, Point(MSCX, MSCY));
SetLength(Points, 0);
for I := 0 to High(aPoints) do
begin
if Length(aPoints[i]) < minCount then
Continue;
myPoint := MiddleTPA(aPoints[i]);
MMouse(myPoint.X, myPoint.Y, 0, 0);
if WaitUpTextMulti(UpText, 300) then
begin
GetMousePos(X, Y);
Result := True;
ColorToleranceSpeed(tCTS);
Exit;
end;
//Writeln('UpText = '+GetUpText+'');
end;
ColorToleranceSpeed(tCTS);
end;
function GoDownLadder: Boolean;
var
TP, MSPoint : TPoint;
I, X, Y : Integer;
TB : TBox;
begin
if (not(LoggedIn)) then Exit;
if (InMine) then Exit;
for I := 0 to 2 do
begin
if (CustomFindObjTPA(X, Y, 3960199, 10, 2, 10, 10, 10, ['mb-d'])) then
begin
Mouse(X, Y, 0, 0, True);
Wait(500 + Random(500));
CustomFlag;
WaitFunc(@InMine, 500, 7000);
Wait(2000 + Random(2000));
Result := InMine;
if (Result) then
begin
Writeln('Went down the ladder');
Exit;
end;
end;
end;
EndScript('Couldn''t make it down into the mine, ladder problem');
end;
function AboveLand: Boolean;
begin
Result := CountColorTolerance(327939, MMX1, MMY1, MMX2, MMY2, 20) < 750;
end;
function GoUpLadder: Boolean;
var
TP, MSPoint : TPoint;
I, X, Y : Integer;
TB : TBox;
begin
if (not(LoggedIn)) then Exit;
if (not (InMine)) then Exit;
for I := 0 to 4 do
begin
if (CustomFindObjTPA(X, Y, 4541776, 10, 2, 10, 10, 10, ['mb-u'])) then
begin
Mouse(X, Y, 0, 0, True);
Wait(500 + Random(500));
CustomFlag;
WaitFunc(@AboveLand, 500, 5000);
Wait(250 + Random(250));
Result := AboveLand;
if (Result) then
begin
Writeln('Went up the ladder');
Exit;
end;
end;
end;
end;
function U_WalkToRocks_Right: Boolean;
begin
if (not(LoggedIn)) then Exit;
if (not(InMine)) then Exit;
if (Walking(5855831, 22, Point(683, MMCY))) then
begin
CustomFlag;
Writeln('Walked into the mine');
Result := True;
Exit;
end;
end;
function U_WalkToRocks_Left: Boolean;
begin
if (not(LoggedIn)) then Exit;
if (not(InMine)) then Exit;
if (Walking(5855831, 22, Point(554, MMCY))) then
begin
CustomFlag;
Writeln('Walked toward the exit of the mine');
Result := True;
Exit;
end;
EndScript('Couldn''t walk out of the mine');
end;
function U_WalkDown: Boolean;
begin
if (not(LoggedIn)) then Exit;
if (not(InMine)) then Exit;
if (Walking(5855831, 22, Point(MMCX, 160))) then
begin
CustomFlag;
Writeln('Walked downards to center ourselves');
Result := True;
Exit;
end;
EndScript('Couldn''t center our selves....');
end;
function WalkInto: Boolean;
begin
if (not(LoggedIn)) then Exit;
if (not(InMine)) then Exit;
if (U_WalkToRocks_Right) then
begin
if (Random(2) = 1) then
begin
if (U_WalkToRocks_Right) then
begin
Result := True;
Writeln('Ready to mine');
Exit;
end;
end;
Result := True;
Writeln('Ready to mine');
Exit;
end;
end;
function U_WalkToLadder: Boolean;
begin
if (not(LoggedIn)) then Exit;
if (not(InMine)) then Exit;
if (Walking(340056, 22, Point(564, MMCY))) then
begin
CustomFlag;
Writeln('Walked toward the ladder of the mine');
Result := True;
Exit;
end;
end;
function GetNpcsATPA: T2DPointArray;
var
TPA: TPointArray;
ATPA : T2DPointArray;
begin
if not (LoggedIn) then Exit;
FindColorsTolerance(TPA, 195836, MMX1, MMY1, MMX2, MMY2, 20);
if (Length(TPA) < 0) then
Exit;
ATPA := TPAToATPA(TPA, 7);
Result := ATPA;
end;
function GetNPCCountDist(Dist: Integer): Integer;
var
ATPA : T2DPointArray;
I, X, Y: Integer;
begin
ATPA := GetNPCSATPA;
for I := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], x, y);
if (Distance(X, Y, MMCX, MMCY) <= Dist) then
Inc(Result);
end;
end;
function WalkOutOf: Boolean;
begin
if (not(LoggedIn)) then Exit;
if (GetNPCCountDist(15) > 0) then
U_WalkDown;
if (U_WalkToRocks_Left) then
begin
if (U_WalkToLadder) then
begin
Result := True;
Writeln('Ready to leave mine');
Exit;
end else
begin
if (U_WalkToRocks_Left) then
begin
if (U_WalkToLadder) then
begin
Result := True;
Writeln('Ready to leave mine');
Exit;
end else
EndScript('Failed to leave the mine');
end;
end;
end;
end;
function InBank : Boolean;
var
TPA : TPointArray;
ATPA : T2DPointArray;
A, X, Y: Integer;
TB : TBox;
begin
FindColorsTolerance(TPA, 195836 , MMX1, MMY1, MMX2, MMY2, 22);
ATPA := SplitTPAEx(TPA, 4, 5);
SortATPASize(ATPA, True);
for A := 0 to High(ATPA) do
begin
TB := GetTPABounds(ATPA[A]);
if (TB.X2 - TB.X1 >= 14) and (TB.Y2 - TB.Y1 >= 2) then
begin
MiddleTPAEx(ATPA[A], X, Y);
if (X < 1) or (Y < 1) then
Continue;
if (Distance(X, Y, MMCX, MMCY) < 20) then
Result := True;
Exit;
end;
end;
end;
function WalkToBankNPC : Boolean; forward;
procedure WaitUntilBank;
var
Time : Integer;
begin
if (not(LoggedIn)) then Exit;
if (InBank) then Exit;
MarkTime(Time);
repeat
Wait(500 + Random(500));
if (TimeFromMark(Time) > 60000) then
Break;
until (InBank)
if (TimeFromMark(Time) > 60000) then
begin
if (not(WalkToBankNPC)) then
begin
EndScript('Failed walking to the bank, time limit reached');
end;
end;
end;
function WalkToBankNPC : Boolean;
var
A, X, Y , U, N: Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
TB : TBox;
ABC, CB: extended;
G : integer;
begin
if not LoggedIn then Exit;
FindColorsTolerance(TPA, 195836 , MMX1, MMY1, MMX2, MMY2, 22);
ATPA := SplitTPAEx(TPA, 4, 5);
SortATPASize(ATPA, True);
for A := 0 to High(ATPA) do
begin
TB := GetTPABounds(ATPA[A]);
//Writeln('Lengths = '+ToStr(TB.X2 - TB.Y1)+', '+ToStr(TB.Y2, TB.Y1)+'');
if (TB.X2 - TB.X1 >= 14) and (TB.Y2 - TB.Y1 >= 2) then
begin
MiddleTPAEx(ATPA[A], X, Y);
if (X < 1) or (Y < 1) then
Continue;
Mouse(X, Y - 6, 5, 5, True);
Wait(500 + Random(500));
CustomFlag;
Wait(500 + Random(500));
Result := True;
Writeln('Entered the bank!');
Exit;
end;
end;
end;
function WalkCloseToBank : Boolean;
begin
if (not(LoggedIn)) then Exit;
if (Walking(2189157, 22, Point(648, 24))) then
begin
CustomFlag;
Writeln('Walking to the bank...');
Result := True;
Exit;
end;
end;
function WalkToBank: Boolean;
begin
if (not(LoggedIn)) then Exit;
if not WalkToBankNPC then
begin
if (WalkCloseToBank) then
begin
if (WalkToBankNPC) then
begin
Result := True;
WaitUntilBank;
Exit;
end;
EndScript('Failed to walk to the bank');
end else
begin
EndScript('Failed to walk to the bank');
end;
end else
begin
WaitUntilBank;
Result := True;
end;
end;
function CustomOpenBank: Boolean;
var
X, Y, I: Integer;
begin
if (not(LoggedIn)) then Exit;
Writeln('Opening bank');
for I := 0 to 2 do
begin
if (CustomFindObjTPA(X, Y, 4876933, 12, 2, 9, 7, 10, ['ank'])) then
begin
Mouse(X, Y, 0, 0, False);
if (WaitOption('uick', 400)) then
begin
if FindNormalRandoms then
if not LoggedIn then
Exit;
Wait(500 + Random(500));
CustomFlag;
WaitFunc(@BankScreen, 200, 5000);
Result := BankScreen;
if (Result) then
begin
Writeln('Opened the bank');
Exit;
end else
begin
if (PinScreen) then
InPin(Players[CurrentPlayer].Pin);
WaitFunc(@BankScreen, 200, 5000);
end;
end;
end;
end;
EndScript('Opening the bank failed somewhere');
end;
function Bank: Boolean;
begin
if (not(LoggedIn)) then Exit;
if (not(BankScreen)) then Exit;
if (PinScreen) then
InPin(Players[CurrentPlayer].Pin);
if (Equipped) then
DepositAll
else
Deposit(2, 28, True);
Wait(2000 + Random(1500));
if (InvCount < 5) then
begin
Result := True;
Inc(Loads);
if (Random(2) = 1) then
CloseBank;
Exit;
end;
EndScript('Failed Depositing');
end;
function ConvertPrice(input: string): Integer; // Credit to BlumbleBee for this function
var
f: Extended;
begin
input := Replace(Lowercase(Trim(input)), ',', '');
if (Pos('m', input) > 0) then
f := StrToFloatDef(Copy(input, 1, Pos('m', input) - 1), 0) * 1000000
else if (Pos('k', input) > 0) then
f := StrToFloatDef(Copy(input, 1, Pos('k', input) - 1), 0) * 1000
else
f := StrToFloatDef(Input, 0);
Result := Round(f);
end;
procedure SetupShit;
var
S, T: String;
begin
Writeln('Getting prices... please wait');
//S := GetPage('http://services.runescape.com/m=itemdb_rs/Coal/viewitem.ws?obj=453');
CoalPrice := ConvertPrice(Between('guide price:</b>', '<br>', S));
//T := GetPage('http://services.runescape.com/m=itemdb_rs/Coal/viewitem.ws?obj=447');
MithPrice := ConvertPrice(Between('guide price:</b>', '<br>', T));
DeclarePlayers;
LoginPlayer;
MakeCompass('n');
Wait(RandomRange(300, 600));
SetAngle(True);
Wait(RandomRange(300, 600));
GameTab(Tab_Inv);
Wait(RandomRange(300, 600));
MMouse(576, 225, 7, 7);
if (not(WaitUpText('kax', 500))) then
begin
Wait(RandomRange(300, 600));
GameTab(Tab_Inv + 1);
Wait(RandomRange(300, 600));
MMouse(586, 303, 7, 7);
if (not(WaitUpText('kax', 500))) then
EndScript('Failed finding a pickaxe, if its in the inventory, please put it in the first slot');
Equipped := True;
end;
Wait(RandomRange(300, 600));
GameTab(Tab_Inv);
end;
procedure AntiBanHam;
begin
case Random(40) of
0..3 : Wait(1);
4..13 : MMouse(Random(500), Random(500), 0, 0);
14 :
begin
HoverSkill('mining', False);
GameTab(Tab_Inv);
end;
15 :
begin
GameTab(22);
Wait(1000 + Random(3000));
GameTab(Tab_Inv);
end;
16 :
begin
if (Random(2) = 1) then
begin
Keydown(VK_RIGHT);
Wait(300+random(1500));
KeyUp(VK_RIGHT);
end else
begin
Keydown(VK_LEFT);
Wait(300 + Random(1500));
KeyUp(VK_LEFT);
end;
Wait(1400 + Random(1400));
MakeCompass('N');
SetRun(True);
end;
end;
end;
function ClosestOreGone: Boolean;
var
X, Y, A, I, II, L, M, curCTS, ClickColor: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
Result := False;
if not LoggedIn then exit;
curCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 2634548, MSX1, MSY1, MSX2, MSY2, 11);
if Length(TPA) > 0 then
begin
ColorToleranceSpeed(1);
ATPA := TPAtoATPAEx(TPA, 5, 5);
M := High(ATPA);
SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY));
for A := 0 to M do
begin
if MiddleTPAEx(ATPA[A], X, Y) then
begin
if(Distance(X, Y, MSCX, MSCY) > 50) then
begin
Result := True;
Exit;
end else
Exit;
Break;
end;
end;
end;
ColorToleranceSpeed(curCTS);
end;
procedure WaitTillOre(I: Integer; Coal: Boolean);
var
Time, C: Integer;
begin
C := InvCount;
MarkTime(Time);
repeat
if (ClosestOreGone) then
begin
//Writeln('Ore we were mining is gone');
Exit;
end;
//Writeln('Waiting '+ToStr((I * 1000) - TimeFromMark(Time))+' MS before mining again');
if (Random(5) > 3) then
AntiBanHam;
Wait(100 + Random(200));
if FindNormalRandoms then
if not LoggedIn then
Exit;
if (InvCount > C) then
begin
if (Coal) then
Inc(CoalMined)
else
Inc(MithMined);
Exit;
end;
if (TimeFromMark(Time) > (I * 1000)) then
Exit;
until False
end;
function MineCoal: Boolean;
var
Colors: TIntegerArray;
X, Y, I, A, M, curCTS: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
Result := False;
if not LoggedIn then exit;
curCTS := GetColorToleranceSpeed;
Colors := [2239532, 2640985, 2503218, 2042153];
for I := 0 to 3 do
begin
if (IsMoving) then Exit;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, Colors[I], MSX1, MSY1, MSX2, MSY2, 6 + (i * 2));
if Length(TPA) = 0 then Continue;
ColorToleranceSpeed(1);
ATPA := TPAtoATPAEx(TPA, 6, 6);
M := High(ATPA);
for A := 0 to M do
if MiddleTPAEx(ATPA[A], X, Y) then
begin
MMouse(X, Y, 9, 9);
if (WaitUpText('ine', 200)) then
begin
GetMousePos(X, Y);
Mouse(X, Y, 0, 0, True);
Result := True;
ColorToleranceSpeed(curCTS);
Exit;
end;
end;
end;
ColorToleranceSpeed(curCTS);
end;
function CalibrateToSymbol: Boolean;
var
I, tCTS: Integer;
myPoint: TPoint;
Points: TPointArray;
aPoints: T2DPointArray;
begin
Result := False;
if not LoggedIn then exit;
tCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MMCX, MMCY, Points, 2905984, MMX1, MMY1, MMX2, MMY2, 7);
if Length(Points) = 0 then
begin
ColorToleranceSpeed(tCTS);
Exit;
end;
SortTPAFrom(Points, Point(MMCX, MMCY));
ColorToleranceSpeed(1);
aPoints := TPAtoATPAEx(Points, 4, 4);
SortATPASize(aPoints, False);
SetLength(Points, 0);
for I := 0 to High(aPoints) do
begin
if Length(aPoints[i]) < 2 then
Continue;
myPoint := MiddleTPA(aPoints[i]);
if (rs_OnMinimap(myPoint.x, myPoint.y)) then
begin
if (Distance(myPoint.x, myPoint.y, MMCX, MMCY) < 20) then
begin
Mouse(myPoint.x, myPoint.y, 50, 50, True)
end else
Mouse(myPoint.x, myPoint.y, 20, 20, True);
CustomFlag;
Result := True;
Exit;
end;
end;
ColorToleranceSpeed(tCTS);
end;
label minetime;
var
k : Integer;
begin
//Smart_Server := 30;
//Smart_Members := false;
//Smart_Signed := True;
SetUpSRL;
SetupShit;
CoalPrice := 177;
Writeln('Pick Equipped = '+ToStr(Equipped)+'');
Writeln('Coal Price= '+ToStr(CoalPrice)+'');
Writeln('Mith Price = '+ToStr(MithPrice)+'');
repeat
if (InMine) then goto minetime;
if (A_WalkToLadder) then
if (GoDownLadder) then
if (WalkInto) then
begin
minetime:
repeat
if (InvFull) then Break;
if (MineCoal) then
begin
FS := 0;
CustomFlag;
Wait(RandomRange(200, 500));
WaitTillOre(MineWait, True);
end else
begin
FS := FS + 1;
end;
Wait(400 + Random(400));
//Writeln('FS = '+ToStr(FS)+'');
if (FS > 3) then
if (CalibrateToSymbol) then
FS := -3;
until InvFull;
end;
if (InvFull) then
if (WalkOutOf) then
if (GoUpLadder) then
if (WalkToBank) then
if (CustomOpenBank) then
begin
if (Bank) then
begin
ProgressReport;
end;
end;
until false
end.Fally South Yew Chopper:
program Untitled;
{$DEFINE SMART}
{.include SRL/SRL.scar}
{.include Reflection/Reflection.Simba}
Const
DebugScript = True; //Leave to true for early stages please..
var
CurrLoads, Loads, Antibans, Yews: Integer;
AntibanType : Integer; //1 = Chopping | 2 = Walking | 3 = Waiting for yews
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := 's want'; //Runescape Username
Pass := ''; //Runescape Password
Nick := 'ole'; //Nickname for randoms and progress report
Pin := ''; //Bank pin
Active := True;
Integers[0] := 3; //Loads until switch characters
Integers[1] := 15; //Loads in total for this character
//Integers[20] = Characters loads done in all
end;
end;
procedure Debug(S : String);
begin
if (DebugScript) then
Writeln(TheTime +' | '+ S);
end;
function LoadPathToTrees: TTileArray;
begin
SetLength(Result, 4);
Result[0] := Tile(3012, 3355);
Result[1] := Tile(3007, 3342);
Result[2] := Tile(3007, 3326);
Result[3] := Tile(3007, 3315);
end;
function RightTree: TTile;
begin
Result := Tile(3018, 3315);
end;
function LeftTree: TTile;
begin
Result := Tile(2995, 3311);
end;
function WalkTowardTile(T : TTile) : Boolean;
var
Ti, Me : TTile;
Tr, tx, ty : Integer;
begin
if not LoggedIn then
Exit;
Tr := 0;
Debug('Can''t find next tile. Trying to walk closer.');
while not TileOnMM(T) do
begin
Me := GetMe.Tile;
tx := (T.x - Me.x)/2 + Me.x;
ty := (T.y - Me.y)/2 + Me.y;
Ti := Tile(tx, ty);
if TileOnMM(Ti) then
WalkToTile(Ti, 3, 3)
else
T := Ti;
if Tr > 5 then
begin
Result := False;
Exit;
end;
end;
Result := WalkToTile(T, 2, 0);
end;
procedure Walk(ToBank : Boolean);
var
k, I : Integer;
Path : TTileArray;
begin
if not LoggedIn then
Exit;
Path := LoadPathToTrees;
if (ToBank) then
InvertPath(Path);
if (ToBank) then
begin
if (DistanceFrom(Path[High(Path)]) < 7) then
begin
Debug('Location : Bank; Depositing...');
Exit;
end;
end else
begin
if (DistanceFrom(Path[High(Path)]) < 7) then
begin
Debug('Location : Trees; Chopping...');
Exit;
end;
end;
SetRun(True);
for I := 0 to High(Path) do
begin
if not(WalkToTile(Path[I], 2, 5)) then
begin
if not (WalkTowardTile(Path[I])) then
begin
Debug('Failed Walking: '+ToStr(ToBank)+'');
Players[CurrentPlayer].Active := False;
Players[CurrentPlayer].Loc := 'Failed Walking: '+ToStr(ToBank)+'';
Logout;
Exit;
end;
end;
end;
end;
function YewSetup: TPoint;
var
Curr, Yew: TRSObjectArray;
label procStart;
begin
procStart:
if (not(LoggedIn)) then Exit;
Curr := GetObjectsByID(1309, 0, 52);
Yew := SortObjects(Curr);
if (Length(Yew) > 0) then
begin
if (TileOnMS(Yew[0].Tile, GetTileHeight(Yew[0].Tile))) then
begin
Result := TileToPoint(Yew[0].Tile);
if (Result.X > 0) then
begin
Debug('Yew point = ('+ToStr(Result.X)+', '+ToStr(Result.Y)+')');
if (DistanceFrom(RightTree) < 7) then
Debug('Location: Right Yews')
else
Debug('Location: Left Yews');
Exit;
end else
Exit;
end else
begin
if ((DistanceTile(Yew[0].Tile, RightTree) < 6) or (DistanceTile(Yew[0].Tile, LeftTree) < 6)) then
begin
if (not(WalkToTile(Yew[0].Tile, 1, 0))) then
begin
WalkTowardTile(Yew[0].Tile);
goto procStart;
end;
end;
end;
end else
begin
AntiBanType := 3;
end;
end;
function ChopYew(TP : TPoint): Boolean;
var
Colors: TIntegerArray;
X, Y, I, A, M, curCTS: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
if not LoggedIn then Exit;
curCTS := GetColorToleranceSpeed;
Colors := [6462351, 3435358, 3169875];
for I := 0 to 3 do
begin
if (IsMoving) then Exit;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, Colors[i], TP.X - 20, TP.Y - 39, TP.X + 10, TP.Y + 6, 9 + (i * 2));
if Length(TPA) = 0 then Continue;
ColorToleranceSpeed(1);
ATPA := TPAtoATPAEx(TPA, 12, 12);
M := High(ATPA);
for A := 0 to M do
if MiddleTPAEx(ATPA[A], X, Y) then
begin
MMouse(X, Y, 9, 9);
if (WaitUpText('ew', 200)) then
begin
GetMousePos(X, Y);
Mouse(X, Y, 0, 0, True);
WaitToMove(1500);
R_Flag;
Result := True;
ColorToleranceSpeed(curCTS);
Exit;
end;
end;
end;
ColorToleranceSpeed(curCTS);
end;
procedure SetupPlayer;
begin
ClickNorth(True);
Wait(RandomRange(300, 600));
GameTab(Tab_Inv);
Wait(RandomRange(300, 600));
MMouse(576, 225, 7, 7);
if (not(WaitUpText('atch', 500))) then
begin
Wait(RandomRange(300, 600));
GameTab(Tab_Inv + 1);
Wait(RandomRange(300, 600));
MMouse(586, 303, 7, 7);
if (not(WaitUpText('atch', 500))) then
begin
Debug('Found no hatchet: Please either equip it, or put it in the first inventory slot.');
Players[CurrentPlayer].Active := False;
Players[CurrentPlayer].Loc := 'No hatchet';
Logout;
end;
end;
Wait(RandomRange(300, 600));
GameTab(Tab_Inv);
CurrLoads := 0;
end;
procedure SwitchPlayers(Act: Boolean);
begin
if ((PlayersActive < 2) and (Act)) then
begin
Debug('Last player left, waiting for a little before logging back in.');
Logout;
Wait(120000 + Random(70000));
end;
NextPlayer(Act);
SetupPlayer;
end;
begin
SetupSRL;
DeclarePlayers;
SetupPlayer;
repeat
repeat
Walk(False);
repeat
ChopYew(YewSetup);
Wait(RandomRange(1500, 2500));
if (GetAnimation > 1) then
begin
AntiBanType := 1;
repeat
Wait(500 + Random(500));
Antiban;
R_FindRandoms;
until (GetAnimation < 2)
AntibanType := 3;
end;
Antiban;
if (not(LoggedIn)) then Break;
until (InvFull)
Walk(True);
until ((CurrLoads > Players[CurrentPlayer].Integers[0]) or (Players[CurrentPlayer].Integers[20] > Players[CurrentPlayer].Integers[1]) or (not(LoggedIn)))
//If players switching time is up, or the players total loads is up, or the player is not logged in peform a switch.
SwitchPlayers(Players[CurrentPlayer].Active);
until (False);
end.I can't continue to develop either of these, so I am releasing them incomplete as a hope for some one to use these.