SRL Archive - RuneScape Private-Server Scripts

Spawnpk cosmic wyrm smasher w/ afk guard support


imalama101

2024-08-29 08:54:17

ENJOY! USE AT YOUR OWN RISK

Note that I never intended to release this since its my own work (but fuck these owners IDC anymore), please excuse the minor imperfections in syntax grammar ect. Script does function perfect regardless of this.
program Cosmicwyrm;
//scroll all the way down for instructions
const
STOP_KEY = 113; //choose a key to stop the script (f2 to stop)//was 113
MOUSE_MOVE = 3;

Var
CurrentlyDoing, MonsterName, PlayerName: String;
est, currenttime, lastcount, currentcount, numberGuards, totalkills, numberKills, Last1MHealthPoints, Last2MHealthPoints: integer; //paint
GlobalTPA: tpoint; //mm2ms
ctc, AFKclicktime, stoptime, switchtime,cleartime, Guardtime, prayclickTime, writetimeZero, endtime, runTime, specTime, mclickTime, cmbTime, writeTime1, writeTime2: extended;
LastCMB, CurrentCMB, Guard, haveGLB: Boolean;

//Basic functions DO NOT TOUCH/Change
function FindColors(var TPA: TPointArray; Color: Int32; b: TBox): Boolean; Overload;
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
Result := FindColors(TPA, Color, b.x1, b.y1, b.x2, b.y2);
end;

procedure Wait(w1, w2: Int32); Overload;
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
Wait(Random(w1, w2));
end;

procedure FastClick(Button: Byte);
var
x, y: integer;
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
GetMousePos(x, y);
clickMouse(x, y, Button);
Wait(11, 22 );
end;

procedure Mouse(P: TPoint; Button: Byte);
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
MoveMouse(P.X, P.Y);
if (Button = MOUSE_MOVE) then Exit;
Wait(22);
FastClick(Button);
end;

procedure Mouse(X, Y: Int32; Button: Byte); Overload;
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
Mouse(Point(X, Y), Button);
end;

procedure MouseBox(const B: TBox; Button: Byte);
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
Mouse(Point(B.X1 + Random(B.X2 - B.X1), B.Y1 + Random(B.Y2 - B.Y1)), Button);
end;

procedure MouseBoxTab(const B: TBox; Button: Byte);
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
Mouse(Point((B.X2 -37), 764), Button);
end;

function FindTextIn(var Matches: TPointArray; const Text, Font: String; const Color: Int32; const B: TBox): Boolean;
var
w, h: Int32;
TPA, TextTPA: TPointArray;
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
if FindColors(TPA, Color, B.X1, B.Y1, B.X2, B.Y2) then
begin
SetLength(Matches, 0);
TextTPA := TPAFromText(Text, Font, w, h);
Result := FindTextTPAinTPA(h-1, TextTPA, TPA, Matches);
end;
end;

function WaitFunc(Func: function: Boolean; WaitTime, WaitInterval: Int32; Condition: Boolean = True): Boolean;
var
t: UInt32;
begin
t := GetTickCount() + WaitTime;
repeat
if IsKeyDown(STOP_KEY) then TerminateScript();
Result := Func();
if (Result = Condition) then Exit(True);
Wait(WaitInterval);
until (GetTickCount() > t);
Result := False;
end;

function GetUpText(): String;
const
COL = $006699;
var
BMP, w, h, OldT, NewT: Int32;
B: TBox;
TPA: TPointArray;
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
if FindColors(TPA, 16777215, 8, 33, 295, 55) then
begin
OldT := GetImageTarget();
B := GetTPABounds(TPA);
BMP := BitmapFromClient(B.X1, B.Y1, B.X2+1, B.Y2+1);

FastReplaceColor(BMP, $FFFFFF, COL); //White
FastReplaceColor(BMP, 4231423, COL); //Light Orange (invo
FastReplaceColor(BMP, $FFFF00, COL); //Cyan
FastReplaceColor(BMP, $00FF00, COL); //Green
FastReplaceColor(BMP, 65535, COL); //Yellow)
FastReplaceColor(BMP, 28927, COL); //Orange (pray)

GetBitmapSize(BMP, w, h);

try
SetTargetBitmap(BMP);
Result := GetTextAtEx(0, 0, w-1, h-1, 0, 4, 4, COL, 0, 'UpChars07');
finally
NewT := GetImageTarget();
SetImageTarget(OldT);
FreeTarget(NewT);
if BitmapExists(BMP) then FreeBitmap(BMP);
end;
end;
end;

function IsUpText(const S: String): Boolean;
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
Result := (Pos(S, GetUpText()) > 0);
end;

function IsUpText(const SS: TStringArray): Boolean; Overload;
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
Result := IsArrInStr(SS, GetUpText());
end;

function GetTabBox(const Tab: Int32): TBox;
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
if (not InRange(Tab, 1, 7)) then Exit;
Result.X1 := 499 + (Tab * 33);
Result.X2 := Result.X1 + 32;
Result.Y1 := 197;
Result.Y2 := 232;
end;

function IsTabActive(const Tab: Int32): Boolean;
const
COLOR = 1515095;
TOL = 30;
var
B: TBox;
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
if (not InRange(Tab, 1, 7)) then Exit;
B := GetTabBox(Tab);
Result := (CountColorTolerance(COLOR, B.X1, B.Y1, B.X2, B.Y2, TOL) > 200);
end;

function ClickTab(const Tab: Int32): Boolean;
var
t: UInt32;
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
if IsTabActive(Tab) then Exit(True);
MouseBox(GetTabBox(Tab), MOUSE_LEFT);
t := GetTickCount() + 100;
repeat
if IsKeyDown(STOP_KEY) then TerminateScript();
Result := IsTabActive(Tab);
if Result then Exit;
Wait(20);
until (GetTickCount() > t);
end;

procedure MarkTime();
begin
ctc := GetSystemTime;
end;

procedure TimeFromMark();
begin
currentTime := round(GetSystemTime - ctc) div 1000;
end;

function MM2MS(TPA: TPoint): TPoint; //could use a clean up one day, maybe reverify tiles
var
a, b, c, d, e, f, g, h: extended;
cnst: TExtendedArray;
xx, yy, yyy, xxx: integer;
begin
GlobalTPA := Point(TPA.x,TPA.y);
//solved the system for these values, extened zoom camera highest and centered.
cnst := [
4, // a = fixed scale factor in X direction with scale Y unchanged.
0, // b = scale factor in X direction proportional to Y distance from origin.
263, // c = origin translation in X direction.
0, // d = scale factor in Y direction proportional to X distance from origin.
4, // e = fixed scale factor in Y direction with scale X unchanged.
202, // f = origin translation in Y direction.
0, // g = proportional scale factors X and Y in function of X.
0 // h = proportional scale factors X and Y in function of Y.
];

a := cnst[0]; b := cnst[1]; c := cnst[2]; d := cnst[3];
e := cnst[4]; f := cnst[5]; g := cnst[6]; h := cnst[7];
//writeln('x');
//Writeln(round((a*TPA.x + b*TPA.y +c)/(g*TPA.x + h*TPA.y +1)));
//writeln('y');
//writeln(round((d*TPA.x + e*TPA.y +f)/(g*TPA.x + h*TPA.y +1)));
//Result.x := round((a*TPA.x + b*TPA.y +c)/(g*TPA.x + h*TPA.y +1));
xx := Round(((a*TPA.x + b*TPA.y +c)/(g*TPA.x + h*TPA.y +1)));
yy := Round((d*TPA.x + e*TPA.y +f)/(g*TPA.x + h*TPA.y +1));
//Result.y := Round((d*TPA.x + e*TPA.y +f)/(g*TPA.x + h*TPA.y +1));
//movemouse(xx,yy);

//y y = 4E-10x6 + 6E-09x5 - 2E-06x4 + 2E-05x3 + 0.0127x2 - 0.3978x + 1.4553
yyy := Round((0.0000000004*TPA.y*TPA.y*TPA.y*TPA.y*TPA.y*TPA.y)+(0.000000006*TPA.y*TPA.y*TPA.y*TPA.y*TPA.y)
+(-0.000002*TPA.y*TPA.y*TPA.y*TPA.y)+(0.00002*TPA.y*TPA.y*TPA.y)+(0.0127*TPA.y*TPA.y)+(-0.3978*TPA.y)+(1.4553));
Result.y := yyy +yy;
//x
// piecewise
if (TPA.x < -30) then //y = -3E-05x4 - 0.0048x3 - 0.3345x2 - 10.17x - 108.51
begin
//x tile -15 to infin
xxx := Round((-0.00003*TPA.x*TPA.x*TPA.x*TPA.x)+(-0.0048*TPA.x*TPA.x*TPA.x)+(-0.3345*TPA.x*TPA.x)+(-10.17*TPA.x)+(-108.51));
Result.x := xxx +xx;
exit();
end;

if (TPA.x < -14) or (TPA.x = -30) then //y = -0.0013x3 - 0.0949x2 - 2.2626x - 12.642
begin
//x tile -8 to -4
xxx:= Round((-0.0013*TPA.x*TPA.x*TPA.x)+(-0.0949*TPA.x*TPA.x)+(-2.2626*TPA.x)+(-12.642));
Result.x := xxx +xx;
exit();
end;

if (TPA.x < -2) or (TPA.x = -14) then //y = -0.0026x3 - 0.0781x2 - 0.7396x + 1.8125
begin
//x tile -4 to -1
xxx := Round((-0.0026*TPA.x*TPA.x*TPA.x)+(-0.0781*TPA.x*TPA.x)+(-0.7396*TPA.x)+(1.8125));
Result.x := xxx +xx;
exit();
end;

if (TPA.x < 0) then //y = -0.375x2 - 3.25x - 2
begin
//x tile -1 to 0
xxx := Round((-0.375*TPA.x*TPA.x)+(-3.25*TPA.x)+(-2));
Result.x := xxx +xx;
exit();
end;

if (TPA.x > 50) or (TPA.x = 50) then //y = -0.0026x3 + 0.4219x2 - 22.74x + 401.81
begin
//x tile 13 to infin
xxx := Result.x := Round((0.000000002*TPA.x*TPA.x*TPA.x*TPA.x*TPA.x*TPA.x)+(-0.0000003*TPA.x*TPA.x*TPA.x*TPA.x*TPA.x)
+(0.00002*TPA.x*TPA.x*TPA.x*TPA.x)+(-0.0003*TPA.x*TPA.x*TPA.x)+(0.0006*TPA.x*TPA.x)+(-0.053*TPA.x)+(-1.9326));
Result.x := xxx +xx;
exit();
end;

if (TPA.x > 34) or (TPA.x = 34) then //y = -0.0002x4 + 0.026x3 - 1.556x2 + 41.146x - 411.27
begin
//x tile 9 to 13
xxx := Result.x := Round((0.000000002*TPA.x*TPA.x*TPA.x*TPA.x*TPA.x*TPA.x)+(-0.0000003*TPA.x*TPA.x*TPA.x*TPA.x*TPA.x)
+(0.00002*TPA.x*TPA.x*TPA.x*TPA.x)+(-0.0003*TPA.x*TPA.x*TPA.x)+(0.0006*TPA.x*TPA.x)+(-0.053*TPA.x)+(-1.9326));
Result.x := xxx +xx;
exit();
end;

if (TPA.x > 22) {or (TPA.x = 22)} then //y = -0.0026x3 + 0.2031x2 - 5.2396x + 40.687
begin
//x tile 6 to 9
xxx := Round((-0.0026*TPA.x*TPA.x*TPA.x)+(0.2031*TPA.x*TPA.x)+(-5.2396*TPA.x)+(40.687));
Result.x := xxx +xx;
exit();
end;

if (TPA.x > 10) or (TPA.x = 10) then //y = -0.0026x3 + 0.1094x2 - 1.4896x + 3.5625
begin
//x tile 3 to 6
xxx := Round((-0.0026*TPA.x*TPA.x*TPA.x)+(0.1094*TPA.x*TPA.x)+(-1.4896*TPA.x)+(3.5625));
Result.x := xxx +xx;
exit();
end;

if (TPA.x > 0) or (TPA.x = 0) then //y = -0.0031x3 + 0.025x2 - 0.0375x - 2
begin
//x tile 0 to 3
xxx := Round((-0.0031*TPA.x*TPA.x*TPA.x)+(0.025*TPA.x*TPA.x)+(-0.0375*TPA.x)+(-2));
Result.x := xxx +xx;
exit();
end;
{
//non piece wise
if (TPA.x < 0) then //y = -7E-10x6 - 2E-07x5 - 3E-05x4 - 0.0012x3 - 0.0274x2 - 0.3415x + 2.4796
begin
// neg x doesnt include 0
Result.x := Round((-0.0000000007*TPA.x*TPA.x*TPA.x*TPA.x*TPA.x*TPA.x)+(-0.0000002*TPA.x*TPA.x*TPA.x*TPA.x*TPA.x*TPA.x)
+(-0.00003*TPA.x*TPA.x*TPA.x*TPA.x*TPA.x)+(-0.0012*TPA.x*TPA.x*TPA.x)+(-0.0274*TPA.x*TPA.x)+(-0.3415*TPA.x)+(2.4796)+xx);
end;

if (TPA.x > 0) or (TPA.x = 0) then //y = 2E-09x6 - 3E-07x5 + 2E-05x4 - 0.0003x3 + 0.0006x2 - 0.053x - 1.9326
begin
// Pos x does include 0
Result.x := Round((0.000000002*TPA.x*TPA.x*TPA.x*TPA.x*TPA.x*TPA.x)+(-0.0000003*TPA.x*TPA.x*TPA.x*TPA.x*TPA.x)
+(0.00002*TPA.x*TPA.x*TPA.x*TPA.x)+(-0.0003*TPA.x*TPA.x*TPA.x)+(0.0006*TPA.x*TPA.x)+(-0.053*TPA.x)+(-1.9326));
end; }
end;

//Checks
function GetSpecPoints(): Int32;
var
TPA: TPointArray;
const
B: TBox = [558, 177, 581, 191];
begin
if FindColors(TPA, 65280, B.X1, B.Y1, B.X2, B.Y2) then
begin
Result := StrToIntDef(GetTextATPA(ClusterTPA(TPA, 1), 5, 'StatChars07'), -1);
end;
if FindColors(TPA, 65535, B.X1, B.Y1, B.X2, B.Y2) then
begin
Result := StrToIntDef(GetTextATPA(ClusterTPA(TPA, 1), 5, 'StatChars07'), -1);
end;
if FindColors(TPA, 2070783, B.X1, B.Y1, B.X2, B.Y2) then
begin
Result := StrToIntDef(GetTextATPA(ClusterTPA(TPA, 1), 5, 'StatChars07'), -1);
end;
if FindColors(TPA, 255, B.X1, B.Y1, B.X2, B.Y2) then
begin
Result := StrToIntDef(GetTextATPA(ClusterTPA(TPA, 1), 5, 'StatChars'), -1);
end;
end;

function GetPrayerPoints(): Int32;
var
TPA: TPointArray;
const
B: TBox = [526, 114, 550, 133];
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
if FindColors(TPA, 65280, B.X1, B.Y1, B.X2, B.Y2) then
begin
Result := StrToIntDef(GetTextATPA(ClusterTPA(TPA, 1), 5, 'StatChars07'), -1);
end;
if FindColors(TPA, 65535, B.X1, B.Y1, B.X2, B.Y2) then
begin
Result := StrToIntDef(GetTextATPA(ClusterTPA(TPA, 1), 5, 'StatChars07'), -1);
end;
if FindColors(TPA, 2070783, B.X1, B.Y1, B.X2, B.Y2) then
begin
Result := StrToIntDef(GetTextATPA(ClusterTPA(TPA, 1), 5, 'StatChars07'), -1);
end;
if FindColors(TPA, 255, B.X1, B.Y1, B.X2, B.Y2) then
begin
Result := StrToIntDef(GetTextATPA(ClusterTPA(TPA, 1), 5, 'StatChars07'), -1);
end;
end;

function GetHealthPoints(): Int32;
var
x, y: Integer;
TPA: TPointArray;
const
B: TBox = [526, 81, 550, 101];
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
if FindColors(TPA, 65280, B.X1, B.Y1, B.X2, B.Y2) then
begin
Result := StrToIntDef(GetTextATPA(ClusterTPA(TPA, 1), 5, 'StatChars07'), -1);
end;
if FindColors(TPA, 65535, B.X1, B.Y1, B.X2, B.Y2) then
begin
Result := StrToIntDef(GetTextATPA(ClusterTPA(TPA, 1), 5, 'StatChars07'), -1);
end;
if FindColors(TPA, 2070783, B.X1, B.Y1, B.X2, B.Y2) then
begin
Result := StrToIntDef(GetTextATPA(ClusterTPA(TPA, 1), 5, 'StatChars07'), -1);
end;
if FindColors(TPA, 255, B.X1, B.Y1, B.X2, B.Y2) then
begin
Result := StrToIntDef(GetTextATPA(ClusterTPA(TPA, 1), 5, 'StatChars07'), -1);
end;
end;

function GetStaminaPoints(): Int32;
var
TPA: TPointArray;
const
B: TBox = [529, 145, 562, 165];
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
if FindColors(TPA, 65280, B.X1, B.Y1, B.X2, B.Y2) then
begin
Result := StrToIntDef(GetTextATPA(ClusterTPA(TPA, 1), 5, 'StatChars07'), -1);
end;
if FindColors(TPA, 65535, B.X1, B.Y1, B.X2, B.Y2) then
begin
Result := StrToIntDef(GetTextATPA(ClusterTPA(TPA, 1), 5, 'StatChars07'), -1);
end;
if FindColors(TPA, 2070783, B.X1, B.Y1, B.X2, B.Y2) then
begin
Result := StrToIntDef(GetTextATPA(ClusterTPA(TPA, 1), 5, 'StatChars07'), -1);
end;
if FindColors(TPA, 255, B.X1, B.Y1, B.X2, B.Y2) then
begin
Result := StrToIntDef(GetTextATPA(ClusterTPA(TPA, 1), 5, 'StatChars07'), -1);
end;
end;

function GetMonsterHealthPoints(): Int32;
var
TPA: TPointArray;
const
B: TBox = [50, 70, 150, 84];
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
if FindColors(TPA, $FFFFFF, B.X1, B.Y1, B.X2, B.Y2) then
begin
writeln(GetTextATPA(ClusterTPA(TPA, 2), 5, 'StatChars07'));
end;
end;

function isAFKGuard(): Boolean;
var
TPA: TPointArray;
const
B: TBox = [12, 373, 499, 488];
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
if (Guard = True) then exit();
if (GetTickCount() < (AFKclicktime)) then exit();
if (GetTickCount() > (AFKclicktime)) then
begin
if (GetTickCount() < (AFKclicktime)) then exit();
if (GetTickCount() > (AFKclicktime)) then
begin
if FindTextIn(TPA, 'guard', 'smallChars07', 0, B) then
begin
Guard := 1;
wait(222);
AFKclicktime := gettickcount + 35000;
exit(True);
end;
end;
end;
result := False;
end;


function isGuardActive(): Boolean;
var
TPA: TPointArray;
const
B: TBox = [10, 90, 520, 365];
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
if (Guard = True) then exit();
if (GetTickCount() < (AFKclicktime)) then exit();
if (GetTickCount() > (AFKclicktime)) then
begin
if FindTextIn(TPA, PlayerName, 'upchars07', 65535, B) then
begin
writeln('GUARD ACTIVE FUNCTION True');
Guard := 1;
wait(222);
AFKclicktime := gettickcount + 35000;
exit(True);
end;
end;
result := False;
end;

function IsBuff(): Boolean;
var
TPA: TPointArray;
Const
B: TBox = [451,348,518, 367];
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
if FindTextIn(TPA, ':', 'statchars', $FFFFFF, B) then
begin
exit(True);
end;
result := False;
end;

function isContinue(): Boolean; //figure out the blue continue color and fix this
var
TPA: TPointArray;
B: TBox = [10, 374, 500, 487];
B1: TBox = [27, 488, 161, 502];
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
if FindTextIn(TPA, 'you may carry', 'smallChars07', 0, B) then
begin
//OffsetTPA(TPA, Point(1, 1));
//Mouse(TPA[0], MOUSE_LEFT);
guard := 0;
PressKey(32);
wait(1000);
exit(True);
end;
{if not FindTextIn(TPA, ':', 'smallChars07', 0, B1) then
begin
guard := 0;
PressKey(27);
exit(True);
end; }
result := False;
end;

function isWyrmCmb(): Boolean;
var
TPA: TPointArray;
x,y: integer;
Name: String;
const
MSBOX1: TBox = [1, 51, 150, 69];
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
if FindTextIn(TPA, 'wyrm', 'StatChars', 16777215, MSBOX1) then
begin
Result := true;
//cmbtime := gettickcount() + 2000 +random(-2000,4000);
exit();
end;
Result := False;
end;


procedure ClickHeal();
var
x,y, rn, PrayerPoints:Integer;
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
if (GetTickCount() < (Prayclicktime)) then exit();
if (GetTickCount() > (Prayclicktime)) then
begin
movemouse(731+random(-2,2), 180+random(-2,2));
wait(200, 222);
FastClick(MOUSE_LEFT);
Prayclicktime := gettimerunning() + random(200);
exit();
//writeln('Restoring HP');
end;
end;

procedure doSpec();
var
x,y, rn: Integer;
TPA: TPointArray;
const
MSBOXInvo: TBox = [557, 241, 732, 490];
begin
if (GetTickCount() < (spectime)) then exit();
if (GetTickCount() > (spectime)) then
begin
rn := random(0, 50);
if (GetSpecPoints() < 50) then exit;
if (GetSpecPoints() >= 50) then
begin
if ClickTab(1) then
begin
wait(200, 222);
if FindTextIn(TPA, 'Special attack:', 'StatChars', 39935, MSBOXInvo) then exit; //if special bar is already clicked dont click again
if FindTextIn(TPA, 'Special attack:', 'StatChars', 0, MSBOXInvo) then // activate spec
begin
movemouse(650 + random(-50,50), 452 + random(-4,4));
wait(200, 222);
if (GetSpecPoints() < 50) then Exit;
FastClick(MOUSE_LEFT);
spectime := gettickcount() + random(2000);
end;
end;
end;
end;
end;

function isEHinvo(): Boolean;
var
x,y, StaminaPoints:Integer;
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
if ClickTab(4) then
begin
wait(200, 222);
if FindColorTolerance(x, y, 11939920, 574, 250, 593, 267, 58) then
begin
exit(true);
end;
end;
Result := False
end;

Procedure doBuff();
var
x,y, StaminaPoints:Integer;
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
//StaminaPoints := GetStaminaPoints() ;
if (gettimerunning() < (runtime)) then exit();
if (gettimerunning() > (runtime)) then
begin
if ClickTab(4) then
begin
wait(200, 222);
if FindColorTolerance(x, y, 11939920, 574, 250, 593, 267, 58) then //eh
begin
//if found it will eat manta rays out of 1-5 rows of invo
movemouse(x, y);
wait(200, 222);
if IsUpText('heart') then
begin
wait(200, 222);
FastClick(MOUSE_LEFT);
runtime := gettimerunning() + 45000;
wait(100);
exit();
//writeln('click eheart');
end;
end;
{if not FindColorTolerance(x, y, 11939920, 574, 250, 593, 267, 58)then
begin
gohome();
wait(550);
end;}
end;
end;
end;

Procedure GetClickPrayer();
var
x,y, rn, PrayerPoints:Integer;
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
PrayerPoints := GetPrayerPoints();
rn := random(-20,15);
if (PrayerPoints > 60 + rn) then Exit;
if (PrayerPoints < 60 + rn) then
begin
if (GetTickCount() < (Prayclicktime)) then exit();
if (GetTickCount() > (Prayclicktime)) then
begin
movemouse(731+random(-7,7), 180+random(-7,7));
wait(33, 222);
FastClick(MOUSE_LEFT);
Prayclicktime := gettimerunning() + random(10000, 15000);
exit();
//writeln('Restoring HP');
end;
end;
end;

Procedure GetPrayer();
var
x,y, rn, PrayerPoints:Integer;
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
PrayerPoints := GetPrayerPoints();
//rn := random(-20,15);

if (PrayerPoints = -1) then Exit;
if (PrayerPoints > 69) then Exit;
if (PrayerPoints < 69) then
begin
SendKeys('::nurse', 50, 222);
wait(55);
PressKey(13);
wait(1000);
exit();
end;
end;

Procedure GetHeal();
var
x,y, rn, HealthPoints:Integer;
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
HealthPoints := GetHealthPoints();
if (HealthPoints = -1) then Exit;
if (HealthPoints > 69) then Exit;
if (HealthPoints < 69) then
begin
SendKeys('::nurse', 50, 222);
wait(55);
PressKey(13);
wait(1000);
exit();
end;
end;

procedure prayMelee();
var
x,y:Integer
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
wait(222);
if ClickTab(6) then
begin
wait(200, 222);
if (CountColorTolerance(7451338, 666, 344, 700, 378, 20) < 100) then
begin
//673, 353, 688, 370
movemouse(681 + Random(-7,7), 362 + Random(-7,7));
wait(200, 222);
FastClick(MOUSE_LEFT); //click Melee prayer
//writeln('click Melee prayer');
end;
wait(10, 20);
if (CountColorTolerance(7451338, 628, 417, 663, 451, 20) < 50) then
begin
//637, 428, 655, 441
movemouse(646 + Random(-7,7), 435 + Random(-7,7));
wait(200, 222);
FastClick(MOUSE_LEFT);
//writeln('click range boost prayer');
end;
end;
end;

procedure praySS();
var
x,y:Integer
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
wait(222);
if ClickTab(6) then
begin
wait(200, 222);
if (CountColorTolerance(7451338, 662, 355, 700, 389, 20) < 100) then
begin

movemouse(683 + Random(-4,4), 372 + Random(-4,4));
wait(80, 85);
FastClick(MOUSE_LEFT); //click Melee prayer
//writeln('click Melee prayer');
end;
wait(350);
if (CountColorTolerance(7451338, 700, 355, 737, 389, 20) < 50) then
begin
// 608, 334
movemouse(718 + Random(-4,4), 372 + Random(-4,4));
wait(80, 85);
FastClick(MOUSE_LEFT);
//writeln('click range boost prayer');
end;
end;
end;

procedure clickAFKGuard(); //brute force method, not great!
var
TPAmm, TPArightclick: TPointArray;
ATPAmm: T2DPointArray;
P: TPoint;
i, x, y, randomX, randomY, checkX1, checkX2, checkY: integer;
Bounds:Tbox;
Const
rightclickBox: TBox = [0, 0, 520, 532];
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
//if (Guard = False) then exit();
if FindTextIn(TPArightclick, 'Cancel', 'upChars07', $FFFFFF, rightclickBox) then
begin
OffsetTPA(TPArightclick, Point(4, 4));
Mouse(TPArightclick[0], MOUSE_LEFT);
wait(55);
end;
{ if FindTextIn(TPArightclick, 'Take', 'upChars07', $FFFFFF, rightclickBox) then
begin
OffsetTPA(TPArightclick, Point(4, 4));
MoveMouse(TPArightclick[0].x+350,TPArightclick[0].y);
end;}
if FindColorsTolerance(TPAmm, 708559, 581, 41, 715, 162, 68) then //find yellow dots on MM
begin
FilterPointsDist(TPAmm, 0, 15, 648, 113);
ATPAmm := TPAToATPAEx(TPAmm, 6, 6);
SortATPAFromfirstpoint(ATPAmm, Point(648, 113));

if (Length(ATPAmm) < 1) then
begin
Exit;
end;

For I := 0 to high(ATPAmm) do //check all dots close to us
begin
if IsKeyDown(STOP_KEY) then TerminateScript();

if FindTextIn(TPArightclick, 'Cancel', 'upChars07', $FFFFFF, rightclickBox) then
begin
OffsetTPA(TPArightclick, Point(4, 4));
Mouse(TPArightclick[0], MOUSE_LEFT);
wait(55);
end;

Bounds := GetTPABounds(ATPAmm[i]);
Bounds := [Bounds.X1, Bounds.Y1, Bounds.X2, Bounds.Y2];

x := ((bounds.X1 + bounds.X2) div 2)-648;
y := ((bounds.Y1 + bounds.Y2) div 2)-113;

P := MM2MS(Point(x,y));
randomX := (P.x + random(-5,5)); //(8,520); //check -15,15 pixels around suggested point
randomY := (P.y + random(-5,5)); //(8,520);

movemouse(randomX,randomY);
wait(22);

//if not IsUpText('AFK') then continue();

//if IsUpText('AFK') then
//begin
if guard = 0 then exit();
if IsKeyDown(STOP_KEY) then TerminateScript();
FastClick(MOUSE_RIGHT);
wait(35);
if FindTextIn(TPArightclick, 'to', 'upChars07', $FFFFFF, rightclickBox) then
begin
OffsetTPA(TPArightclick, Point(4, 4));
Mouse(TPArightclick[0], MOUSE_LEFT);
wait(2000);
//Guard := 0;
if (GetTickCount() < (writetime2)) then exit(); //start paint
if (GetTickCount() > (writetime2)) then
begin
NumberGuards := NumberGuards +1;
TimeFromMark();
cleardebug();
writeln('Number of AFK Guards');
writeln(NumberGuards);
writeln('Spawner Number at');
writeln(Numberkills);
writeln('Number of Killed Monsters');
writeln(TotalKills);
writeln('Total Time');
end;
//GuardTime := gettickcount() + 60000;
exit();
end;
//end;
end;
end;
end;

procedure stompHole();
var
TPAmm, TPArightclick, TPArev: TPointArray;
ATPAmm, ATPArev: T2DPointArray;
P: TPoint;
i, x, y, xx, yy, x1, y1, x2, y2, checkX1, checkX2, checkY: integer;
Bounds, Bounds2:Tbox;
w, h: Int32;
Const
rightclickBox: TBox = [0, 0, 520, 480];
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
if (isWyrmCmb() = True) then exit();

if (GetTickCount() < (mclicktime)) then exit();
if (GetTickCount() > (mclicktime)) then
begin
if FindColorsTolerance(TPAmm, 1118485, 265-85, 260-85, 265+85, 260+85, 15) then //find yellow dots on MM
begin
ATPAmm := TPAToATPAEx(TPAmm, 6, 6);
SortATPASize(ATPAmm, True);
Bounds := GetTPABounds(ATPAmm[0]);
Bounds := [Bounds.X1, Bounds.Y1, Bounds.X2, Bounds.Y2];

x := ((bounds.X1 + bounds.X2) div 2);
y := ((bounds.Y1 + bounds.Y2) div 2);

movemouse(x ,y);
wait(77);
if IsUpText('Stomp') then
begin
FastClick(MOUSE_RIGHT);
wait(22, 33);
if FindTextIn(TPArightclick, 'Stomp', 'upChars07', $FFFFFF, rightclickBox) then
begin
if (isWyrmCmb() = True) then exit();
OffsetTPA(TPArightclick, Point(4, 4));
Mouse(TPArightclick[0], MOUSE_LEFT);
//mclicktime := gettickcount() + random(2777,3333);
wait(random(600,800));
end;
end;
end;
{
if FindColorsTolerance(TPAmm, 1118485, 265-85, 260-85, 265+85, 260+85, 15) then //find yellow dots on MM
begin
ATPAmm := TPAToATPAEx(TPAmm, 6, 6);
SortATPASize(ATPAmm, True);
Bounds := GetTPABounds(ATPAmm[0]);
Bounds := [Bounds.X1, Bounds.Y1, Bounds.X2, Bounds.Y2];

x := ((bounds.X1 + bounds.X2) div 2);
y := ((bounds.Y1 + bounds.Y2) div 2);

movemouse(x ,y);
wait(77);
if IsUpText('Stomp') then
begin
FastClick(MOUSE_RIGHT);
wait(22, 33);
if FindTextIn(TPArightclick, 'Stomp', 'upChars07', $FFFFFF, rightclickBox) then
begin
if (isWyrmCmb() = True) then exit();
OffsetTPA(TPArightclick, Point(4, 4));
Mouse(TPArightclick[0], MOUSE_LEFT);
//mclicktime := gettickcount() + random(2777,3333);
wait(random(600,800));
end;
end;
end;}
end;
end;

Procedure clearbag();
var
x,y, StaminaPoints:Integer;
begin
if IsKeyDown(STOP_KEY) then TerminateScript();
SendKeys('::bank', 25, 25);
wait(random(50,150));
PressKey(13);
wait(random(3000,4000));
ClickTab(4);

wait(random(800,1000));
movemouse(625+random(-4,4), 258+random(-4,4));
wait(random(50,150));
if IsUpText('sit') then
begin
FastClick(MOUSE_LEFT);
end;

wait(random(800,1000));
movemouse(578+random(-4,4), 244+random(-4,4));
wait(random(50,150));
if IsUpText('all') then
begin
FastClick(MOUSE_LEFT);
wait(random(1000,2000));
PressKey(27);
totalkills := 0;
exit();
end;
end;

procedure MainLoop();
begin
//if (GetTickCount() > (endtime)) then TerminateScript();
//isAFKGuard();
isGuardActive();
isContinue();
if (Guard = 1) then
begin
ClickAFKGuard();
end;
if (isWyrmCmb() = True) then
begin
//doSpec();
getclickPrayer();
if (IsBuff() = False) then
begin
doBuff();
end;
end;
if (isWyrmCmb() = False) then
begin
wait(300,5000);
stompHole();
end;
end;

begin
//by IMALAMA101 https://villavu.com/
//ENJOY
//Instructions
//F2 stops the script
//make sure you target the complete client
//afk guard clicking is supported
//Eheart invo slot 1
//GLB invo slot 2
//CHANGE PLAYER NAME BELOW TO YOURS, and if you have GLB enter true (if not false)
//zoom all the way in on extended view.. then out 5 clicks
//stand next to any hole and start script, turn your prayer on first!
//range not supported at this time

cleardebug();
//put your name here with correct capital letters and spacing
PlayerName := 'XXXXXX';
haveGLB := False;
Guard := 0;
totalkills := 0;
cleartime := gettickcount() + (random(30000,60000)*random(1,5));
markTime();
while not isKeyDown(STOP_KEY) do
begin
MainLoop();
if (haveGLB = True) then
begin
if (GetTickCount() > (cleartime)) then
begin
clearbag();
cleartime := gettickcount() + (random(30000,60000)*random(5,10));
end;
end;
end;
end.