SRL Archive - Archive

Bly - SRL Member Application


Lucidity

2014-12-02 14:28:51

How Long have You Played Runescape?
8 Year(s)


Are you affilated in anyway with Jagex LTD?
No

Were you Referred to SRL?



What is your general programming knowledge?
Java, Html


Are you a member of any other communities?
Rune-server


Tell us about yourself…
From: Bly
My name is Sean and I'm from the States. I use to go by Mass, but now I go online by the name Bly and Blytez. I'm very interested in computers, and making things work. I like to play around and see what I'm capable of and to learn a few things while doing so. I enjoy helping people whenever I can.



Please show us one (or multiple) of your scripts.
{==============================================================================\
| F2P Clanwars NS BOT Version ID: 35 |
| By: DMC |
| Last updated 10/17/2014 04:35PM MNT |
|==============================================================================|
| |
| Written By: Da Move Cat/Blytz/Bu11et/Sean |
| Description: Attacks desired targets in clan wars. |
| Contact Info: Seansproxiedskype |
| Credits: Clarity, Main, BMWxi. |
| - This was my first script and I've been working and adding onto it the past |
| 3-4 months. |
\_____________________________________________________________________________}

{==============================================================================\
|*******************************SCRIPT SETUP***********************************|
|~~~~~~~~~~(MAKE SURE YOU SET UP YOUR ACCOUNT ACCORDING TO THE BELOW~~~~~~~~~~~|
|******************************************************************************|
|==============================================================================|
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ABILILTY BAR SETUP~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
|==============================================================================|
| |
| 1. Put your Melee abilities in Action Bar 1 |
| 2. Put your Range abilities in Action Bar 2 |
| 3. Check lines 70-80 for keybind setup |
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
| PLEASE KEEP YOUR RUNE 2H SWORD / MAGIC SHORT BOW IN SLOT 1 IN YOUR INVENTORY |
| (They need to be in slot 1 if you have weapon switching enabled) |
| (Also works with shieldbows and any 2h sword, recommended R2H MSB) |
| |
|==============================================================================|
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~SCREEN SETUP~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
|==============================================================================|
| Just make your screen like : http://puu.sh/c7juE/28d9bbb6e3.png |
|==============================================================================|
| Edit your targets at line 79 in format 'ttack USERNAME', |
|______________________________________________________________________________}


{==============================================================================\
| Features |
| What is Bu11et's SMART NS Bot capable of? |
|==============================================================================|
| * Anti-lure (West, East, Multi) * Fast portal detection |
| * Switches weapons * Prayer activation |
| * 100% Colour * Attacks targets |
| * Alarm system * World selection |
| * Notifications (Balloon tips) * ..and much more! |
|==============================================================================|


{==============================================================================\
| Script Code |
|==============================================================================|
| |
| * DO NOT EDIT ANY OF THIS UNLESS YOU KNOW WHAT YOU ARE DOING * |
| * CONTACT SEAN/BU11ET IF THE SCRIPT HAS ANY BUGS * |
\_____________________________________________________________________________}

program ClanwarsNS;
{$DEFINE SMART}
{$i srl-6/srl.simba}
{$i srl-6/lib/misc/srlplayerform.simba}

const
STATUS_FREQUENCY = 0.1;
VERSIONID = '60';

var
ABILITY50: string = 'a'; // ABILITY50 = Keybind for abilities 50% +
SLOT50: integer = 12; // SLOT50 = Slot number for keybind ABILITY 50 (14 slots in total, 1-14 left to right)

ABILITY100: string = 's'; // ABILITY100 = Keybind for abilities 100%
SLOT100: integer = 13; // SLOT100 = Slot number for keybind ABILITY 100

ANTICIPATION: string = 'q'; // ANTICIPATION = Keybind for anticipation ability
ANTISLOT: integer = 10; // ANTISLOT = Slot number for keybind ANTICIPATION

FREEDOM: string = 'w'; // FREEDOM = Keybind for freedom ability
FREESLOT: integer = 11; // FREESLOT = Slot number for keybind FREEDOM


var
ATTACK_USER: TStringArray;

{ ATTACK_USER := [
-------------------------------------------------------------------------------
-- Targets for getTarget()
-------------------------------------------------------------------------------
}

begin
ATTACK_USER := [
'ttack name here!'];
end;

var

quickPrayers: boolean = true;
switchWeps: boolean = true;
attackPlayers: boolean = false;
sendStatuses: boolean = true;
alarms: boolean = true;
fixGlitch: boolean = true;
eastWestDetection: boolean = true;
recordFails: boolean = true;
progressReport: boolean = true;
PMShutDown: boolean = true;
newPaint: boolean = true;
takeScreenshots: boolean = true;
debugMode: boolean = false;
abilities: boolean = true;
useMagic: boolean = false;
runMulti: boolean = true;
multiLure: boolean = true;
adrenalineSpec: integer = 100;
scriptPaintBMP: integer;
loopCount: integer;
SESSION_TIME: integer = 2;
PHONE_TIME: integer = 10;
abilityMarker, PMMarker, lureMarker, statusMarker: TTimeMarker;
Red, detectedGlitch, time1, sentPhone, antiTimes, Green, timesSwitched, Vex, allow, Multi, EastW, totalTries, switchedWeapons, screenCount: integer;

{ declarePlayers()
-------------------------------------------------------------------------------
-- Declares script settings
-------------------------------------------------------------------------------
}

procedure declarePlayers;
begin
players.setup(playerform.players);
currentPlayer := 0;
with players[0] do
begin
World := strToInt(playerForm.players[0].settings[0]);
SESSION_TIME := strToInt(playerForm.players[0].settings[1]);
quickPrayers := StrToBoolDef(playerForm.players[0].settings[2], true);
alarms := StrToBoolDef(playerForm.players[0].settings[3], true);
sendStatuses := StrtoBool(playerForm.players[0].settings[4]);
attackPlayers := StrToBool(playerForm.players[0].settings[5]);
switchWeps := StrToBool(playerForm.players[0].settings[6]);
useMagic := StrToBool(playerForm.players[0].settings[7]);
eastWestDetection := StrToBool(playerForm.players[0].settings[8]);
multiLure := StrToBool(playerForm.players[0].settings[9]);
runMulti := StrToBool(playerForm.players[0].settings[10]);
recordFails := StrToBool(playerForm.players[0].settings[11]);
progressReport := StrToBool(playerForm.players[0].settings[12]);
PMShutDown := StrToBool(playerForm.players[0].settings[13]);
newPaint := StrToBool(playerForm.players[0].settings[14]);
takeScreenshots := StrToBool(playerForm.players[0].settings[15]);
debugMode := StrToBool(playerForm.players[0].settings[16]);
fixGlitch := StrToBool(playerForm.players[0].settings[17]);
end;
end;

{ initPlayerForm()
-------------------------------------------------------------------------------
-- Initiates script settings
-------------------------------------------------------------------------------
}

procedure initPlayerForm();
begin
with playerForm do
begin
name := 'Bu11et''s SMART NS BOT version ' + VERSIONID + '';
scriptSettingsPath := AppPath + 'Scripts\NsBotSettings.txt';

editBoxLabels := [
'World',
'Time to reload from game session (in minutes)'];

editBoxDefaults := [
'80',
'2'];

checkBoxLabels := [
'Quick prayers',
'Alarms',
'Balloon notifications',
'Attack Users',
'Switch weapons',
'Use magic',
'East/West detection',
'Multi-zone lure detection',
'Run-to-multi (wars)',
'Record fails',
'Progress reports',
'Shut down by PM',
'New paint design',
'Take screenshots',
'Developer mode',
'Fix Glitch'];

checkBoxDefaults := [
'True',
'True',
'True',
'True',
'True',
'True',
'True',
'True',
'True',
'True',
'True',
'False',
'True',
'True',
'False',
'True'];

end;
end;

{ checkForFiles()
-------------------------------------------------------------------------------
-- Checks if our assets are there
-------------------------------------------------------------------------------
}

procedure checkForFiles(filePath, message, link: String);
var
progFile: longInt;
fileName: string;

begin
fileName := AppPath + filePath;

try
if not fileExists(fileName) then
begin
writeln('-- INSTALLATION STATUS: ' + message + ' does not exist - Downloading now.');
progFile := createFile(fileName);
end else
begin
writeln('-- INSTALLATION STATUS: ' + message + ' exists.');
exit;
end;
closeFile(progFile);

progFile := rewriteFile(fileName, false);
writeFileString(progFile, getPage(link));
writeln('-- INSTALLATION STATUS: ' + message + ' has been downloaded.');
finally
if (progFile > 0) then
closeFile(progFile);
end;
end;

{ installAssets()
-------------------------------------------------------------------------------
-- Installs our images
-------------------------------------------------------------------------------
}

procedure installAssets;
begin
writeln('Please wait...now installing Bu11ets NS Bot image assets to your computer...');
if not directoryExists(appPath + 'scripts/Bu11ets_NS_Bot_Images/') then
begin
try
createDirectory(appPath + 'scripts/Bu11ets_NS_Bot_Images/');
writeln('Created a new folder in Simba/Scripts/ called Bu11ets_NS_Bot_Images/');
except end;
end;
checkForFiles('scripts/Bu11ets_NS_Bot_Images/clanwarsns3.png', 'Script Paint', 'http://puu.sh/d2N77/d26432fe6f.png');
checkForFiles('scripts/Bu11ets_NS_Bot_Images/clanwarsns4.png', 'Script Paint', 'http://puu.sh/d2N9t/2e7e51f597.png');
end;

{ Alarm()
-------------------------------------------------------------------------------
-- Plays the alarm
-------------------------------------------------------------------------------
}

procedure Alarm;
begin
if (alarms) then
begin
PlaySound(AppPath + '\FullInvSound.wav');
end;
end;

{ LocateMe()
-------------------------------------------------------------------------------
-- Forwards
-------------------------------------------------------------------------------
}

function LocateMe: Integer; forward;

{ MiniMapWalk1()
-------------------------------------------------------------------------------
-- Random coordinates
-------------------------------------------------------------------------------
}

procedure MiniMapWalk1();
var
mapSquare, mapSquare1: TBox;
begin
if (runMulti) then
begin
mapSquare := intToBox(663, 17, 681, 23);
mouseBox(mapSquare, MOUSE_LEFT);
wait(random(1000, 1250));
if (minimap.isFlagPresent(Random(2000, 3000))) then
Minimap.waitPlayerMoving();
mapSquare1 := intToBox(675, 65, 699, 77);
mouseBox(mapSquare1, MOUSE_LEFT);
end
else if not (runMulti) then
begin
mapSquare := intToBox(684, 86, 704, 97);
mouseBox(mapSquare, MOUSE_LEFT);
end;
end;

{ MiniMapWalk2()
-------------------------------------------------------------------------------
-- Random coordinates
-------------------------------------------------------------------------------
}

procedure MiniMapWalk2();
var
mapSquare, mapSquare1: TBox;
begin
if (runMulti) then
begin
mapSquare := intToBox(663, 17, 681, 23);
mouseBox(mapSquare, MOUSE_LEFT);
wait(random(1000, 1250));
if (minimap.isFlagPresent(Random(2000, 3000))) then
Minimap.waitPlayerMoving();
mapSquare1 := intToBox(675, 65, 699, 77);
mouseBox(mapSquare1, MOUSE_LEFT);
mouseBox(mapSquare1, MOUSE_LEFT);
end
else if not (runMulti) then
begin
mapSquare := intToBox(675, 86, 697, 95);
mouseBox(mapSquare, MOUSE_LEFT);
end;
end;

{ MiniMapWalk3()
-------------------------------------------------------------------------------
-- Random coordinates
-------------------------------------------------------------------------------
}

procedure MiniMapWalk3();
var
mapSquare, mapSquare1: TBox;
begin
if (runMulti) then
begin
mapSquare := intToBox(663, 17, 681, 23);
mouseBox(mapSquare, MOUSE_LEFT);
wait(random(1000, 1250));
if (minimap.isFlagPresent(Random(2000, 3000))) then
Minimap.waitPlayerMoving();
mapSquare1 := intToBox(675, 65, 699, 77);
mouseBox(mapSquare1, MOUSE_LEFT);
end
else if not (runMulti) then
begin
mapSquare := intToBox(687, 87, 706, 94);
mouseBox(mapSquare, MOUSE_LEFT);
end;
end;

{ healthPercent()
-------------------------------------------------------------------------------
-- Returns the health percent of the player
-------------------------------------------------------------------------------
}

function healthPercent(): string;
var
health: integer;
begin
health := actionBar.getHPPercent();
result := 'Health: ' + intToStr(health) + '%';
end;

{ PrayerPercent()
-------------------------------------------------------------------------------
-- Returns the prayer percent of the player
-------------------------------------------------------------------------------
}

function PrayerPercent(): string;
var
prayer: integer;
begin
prayer := actionBar.getPrayerPercent();
result := 'Prayer: ' + intToStr(prayer) + '%';
end;

{ randomRC()
-------------------------------------------------------------------------------
-- Randomly right clicks and move mouse
-------------------------------------------------------------------------------
}

procedure randomRC();
var
screenSquare: TBox;
entireScreen: TBox;
begin
screenSquare := intToBox(151, 62, 475, 339);
mouseBox(screenSquare, MOUSE_RIGHT);
wait(randomRange(2750, 5750));
entireScreen := intToBox(0, 0, 794, 595);
mouseBox(entireScreen, MOUSE_MOVE);
end;

{ clickMiniCenter()
-------------------------------------------------------------------------------
-- Clicks the center of the mini map (player location)
-------------------------------------------------------------------------------
}

procedure clickMiniCenter();
var
mapSquare: TBox;
begin
mapSquare := intToBox(688, 106, 688, 106);
mouseBox(mapSquare, MOUSE_LEFT);
end;

{ inSafe()
-------------------------------------------------------------------------------
-- Determines if we are in fight area
-------------------------------------------------------------------------------
}

function inSafe(): boolean;
const
SAFE_COLOR = 2070783;
begin
result := getColor(538, 219) = SAFE_COLOR;
end;

{ clanCup()
-------------------------------------------------------------------------------
-- Determines if we opened the clan cup interface
-------------------------------------------------------------------------------
}

function clanCup(): boolean;
const
INT_COLOR = 1118779;
begin
result := getColor(96, 47) = INT_COLOR;
end;

{ inCombat()
-------------------------------------------------------------------------------
-- Determines if we're in combat
-------------------------------------------------------------------------------
}

function inCombat(): boolean;
const
KEY_COLOR = 1675987;
var
TPA: TPointArray;
searchArea := intToBox(0, 0, 61, 31);
begin
result := FindColors(TPA, KEY_COLOR, searchArea);
end;

{ incomingUpdate()
-------------------------------------------------------------------------------
-- Determines if a update has been announced
-------------------------------------------------------------------------------
}

function incomingUpdate(): boolean;
const
UPDATE_COLOR = 921743;
var
TPA: TPointArray;
searchArea := intToBox(298, 23, 499, 74);
begin
result := FindColors(TPA, UPDATE_COLOR, searchArea);
end;

{ vexOpen()
-------------------------------------------------------------------------------
-- Determines if a vex has been opened
-------------------------------------------------------------------------------
}

function vexOpen(): boolean;
const
VEX_COLOR = 1388125;
var
TPA: TPointArray;
searchArea := intToBox(392, 269, 400, 282);
begin
result := FindColors(TPA, VEX_COLOR, searchArea);
end;

{ vexOpen2()
-------------------------------------------------------------------------------
-- Determines if a vex has been opened, an extra check
-------------------------------------------------------------------------------
}

function vexOpen2(): boolean;
const
VEX_COLOR = 10063220;
var
TPA: TPointArray;
searchArea := intToBox(52, 45, 80, 63);
begin
result := FindColors(TPA, VEX_COLOR, searchArea);
end;

{ goNorth()
-------------------------------------------------------------------------------
-- Determines if we are in the safe zone
-------------------------------------------------------------------------------
}

function goNorth(): boolean;
const
INTERFACE_COLOR = 3635889;
var
TPA: TPointArray;
searchArea := intToBox(138, 5, 437, 52);
begin
result := FindColors(TPA, INTERFACE_COLOR, searchArea);
end;

{ redPort()
-------------------------------------------------------------------------------
-- Determines if we clicked red portal
-------------------------------------------------------------------------------
}

function redPort(): boolean;
const
INTERFACE_COLOR = 1118717;
var
TPA: TPointArray;
searchArea := intToBox(117, 69, 196, 81);
begin
result := FindColors(TPA, INTERFACE_COLOR, searchArea);
end;

{ redPort2()
-------------------------------------------------------------------------------
-- Determines if we clicked red portal
-------------------------------------------------------------------------------
}

function redPort2(): boolean;
const
INTERFACE_COLOR = 1118717;
var
TPA: TPointArray;
searchArea := intToBox(374, 67, 394, 78);
begin
result := FindColors(TPA, INTERFACE_COLOR, searchArea);
end;

{ prayerActive()
-------------------------------------------------------------------------------
-- Determines if prayer is activated
-------------------------------------------------------------------------------
}

function prayerActive(): boolean;
const
ICON_COLOR = 9060948;
var
TPA: TPointArray;
searchArea := intToBox(299, 395, 313, 414);
begin
result := FindColors(TPA, ICON_COLOR, searchArea);
end;

{ inMulti()
-------------------------------------------------------------------------------
-- Determines if we are in the multi-combat zone
-------------------------------------------------------------------------------
}

function inMulti(): boolean;
const
MULTI_COLOR = 16381945;
var
TPA: TPointArray;
searchArea := intToBox(130, 0, 361, 38);
begin
result := FindColors(TPA, MULTI_COLOR, searchArea);
end;

{ TRSOptions.isOpen()
-------------------------------------------------------------------------------
-- Determines if the settings tab is open
-------------------------------------------------------------------------------
}

function TRSOptions.isOpen(): boolean;
override;
begin
self.setBounds([300, 95, 499, 469]);
result := (countColorTolerance(379903, intToBox(self.x1, self.y1, self.x2, self.y1 + 30), 10) = 135);
end;

{ timeRunning()
-------------------------------------------------------------------------------
-- Time running since script start
-------------------------------------------------------------------------------
}

function timeRunning(TheType: Integer = TIME_FORMAL_LONG): string;
override;
begin
Result := msToTime(GetTimeRunning(), TIME_SHORT);
end;

{ isAngleLow()
-------------------------------------------------------------------------------
-- Determines if the angle is too low
-------------------------------------------------------------------------------
}

function isAngleLow(): boolean;
const
BLACK_COLOR = 65793;
var
TPA: TPointArray;
searchArea := intToBox(380, 361, 562, 379);
begin
result := FindColors(TPA, BLACK_COLOR, searchArea);
end;

{ LookingAtPortal()
-------------------------------------------------------------------------------
-- forward
-------------------------------------------------------------------------------
}

function LookingAtPortal: Boolean; forward;

var
TP: Tpoint;
OldDB: string;
MSCC, MMCC: TPoint;

{ Compas()
-------------------------------------------------------------------------------
-- Gets minimap angle degrees
-------------------------------------------------------------------------------
}

function Compas: Integer;
begin
Result := Round(minimap.getAngleDegrees);
end;

{ ClearAllDebug()
-------------------------------------------------------------------------------
-- Clears the screen of paint
-------------------------------------------------------------------------------
}

procedure ClearAllDebug;
begin
smartImage.clear;
Cleardebug;
end;

{ ClearScreenDebug()
-------------------------------------------------------------------------------
-- Clears the screen of paint
-------------------------------------------------------------------------------
}

procedure ClearScreenDebug;
begin
smartImage.clearArea(intToBox(0, 0, 574, 365));
smartImage.clearArea(intToBox(576, 0, 698, 598));
smartImage.clearArea(intToBox(1, 387, 575, 458));
Cleardebug;
end;

{ paintProgress()
-------------------------------------------------------------------------------
-- Progress reports and image painting
-------------------------------------------------------------------------------
}

procedure paintProgress;
begin
disguise('Bu11et''s SMART NS BOT! Time Running: '+timeRunning+' | '+healthPercent+' | '+PrayerPercent+'');
if not (newPaint) then
begin
with (smartImage) do
begin
drawBitmap(scriptPaintBMP, Point(2, 461));
drawText(ToStr(timeRunning), Point(127, 530), 'UpChars', true, 13667100);
drawText(ToStr(totalTries), Point(172, 552), 'UpChars', true, 13667100);
if (recordFails) then
begin
drawText('' + ToStr(Red), Point(485, 480), 'UpChars', true, 13667100);
drawText('' + ToStr(Vex), Point(426, 495), 'UpChars', true, 13667100);
drawText('' +ToStr(Multi), Point(442, 509), 'UpChars', true, 13667100);
drawText('' + ToStr(EastW), Point(475, 524), 'UpChars', true, 13667100);
drawText('' + ToStr(timesSwitched), Point(515, 539), 'UpChars', true, 13667100);
end;
end;
end else
if (newPaint) then
begin
with (smartImage) do
begin
drawBitmap(scriptPaintBMP, Point(2, 461));
drawText(ToStr(timeRunning), Point(115, 536), 'UpChars', true, 15658219);
drawText(ToStr(totalTries), Point(169, 563), 'UpChars', true, 15658219);
if (recordFails) then
begin
drawText('' + ToStr(Red), Point(520, 472), 'UpChars', true, 15658219);
drawText('' + ToStr(Vex), Point(478, 485), 'UpChars', true, 15658219);
drawText('' +ToStr(Multi), Point(489, 500), 'UpChars', true, 15658219);
drawText('' + ToStr(EastW), Point(517, 514), 'UpChars', true, 15658219);
drawText('' + ToStr(timesSwitched), Point(544, 530), 'UpChars', true, 15658219);
end;
end;
end;

if (progressReport) then
begin
writeln('-------- Progress Report --------');
writeln('Time Running : ' + ToStr(timeRunning));
writeln('Attack tries : ' + ToStr(totalTries));
writeln('Red portal clicks : ' + ToStr(Red));
writeln('Vex clicks : ' + ToStr(Vex));
writeln('Times lured to multi : ' + ToStr(Multi));
writeln('Times lured East/West : ' + ToStr(EastW));
writeln('Times switched weapons : ' + ToStr(timesSwitched));
writeln('Times fixed glitch : ' + ToStr(detectedGlitch));
writeln('Antibans performed : ' + ToStr(antiTimes));
writeln('Current loop : ' + ToStr(loopCount));
writeln('-------- End of Report --------');
end;
end;

{ screenShot()
-------------------------------------------------------------------------------
-- Takes screenshots
-------------------------------------------------------------------------------
}

procedure screenShot;
var
i:Integer;
begin
if not directoryExists(appPath + 'scripts/Bu11ets_NS_BOT_Screenshots/') then
begin
try
createDirectory(appPath + 'scripts/Bu11ets_NS_BOT_Screenshots/');
writeln('Created folder Bu11ets_NS_BOT_Screenshots at Simba/Scripts/');
except end;
end;
if inMulti() then
begin
SaveScreenshot(appPath + 'Scripts\Bu11ets_NS_BOT_Screenshots\Screenshot_Multi_Lure_'+ timeRunning() + '.jpg');
end;
if Green = 1 then
begin
Green := 0;
SaveScreenshot(appPath + 'Scripts\Bu11ets_NS_BOT_Screenshots\Screenshot_EastWest_Lure_'+ timeRunning() + '.jpg');
end;
if not Green = 1 or not inMulti() then
begin
SaveScreenshot(appPath + 'Scripts\Bu11ets_NS_BOT_Screenshots\Screenshot_Login_'+ timeRunning() + '.jpg');
end;
writeln('Screenshot has successfully been taken!');
end;

{ SDB()
-------------------------------------------------------------------------------
-- Debug
-------------------------------------------------------------------------------
}

procedure SDB(status: string);
begin
with (smartImage) do
begin
if (newPaint) then
begin
clearArea(intToBox(0, 367, 574, 385));
drawBox(0, 367, 574, 385, true, clAqua);
drawBox(0, 367, 65, 385, true, clTeal);
drawText('Status: ', point(14, 368), UpCharsEx, false, clAqua);
drawText( + status, point(79, 368), UpCharsEx, false, clTeal);
end;
end;
end;

{ Boot()
-------------------------------------------------------------------------------
-- Debug
-------------------------------------------------------------------------------
}

procedure Boot(status: string);
begin
with (smartImage) do
begin
clearArea(intToBox(0, 0, 574, 16));
drawBox(0, 0, 574, 16, true, clRed);
drawBox(0, 0, 65, 16, true, clMaroon);
drawText('Boot: ', point(11, 1), UpCharsEx, false, clRed);
drawText( + status, point(80, 1), UpCharsEx, false, clMaroon);
end;
end;

{ closeVex()
-------------------------------------------------------------------------------
-- Closes clan vex
-------------------------------------------------------------------------------
}

function closeVex : Boolean;
var Bmp,wid, hei,tmpX,tmpY,x,y : Integer;
begin
getClientDimensions(wid, hei);
Bmp := BitmapFromString(13, 14, 'meJx9kD1LQmEYhjND8xytUMljOi' +
'iiDmK5ZAjScMAwiBzaJBrahMawoSlwEUJQBylanKLATafAH9Do35A' +
'GwUEww8ueehGC4ObhOdd9nY/3mNld8zu5w9TfmL+t3VnS3Df/R5zN' +
'QDNy/GwkWy5vw7Xd/om34Uu04LQis18OZsW3USDxCBSHHQKnFS2eb' +
'Rd6I2U6PffKYdIu3mtcAfeOOpjF9y8mt6sdTovD58ntYub7M4lyaH' +
'EWp9iqsBO/+YKw3/1ksgukxbFp546NW6JH6rGnDxwJO0QqHIKsh+/' +
'g0dcpM33RVTtcHrW6dmYPlt3VofEwJpwrdlBjyiWcFofo6fp6bQJB' +
'2AmWOT6THQKnxdH001D0mp8gjhyKiAmnxVmxZJgSi/VkOYrjzAGK6K/q');

if (findBitmapToleranceIn(Bmp, x, y, 0, 0, wid - 1, hei - 1, 5)) then
begin
GetBitmapSize(Bmp,tmpX,tmpY);
mouse(point(x, y).rand(tmpX,tmpY), MOUSE_LEFT);
Result := true;
end;
FreeBitmap(Bmp);
end;

{ closeRed()
-------------------------------------------------------------------------------
-- Closes red port
-------------------------------------------------------------------------------
}

function closeRed : Boolean;
var Bmp,wid, hei,tmpX,tmpY,x,y : Integer;
begin
getClientDimensions(wid, hei);
Bmp := BitmapFromString(15, 14, 'meJyNkUtLw0AYRffZSYkUsWCDCg' +
'YUlYIgaihYDUppg6+RiEhpxaoV0i5EqiIUHwTcaBF3glvxB/jvPHJ' +
'lcCkchnwzh5s7iefPeP/m+fOr238/6T02r9MkfYHW7ROwI9ivd+/M' +
'6bnjOL23D8Y4udxsdnZbF6zAkR5EuXYcRAY5ue9bJzpMgKMwbrCCH' +
'RfKW8jt9FWxAxkXqvWz9f0jmdqRXFheQ6YVyfgZNwvyCdQImKXtg7' +
'mwgsxdbDGdutlhC2ZxIwYlI++1b0jTqwdznoXAFVP7lYNQMjXQ8CE' +
'36g/lx1iBWHWwyeqsZISR8UkLo0yYLa7+TZaQn5hCAB4EZlAxNpm7' +
'87n0QympqqAd5KXqzvRiCblx9UAsMo5KAqO9GvBHJPOFdWTr/bw3M' +
'oAj6OAX5pG/AS9xtoA=');

if (findBitmapToleranceIn(Bmp, x, y, 0, 0, wid - 1, hei - 1, 5)) then
begin
GetBitmapSize(Bmp,tmpX,tmpY);
mouse(point(x, y).rand(tmpX,tmpY), MOUSE_LEFT);
Result := true;
end;
FreeBitmap(Bmp);
end;

{ closeExamine()
-------------------------------------------------------------------------------
-- Closes player examines
-------------------------------------------------------------------------------
}

function closeExamine: Boolean;
var Bmp,wid, hei,tmpX,tmpY,x,y : Integer;
begin
getClientDimensions(wid, hei);
Bmp := BitmapFromString(15, 17, 'meJyNkbtqAlEURWd8gigBiY2lKF' +
'hKIIUQRBAiDFqIDwQRLCRgo+AX2NjaJK0itjaJH5CQzk9IYxWxiYU' +
'IQ9osPXK5GMGBxWGffZYXVNMwzEsEvKYgWcp+98khzUouEp+7o4ur' +
'oOUzKYLVXl8FTeRsfcXaev5hkhV6KbL/dkqm7Hz9ll5tXWal5ERGE' +
'/muuARO5eWeeXFVcvz+HXRBN+V6Jgvp2Xf2wwaC3qNVCw+u0IifRR' +
'Gb2Mm3HRD0Hs16PMh8CmjCww0OUwVKuaLJy+BLvCiBfLaKwz8owVX' +
'7vBlvOZ3WI6yUnJRseAYgPlNWveRlWZXshHbD8gR7Tkw0ZB4Hvqnw' +
'P+vzD73/A+g=');

if (findBitmapToleranceIn(Bmp, x, y, 0, 0, wid - 1, hei - 1, 5)) then
begin
GetBitmapSize(Bmp,tmpX,tmpY);
mouse(point(x, y).rand(tmpX,tmpY), MOUSE_LEFT);
Result := true;
end;
FreeBitmap(Bmp);
end;

{ closeBanner()
-------------------------------------------------------------------------------
-- Closes achievement banners
-------------------------------------------------------------------------------
}

function closeBanner: Boolean;
var Bmp,wid, hei,tmpX,tmpY,x,y : Integer;
begin
getClientDimensions(wid, hei);
Bmp := BitmapFromString(12, 12, 'meJxj58nkEioniPilJyt7LpfQnc' +
'4rMolXbCEUiUwS154OFAfKAtUAGUmX/kbt/iitPQsoAlEAZANFgOJ' +
'AWaAadZuF/ls/wpXxCPfAFQBJoCy7RA5QRN9tLVBZ1Kl/QBKoEc4G' +
'igNl2XkyIRohyjz2/YUguAKgLFANl0ALkAFEkk4rgbKmW/4ASSAbI' +
'giUZeOK4eSrBiJu5Ylqc94CFUAQkA0UgUgB1QCN4lZsBAqqrvoNJM' +
'3itsDZQHGgLBNLMLtMmVDna4mZX4AI6As18z4gCeECxYGyQDXcZhM' +
'5+n4AuUBZKZkyYGgASSAbKAIUB8pycfspqJYA/QtRADQZgiDKgOJA' +
'WQDkoZ0C');

if (findBitmapToleranceIn(Bmp, x, y, 0, 0, wid - 1, hei - 1, 5)) then
begin
GetBitmapSize(Bmp,tmpX,tmpY);
mouse(point(x, y).rand(tmpX,tmpY), MOUSE_LEFT);
Result := true;
end;
FreeBitmap(Bmp);
end;

{ screenSetUp()
-------------------------------------------------------------------------------
-- Faces south for findGreen()
-------------------------------------------------------------------------------
}

procedure screenSetUp();
begin
SDB('Setting up the screen to locate the green portal');
if screenCount = 0 then
begin
case Random(50) of
0..25:
begin
minimap.setAngle(randomRange(150, 210));
wait(randomRange(300, 750));
mainscreen.setangle(MS_ANGLE_HIGH);
end;
26..50:
begin
mainscreen.setangle(MS_ANGLE_HIGH);
wait(randomRange(200, 900));
minimap.setAngle(randomRange(135, 190));
end;
end;
wait(random(750, 2500));
end
else if screenCount >= 1 then
begin
SDB('We are already facing the correct way for looking at the portal');
end;
end;

{ switchWeapons()
-------------------------------------------------------------------------------
-- Switches our combat style
-------------------------------------------------------------------------------
}

procedure switchWeapons();
begin
if (tabBackpack.isOpen()) then
begin

if (useMagic) then
begin
tabBackPack.mouseSlot(random(1, 2), MOUSE_MOVE);
end else

if not (useMagic) then
begin
tabBackPack.mouseSlot(1, MOUSE_MOVE);
end;

if (isMouseOverText(['2h', 'une', 'word'])) then
begin
FastClick(MOUSE_LEFT);
wait(randomRange(300, 1250));
actionBar.switchToBar(1);
end;

if (isMouseOverText(['agic', 'hield', 'ow', 'sighted)', 'hieldbow', 'bow'])) then
begin
FastClick(MOUSE_LEFT);
wait(randomRange(100, 750));
actionBar.switchToBar(2);
end;

if (useMagic) and (isMouseOverText(['staff', 'natur'])) then
begin
FastClick(MOUSE_LEFT);
wait(randomRange(400, 1050));
actionBar.switchToBar(3);
end;

end;
end;

{ switchCombat()
-------------------------------------------------------------------------------
-- Calls switchWeapons if number is between 15 - 45
-------------------------------------------------------------------------------
}

procedure switchCombat;
begin
Inc(switchedWeapons);
if switchedWeapons >= (RandomRange(15, 45)) then
begin
SDB('Number between 15 and 45 is : (' + ToStr(switchedWeapons) + ')! It''s time to switch Weapons!');
switchWeapons();
inc(timesSwitched);
switchedWeapons := 0;
end;
end;

{ DATPAB()
-------------------------------------------------------------------------------
-- Debugs TPA's
-------------------------------------------------------------------------------
}

function DATPAB(MaATPA: T2DPointArray): TPoint;
var
i: integer;
begin
for I := 0 to (High(MaATPA)) do
begin
result := MaATPA[i].getMiddle();
with (smartImage) do
begin
try
drawPolygon([point(result.x, result.y + 5), point(result.x, result.y + 25)], clLime);
drawPolygon([point(result.x + 5, result.y), point(result.x + 25, result.y)], clLime);
drawPolygon([point(result.x - 5, result.y), point(result.x - 25, result.y)], clLime);
drawPolygon([point(result.x, result.y - 5), point(result.x, result.y - 25)], clLime);
drawCross(result, 2, clWhite);
drawCircle(result, 20, false, clRed);
except end;
end;
end;
end;

{ GMP()
-------------------------------------------------------------------------------
-- Get Mouse Position
-------------------------------------------------------------------------------
}

function GMP(T: Tpoint): Tpoint;
begin
GetMousePos(T.X, T.Y);
Result := T;
end;

{ WaitLoad()
-------------------------------------------------------------------------------
-- Waits if loading..please wait is active
-------------------------------------------------------------------------------
}

procedure WaitLoad;
var
WLT: TTimeMarker;
P: TPoint;
begin
Wait(Random(1000));
while minimap.isFlagPresent(P) do
wait(random(50));
if not (LocateMe = 1) then
Exit;
WLT.start;
repeat
Wait(Random(500));
until not (GetColor(48, 19) = 16777215) or (WLT.getTime > 3000);
end;

{ CA()
-------------------------------------------------------------------------------
-- Minimap degrees
-------------------------------------------------------------------------------
}

function CA(A: Integer): Integer;
begin
Result := A;
while Result > 360 do
Result := Result - 360;
while Result < 0 do
Result := Result + 360;
end;

{ PtToPol()
-------------------------------------------------------------------------------
-- Point to pol
-------------------------------------------------------------------------------
}

function PtToPol(A: Integer; I, C: Tpoint): Integer;
var
N: TPoint;
D, H: Integer;
begin
if A = 0 then
D := Compas
else
D := A;
I.X := I.X - C.X;
I.Y := I.Y - C.Y;
H := Round(Hypot(I.X, I.Y));
if H = 0 then
H := 1;
I.X := round(76 * I.X / H);
I.Y := round(76 * I.Y / H);
N := point( - Round(1000 * Sin(Radians(D))), - Round(1000 * Cos(Radians(D))));
H := Round(Hypot(N.X, N.Y));
N := point(round(76 * N.X / H), round(76 * N.Y / H));
Result := 360 - Round(Degrees(ArcCos((N.X * I.X + N.Y * I.Y) / (1 + Hypot(I.X, I.Y) * Hypot(N.X, N.Y)))));
if Result > 0 then
begin
if D < 180 then
begin
if ((I.X < 0) and (I.Y < N.Y)) or ((I.X > 0) and (I.Y < - 1 * N.Y)) then
Result := 360 - Result;
end
else if ((I.X < 0) and (I.Y > - 1 * N.Y)) or ((I.X > 0) and (I.Y > N.Y)) then
Result := 360 - Result;
end;
end;

{ PolToPt()
-------------------------------------------------------------------------------
-- Location to point
-------------------------------------------------------------------------------
}

function PolToPt(A, H: Integer; C: Tpoint): TPoint;
var
P: TPoint;
Rh: Integer;
begin
A := 360 - A;
P.X := Round( - 100 * Sin(Radians(Compas + A)));
P.Y := Round( - 100 * Cos(Radians(Compas + A)));
Rh := Round(Hypot(P.X, P.Y));
P.X := C.X + round(H * P.X / Rh);
P.Y := C.Y + round(H * P.Y / Rh);
Result := P;
end;

{ PtToHyp()
-------------------------------------------------------------------------------
-- Rounds the estimation
-------------------------------------------------------------------------------
}

function PtToHyp(I, C: TPoint): Integer;
begin
Result := Round(Hypot(I.X - C.X, I.Y - C.Y));
end;

{ WithInLine()
-------------------------------------------------------------------------------
-- Determines if we're within the line
-------------------------------------------------------------------------------
}

function WithInLine(A: Integer; I, C: Tpoint): Boolean;
begin
Result := False;
if ((A < 180) and (PtToPol(0, I, C) > A) and (PtToPol(0, I, C) < (A + 180))) or ((A > 179) and (PtToPol(0, I, C) > A) or (PtToPol(0, I, C) < (A - 180))) then
Result := True;
end;

{ WithinCircle()
-------------------------------------------------------------------------------
-- Determines if we're within the circle
-------------------------------------------------------------------------------
}

function WithinCircle(Cx, Cy, Ra: Integer; I: Tpoint): Boolean;
var
TP1: Tpoint;
begin
TP1 := point(Cx, Cy);
if PtToHyp(I, TP1) < Ra then
Result := True
else
Result := False;
end;

{ WithInBox()
-------------------------------------------------------------------------------
-- Determines if we're within the box
-------------------------------------------------------------------------------
}

function WithInBox(SX, SY, EX, EY: Integer; I: Tpoint): Boolean;
begin
if (I.X > SX) and (I.X < EX) and (I.Y > SY) and (I.Y < EY) then
Result := True
else
Result := False;
end;

{ AdvMMtoMS()
-------------------------------------------------------------------------------
-- Advanced Minimap to mainscreen
-------------------------------------------------------------------------------
}

function AdvMMToMS(I: Tpoint): Tpoint;
var
JGX: Tpoint;
begin
JGX.X := PtToPol(0, I, MMCC);
JGX.Y := PtToHyp(I, MMCC);
Result := PolToPt(JGX.X, 35 + round(657 * JGX.Y / 76), MSCC);
end;

{ ToMS()
-------------------------------------------------------------------------------
-- Determines if on Main Screen
-------------------------------------------------------------------------------
}

function ToMS(T: TPoint): Tpoint;
var
Ang, Dis: Integer;
begin
Ang := PtToPol(0, T, MSCC);
Dis := PtToHyp(T, MSCC);
Result := PolToPt(Ang, Dis, MSCC);
while not (WithInBox(mainscreen.x1, mainscreen.y1, mainscreen.x2, mainscreen.y2, Result)) do
begin
Dis := Dis - Random(10);
Result := PolToPt(Ang, Dis, MSCC);
end;
end;

{ ToMM()
-------------------------------------------------------------------------------
-- Determines distance in minimap
-------------------------------------------------------------------------------
}

function ToMM(T: TPoint): Tpoint;
var
Ang, Dis: Integer;
begin
Ang := PtToPol(0, T, MMCC);
Dis := PtToHyp(T, MMCC);
Result := PolToPt(Ang, Dis, MMCC);
while not (WithInCircle(minimap.cx, minimap.cy, 75, Result)) do
begin
Dis := Dis - Random(10);
Result := PolToPt(Ang, Dis, MMCC);
end;
end;

procedure ClickCoord(I: Tpoint); forward;

{ MMM()
-------------------------------------------------------------------------------
-- Mouse move, right, left
-------------------------------------------------------------------------------
}

procedure MMM(I: Tpoint; T: Integer);
begin
if T > 0 then
begin
if T > 1 then
begin
if T > 2 then
ClickCoord(I)
else
Mouse(I, MOUSE_RIGHT);
end
else
begin
T := 0;
repeat
Mouse(I, MOUSE_LEFT);
Inc(T)
until T > RandomRange(0, 1);
end;
end
else
mouse(point(I.X, I.Y), MOUSE_MOVE);
end;

{ ClickCoord()
-------------------------------------------------------------------------------
-- Converts main screen and minimap coordinates
-------------------------------------------------------------------------------
}

procedure ClickCoord(I: Tpoint);
var
Atmp: Integer;
P: TPoint;
begin
Atmp := 0;
if I.X < mainscreen.x2 then
begin
SDB('Coord is in main screen');
case Random(2) of
0:
begin
SDB('It will stay in main screen');
MMM(I, 1);
end;
1:
begin
SDB('Converting it into mini map');
I := PolToPt(PtToPol(0, I, MSCC), round(PtToHyp(I, MSCC) / 10), MMCC);
MMM(I, 1);
end;
end;
end
else
begin
SDB('Coord is in mini map');
case Random(2) of
0:
begin
SDB('It will stay in mini map');
MMM(I, 1);
end;
1:
begin
SDB('Converting it into main screen');
MMM(ToMS(AdvMMToMs(I)), 0);
while not (isMouseOverText(['alk here'])) do
begin
Inc(Atmp);
if (Atmp > RandomRange(2, 5)) then
Break;
SDB('Not a valid point to click');
I := ToMS(point(I.X + RandomRange( - 50, 50), I.Y + RandomRange( - 50, 50)));
MMM(I, 0);
Wait(100 + Random(400));
end;
MMM(I, 1)
end;
end;
end;
while minimap.isFlagPresent(P) do
wait(random(50));
end;

{ SphereCam()
-------------------------------------------------------------------------------
-- Custom include for rotating camera
-------------------------------------------------------------------------------
}

procedure SphereCam(X, Y: Integer);
var
WT: Tpoint;
WDTx, WDTy: TTimeMarker;
begin
WT := point(Round(Abs(X * 4800 / 360)), Round(Abs(Y * 1200 / 90)));
case Random(2) of
0:
begin
if X < 0 then
KeyDown(VK_Left);
if X > 0 then
KeyDown(VK_Right);
WDTx.start;
Wait(Random(WT.X));
if Y < 0 then
KeyDown(VK_Down);
if Y > 0 then
KeyDown(VK_Up);
WDTy.start;
repeat
Wait(Random(100));
until (WDTy.getTime > Random(WT.Y)) or (WDTx.getTime > WT.X) if WDTx.getTime > WT.X then
begin
if X < 0 then
KeyUp(VK_Left);
if X > 0 then
KeyUp(VK_Right);
end;
end;
1:
begin
if Y < 0 then
KeyDown(VK_Down);
if Y > 0 then
KeyDown(VK_Up);
WDTy.start;
if X < 0 then
KeyDown(VK_Left);
if X > 0 then
KeyDown(VK_Right);
WDTx.start;
Wait(Random(WT.X));
repeat
Wait(Random(100));
until (WDTx.getTime > Random(WT.X)) or (WDTy.getTime > WT.Y) if WDTx.getTime > WT.X then
begin
if Y < 0 then
KeyUp(VK_Down);
if Y > 0 then
KeyUp(VK_Up);
end;
end;
end;
repeat
Wait(Random(100));
until WDTx.getTime > WT.X if WDTx.getTime > WT.X then
begin
if X < 0 then
KeyUp(VK_Left);
if X > 0 then
KeyUp(VK_Right);
end;
repeat
Wait(Random(100));
until (WDTy.getTime > WT.Y);
if WDTy.getTime > WT.Y then
begin
if Y < 0 then
KeyUp(VK_Down);
if Y > 0 then
KeyUp(VK_Up);
end;
end;

procedure XXXENDOFINCLUDEXXX;
begin
end;

var
PC, PAC, FA: Tpoint;
PA, PD, PX, PY, AE, GP, ATT, AF, PrevLoc, OldXP, OldHP: Integer;
HPCol: string;
Pt, FT, AEt: TTimeMarker;

{ CHP()
-------------------------------------------------------------------------------
-- Results the player health percentage
-------------------------------------------------------------------------------
}

function CHP: Integer;
begin
Result := Round(actionBar.getHPPercent);
if Result < 0 then
Result := 0;
end;

{ RandomComp()
-------------------------------------------------------------------------------
-- Rotates camera
-------------------------------------------------------------------------------
}

procedure RandomComp;
begin
ClearScreenDebug;
SDB('Changing angle of screen');
screenCount := 0;
case Random(3) of
0: SphereCam(RandomRange( - 180, 180), RandomRange( - 60, 90));
1, 2: minimap.setAngle(RandomRange( - 180, 180));
end;
end;

{ CannotFind()
-------------------------------------------------------------------------------
-- Rotates camera
-------------------------------------------------------------------------------
}

procedure CannotFind;
begin
ClearScreenDebug;
SDB('Changing angle of screen because we cannot find the portal');
case Random(3) of
0: SphereCam(RandomRange( - 180, 180), RandomRange( - 60, 90));
1, 2: minimap.setAngle(RandomRange( - 180, 180));
end;
end;

{ HandleUnknown()
-------------------------------------------------------------------------------
-- Logs player out if message from Bu11et or Sickbu11et is found
-------------------------------------------------------------------------------
}

procedure HandleUnknown;
begin
if not isLoggedIn then
begin
Alarm();
ClearScreenDebug;
players[currentPlayer].login();
exitTreasure;
end;
end;

procedure LookAtPlayers; forward;

{ HandleAntiBan()
-------------------------------------------------------------------------------
-- Makes us look more human
-------------------------------------------------------------------------------
}

procedure HandleAntiBan;
begin
if LocateMe = 1 then
exit;
SDB('Antiban procedure occurring');
MouseSpeed := RandomRange(30, 45);
case Random(140) of
0..20: begin
randomRC();
SleepAndMoveMouse(GaussRangeInt(500, 4000));
end;
21..30: mouseMovingObject();
31..50: Wait(RandomRange(250, 8500));
51..65: SleepAndMoveMouse(GaussRangeInt(1000, 3500));
66..75: begin
pickUpMouse();
wait(random(250, 1000));
smallRandomMouse();
end;
76..90: randomComp;
91..99: smallRandomMouse();
100..125:
begin
MouseOffClient(Random(4));
Wait(GaussRangeInt(1000, 12000));
end;
126..140:
case Random(50) of
0..25:
case Random(50) of
0..25:
begin
ActionBar.clickSlot(ANTISLOT, MOUSE_LEFT);
end;
26..50:
begin
sendKeys(ANTICIPATION, 200, 600);
end;
end;
26..50:
case Random(50) of
0..25:
begin
ActionBar.clickSlot(FREESLOT, MOUSE_LEFT);
end;
26..50:
begin
sendKeys(FREEDOM, 200, 600);
end;
end;
end;
end;
end;

{ LocateMe()
-------------------------------------------------------------------------------
-- Determines player location
-------------------------------------------------------------------------------
}

function LocateMe: Integer;
var
LCM, P: Tpoint;
begin
if not isLoggedIn then
begin
players[currentPlayer].login();
Result := 0;
end;
if minimap.findSymbol(LCM, MM_SYMBOL_MINIGAME, minimap.getBounds) and not (minimap.findSymbol(LCM, MM_SYMBOL_BANK, minimap.getBounds)) then
begin
MMM(Point(PolToPt(RandomRange(30, 70), RandomRange(20 + Random(30), 76), MMCC).X, PolToPt(60 + Random(60), Random(76), MMCC).Y), 1);
while minimap.isFlagPresent(P) do
wait(Random(50));
end;
if (minimap.findSymbol(LCM, MM_SYMBOL_BANK, minimap.getBounds) and (minimap.findSymbol(LCM, MM_SYMBOL_MINIGAME, minimap.getBounds)) or minimap.findSymbol(LCM, MM_SYMBOL_BANK, minimap.getBounds)) then
begin
Result := 1;
Pt.start;
end;
if inMulti() and InSafe() and (multiLure) then
begin
if isLoggedIn() then
begin
Alarm();
if (takeScreenshots) then
begin
screenShot;
end;
inc(Multi);
Boot('We have been lured to multi, waiting 30-35 seconds to relog!');
wait(20000 + Random(10500));
Boot('We are logging to lobby!');
players[currentPlayer].exitToLobby();
end;
if not isLoggedIn() then
begin
Boot('Signing back online!');
players[currentPlayer].login();
wait(1000 + Random(1500));
Boot('Closing Treasure');
exitTreasure();
Boot('Closing Poll');
closePollWindow();
Minimap.ClickCompass;
end;
end;


if closeRed() then
begin
SDB('We clicked red portal, closing!');
inc(Red);
end;

if closeVex() then
begin
SDB('We opened a vex, closing!');
inc(Vex);
end;

if closeExamine() then
begin
SDB('We closed an examine');
end;

if closeBanner() then
begin
SDB('We closed an achievement banner');
end;

if clanCup() then
begin
SDB('We opened the clan cup, closing!');
clickMiniCenter();
end;

if goNorth() then
begin
Result := 2;
if GetColor(550, 179) = 2116732 then
Result := 3;
if PrevLoc = 1 then
AEt.start;
end;
if GetColor(562, 185) = 2173525 then
begin
Result := 5;
if GetColor(272, 31) = 3635889 then
begin
Result := 4;
end;
end;
PrevLoc := Result;
if not (PrevLoc = Result) then
ClearScreenDebug;
HandleUnknown;
end;

{ LocatePortal()
-------------------------------------------------------------------------------
-- Locates the portal location with DTM
-------------------------------------------------------------------------------
}

function LocatePortal(out MSPoint: TPoint; out MMPoint: TPoint): Boolean;
var
DTM: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
MSPoint := Point( - 1, - 1);
MMPoint := Point( - 1, - 1);
DTM := DTMFromString('mfgEAAHicrcwhCoRQGMTx711BjGI0eUIVTQsaBDGKYLB4ABF2YYtFRBAsgieQBQ/hH/Y16xv4wYRhLBHplUiBWv37FxMO/HDhxI6P3jTIkSBCihIVXggQI9Q9w4BZ/2xYsWDEGy06+J4jJuLCNkAZ8swNvg4adQ==');
try
if (not Minimap.findDTMs(DTM, TPA)) then
begin
Writeln('DID NOT FIND DTM (LOCATE PORTAL)');
RandomComp;
Exit(False);
end;
finally
FreeDTM(dtm);
end;
ATPA := ClusterTPAEx(TPA, 5, 5);
SortATPASize(ATPA, True);
MMPoint := MiddleTPA(ATPA[0]);
MSPoint := Minimap.PointToMainscreen(MMPoint);
Result := (MMPoint.x <> - 1) and (MMPoint.y <> - 1);
end;

{ InBound()
-------------------------------------------------------------------------------
-- Checks if the TPA is in bound
-------------------------------------------------------------------------------
}

function InBound(TestPoint: Tpoint): Boolean;
begin
if not (WithInBox(mainscreen.x1, mainscreen.y1, mainscreen.x2, mainscreen.y2, TestPoint)) or WithInCircle(15, 137, 10, TestPoint) or WithInCircle(485, 170, 30, TestPoint) or WithInBox(220, 85, 220, 215, TestPoint) or WithInBox(0, 0, 360, 20, TestPoint) then
Result := False
else
Result := True;
end;

{ LookingAtPortal()
-------------------------------------------------------------------------------
-- Determines if we're looking at the portal or not
-------------------------------------------------------------------------------
}

function LookingAtPortal(): Boolean;
var
MSPoint, MMPoint: TPoint;
LAPS, LAPE: Tpoint;
begin
if (not LocatePortal(MSPoint, MMPoint)) then
Exit(False);
LocatePortal(MSPoint, MMPoint);
PAC := ToMS(AdvMMToMs(PAC));
LAPS := point(PAC.X - 50, PAC.Y - 50);
LAPS := ToMS(LAPS);
LAPE := point(PAC.X + 50, PAC.Y + 50);
LAPE := ToMS(LAPE);
Result := FindColorSpiralTolerance(PAC.X, PAC.Y, 1788506, LAPS.X, LAPS.Y, LAPE.X, LAPE.Y, 9) and (Round(Abs(Compas - PA)) < (60 + (20 - PD)));
if Result then
SDB('Looking at portal')
else
SDB('Not looking at portal');
minimap.setAngle(0);
end;

{ FacePortal()
-------------------------------------------------------------------------------
-- Alternative for LookPortal()
-------------------------------------------------------------------------------
}

procedure FacePortal(R: Integer);
var
FaceTime: Integer;
MSPoint, MMPoint: TPoint;
begin
if (not LocatePortal(MSPoint, MMPoint)) then
Exit();
LocatePortal(MSPoint, MMPoint);
case Random(2) of
0: R := - R;
end;
FaceTime := Compas;
PA := (PA + R);
minimap.setAngle(PA);
end;

{ LookPortal()
-------------------------------------------------------------------------------
-- Rotates the camera when called
-------------------------------------------------------------------------------
}

Procedure LookPortal(R: Integer);
Var
MinH: Integer;
MSPoint, MMPoint: TPoint;
Begin
LocatePortal(MSPoint, MMPoint);
SDB('Attempting to look at portal');
IF PD < RandomRange(10, 15) Then
MinH := RandomRange(-60, 90)
Else
MinH := - 40 - PD;
Case Random(2) Of
0: R := -R;
End;
Case Random(3) Of
0: Begin
FacePortal(R);
Case Random(4) Of
0: SphereCam(R, RandomRange(MinH, MinH - PD));
1: SphereCam(0, RandomRange(MinH, MinH - PD));
2: minimap.clickCompass;
3: minimap.setAngle(0);
End;
End;
1: Begin
Case Random(4) Of
0: SphereCam(R, RandomRange(MinH, MinH - PD));
1: SphereCam(0, RandomRange(MinH, MinH - PD));
2: minimap.clickCompass;
3: minimap.setAngle(0);
End;
FacePortal(R);
End;
2: Begin
Case Random(4) Of
0: minimap.clickCompass;
1: SphereCam(R, RandomRange(MinH, MinH - PD));
2: SphereCam(R, 0);
3: minimap.setAngle(0);
End;
End;
End;
AE := 0;
End;


{ GoToPortal()
-------------------------------------------------------------------------------
-- Goes to the DTM
-------------------------------------------------------------------------------
}

procedure GoToPortal;
var
P: TPoint;
MSPoint, MMPoint: TPoint;
begin
if not LocateMe = 1 then
Exit;
if LocateMe = 1 and inSafe() then
begin
SDB('Procedure GoToPortal');
exit;
end;
if (not LocatePortal(MSPoint, MMPoint)) then
Exit();
Mouse(MMPoint.randRange( - 10, 10), MOUSE_LEFT);
while minimap.isFlagPresent(Random(1000, 2000)) do
wait(Random(100, 200));
AE := 0;
end;

{ PortalATB()
-------------------------------------------------------------------------------
-- Rotates the camera to get a good angle of the portal
-------------------------------------------------------------------------------
}

procedure PortalATB;
begin
if (AE < 2) and (Round(PX) < 15) and (Round(PY) < 10) then
Exit;
if (GetColor(126, 117) = 255) then
MMM(Point(435 + Random(10), 47 + Random(10)), 1);
if (PX < - 15) or (PY > 25) then
GoToPortal;
if not (LookingAtPortal) then
LookPortal(5);
if (Round(PX) < 5) and (PY > 25) then
minimap.setAngle(RandomRange( - 60, 60));
end;

{ checkOurFight()
-------------------------------------------------------------------------------
-- Looks for if we're stuck in combat
-------------------------------------------------------------------------------
}

function checkOurFight(): boolean;
var
KEYWORDS: TStringArray;
begin
KEYWORDS := ['You''re already fighting someone else!'];
result := chatbox.findText(KEYWORDS);
end;

{ checkFight()
-------------------------------------------------------------------------------
-- Activates freedom or anticipation if we're glitched in combat
-------------------------------------------------------------------------------
}

procedure checkFight();
begin
if checkOurFight then
begin
SDB('We detected that you''re glitched, fixing!');
inc(detectedGlitch);
case Random(50) of
0..25:
case Random(50) of
0..25:
begin
ActionBar.clickSlot(FREESLOT, MOUSE_LEFT);
end;
26..50:
begin
sendKeys(FREEDOM, 200, 800);
end;
end;
26..50:
case Random(50) of
0..25:
begin
ActionBar.clickSlot(ANTISLOT, MOUSE_LEFT);
end;
26..50:
begin
sendKeys(ANTICIPATION, 200, 500);
end;
end;
end;
end else
if not checkOurFight then
begin
SDB('We didn''t detect that you were glitched.');
end;
end;

{ getTarget()
-------------------------------------------------------------------------------
-- Searchs onscreen to find desired targets
-------------------------------------------------------------------------------
}

function getTarget: Boolean;
var
FPCol, FPTol: Integer;
I: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
ATTACK: TStringArray;
p: TPoint;
b: TBox;
begin
Result := False;
if Players[CurrentPlayer].Booleans[0] then
begin
FPCol := 11251383;
FPTol := 44;
end
else
begin
FPCol := 8083511;
FPTol := 50;
end;
if inCombat() then
begin
ClearScreenDebug;
smartImage.clearArea(Mainscreen.getBounds());
SDB('We are already in combat, can''t engage in another fight');
Exit(True);
end;
if LocateMe = 1 then
begin
ClearScreenDebug;
smartImage.clearArea(Mainscreen.getBounds());
SDB('We are in the lobby, can''t engage in combat here');
Exit(True);
end;
if goNorth() then
begin
ClearScreenDebug;
smartImage.clearArea(Mainscreen.getBounds());
SDB('We are in the safe zone, can''t engage in combat here');
Exit(True);
end;

if (fixGlitch) then
begin
checkFight();
end;

if inSafe() then
if (minimap.isFlagPresent(Random(2000, 4000))) then
Minimap.waitPlayerMoving();
begin
ClearScreenDebug;
smartImage.clearArea(Mainscreen.getBounds());
Inc(ATT);
Pt.start;
Inc(TotalTries);
SDB('Attempted to find target ' + IntToStr(ATT) + ' times');
if FindColorsSpiralTolerance(TP.X, TP.Y, TPA, FPCol, mainscreen.x1 + 10, mainscreen.y1 + 10, mainscreen.x2 - 10, mainscreen.y2 - 10, FPTol) then
begin
ATPA := TPAToATPAEx(TPA, 45, 45);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
DATPAB(ATPA);
for I := 0 to Random(High(ATPA)) do
begin
MouseSpeed := RandomRange(30, 60);
if InBound(MiddleTPA(ATPA[I])) then
begin
p := MiddleTPA(ATPA[I]);
b := IntToBox(p.x - 12, p.y - 10, p.x + 12, p.y + 10);
b.setLimit(Mainscreen.getBounds());
Mouse(b.getRandomPoint());
if (isMouseOverText(ATTACK_USER)) then
begin
fastClick(MOUSE_LEFT);
ClearScreenDebug;
smartImage.clearArea(Mainscreen.getBounds());
ATT := 0;
SDB('Found target successfully in (' + ToStr(ATT) + ' tries, ' + ToStr(Pt.getTime / 1000) + ' secs)');
Exit(True);
end;
if not (isMouseOverText(ATTACK_USER)) then
begin
FastClick(MOUSE_RIGHT);
if not chooseOption.optionsExist(ATTACK_USER) then
begin
chooseOption.close();
SDB('Target has not been found!');
if (debugMode) then
begin
chooseOption.debugOptions();
end;
end;
if chooseOption.optionsExist(ATTACK_USER) then
begin
if chooseOption.optionsExist(['ttack']) then
begin
chooseOption.select(ATTACK_USER, MOUSE_LEFT);
ClearScreenDebug;
smartImage.clearArea(Mainscreen.getBounds());
ATT := 0;
SDB('Found target successfully in (' + ToStr(ATT) + ' tries, ' + ToStr(Pt.getTime / 1000) + ' secs)');
Exit(True);
end;
end;
end;
end;
end;
end;
end;
end;

{ EP()
-------------------------------------------------------------------------------
-- Activates quick prayers found on the ability bar
-------------------------------------------------------------------------------
}

procedure EP();
begin
actionBar.mouseIcon(AB_BAR_PRAYER, MOUSE_LEFT);
end;

{ GoInPortal()
-------------------------------------------------------------------------------
-- Searches for the safe portal to enter the fight area
-------------------------------------------------------------------------------
}

function GoInPortal: Boolean;
var
tFrame, tFrameEdge, tPortal, tPortalEdge, tEdge: TPointArray;
aEdge: T2DPointArray;
i, safeCheck: Integer;
p: TPoint;
b: TBox;
begin
Result := False;
Inc(AE);

if AE >= (RandomRange(4, 7)) then
begin
LookPortal(5);
wait(random(500, 2000));
smallRandomMouse();
screenCount := 0;
AE := 0;
end;

SDB('Attempted to enter portal ' + IntToStr(AE) + ' times');
FindColorsTolerance(tFrame, 1065555, Mainscreen.getBounds(), 5, ColorSetting(2, 0.15, 0.51));
tFrameEdge := FindTPAEdges(tFrame);
FindColorsTolerance(tPortal, 10265781, Mainscreen.getBounds(), 20, ColorSetting(2, 0.27, 0.40));
tPortalEdge := FindTPAEdges(tPortal);
if (Length(tFrameEdge) < 10) or (Length(tPortalEdge) < 10) then
Exit(False);
for i := 0 to High(tPortalEdge) do
if (NearbyPointInArrayEx(tPortalEdge[i], 5, 5, tFrameEdge)) then
Insert(tPortalEdge, tEdge);
aEdge := ClusterTPAEx(tEdge, 5, 5);
SortATPAFromMidPoint(aEdge, Mainscreen.playerPoint);
for i := 0 to High(aEdge) do
begin
if (Length(aEdge[i]) < 20) then
Continue();
p := MiddleTPA(aEdge[i]);
b := IntToBox(p.x - 12, p.y - 10, p.x + 12, p.y + 10);
b.setLimit(Mainscreen.getBounds());
with (smartImage) do
begin
clearArea(Mainscreen.getBounds());
drawTPA(tEdge, clAqua);
drawBox(b, False, clAqua);
drawBox(0, 367, 574, 385, true, clAqua);

drawBox(0, 367, 65, 385, true, clTeal);
drawText('Status: ', point(14, 368), UpCharsEx, false, clAqua);
drawText('We are searching for safe portal', point(79, 368), UpCharsEx, false, clTeal);
end;
if (getPixelShift(b, 100) > 200) then
begin
MouseSpeed := RandomRange(40, 70);
Mouse(b.getRandomPoint());
if (isMouseOverText(['(safe)'])) then
begin
case Random(75) of
0..25:
begin
FastClick(MOUSE_LEFT);
end;
26..50:
begin
FastClick(MOUSE_LEFT);
wait(random(500, 3000));
smallRandomMouse();
end;
51..75:
begin
FastClick(MOUSE_LEFT);
EP();
end;
end;
screenCount := 0;
GP := 0;
Green := 0;
safeCheck := 0;
allow := 0;
ClearScreenDebug;
SDB('Found safe portal (' + ToStr(AE) + ' tries, ' + ToStr(Pt.getTime / 1000) + ' secs)');
if (minimap.isFlagPresent(Random(2000, 4000))) then
Minimap.waitPlayerMoving();
Exit(True);
end;
end;
end;
end;


{ findGreen()
-------------------------------------------------------------------------------
-- Searches for the green portal in the fight area to determine our location
-------------------------------------------------------------------------------
}



function findGreen: Boolean;
var
tFrame, tFrameEdge, tPortal, tPortalEdge, tEdge: TPointArray;
aEdge: T2DPointArray;
i: Integer;
p: TPoint;
b: TBox;
begin
if LocateMe = 1 then
begin
SDB('We are in green portal, we won' 't be searching for green portal here');
writeln('We are in lobby, not going to look for the portal!');
exit(True);
end;
if inCombat() then
begin
SDB('Not searching for green portal in combat');
writeln('We are in combat, not going to look for the portal!');
exit(True);
end;
if GP >= randomRange(3, 4) then
begin
if isLoggedIn() then
begin
Green := 1;
Alarm();
if (takeScreenshots) then
begin
screenShot;
end;
GP := 0;
Green := 0;
inc(EastW);
screenCount := 0;
Boot('Cannot detect green portal, we are going to attempt to relog');
wait(5000 + Random(3500));
Boot('We are logging to lobby');
players[currentPlayer].exitToLobby();
end;
if not isLoggedIn() then
begin
GP := 0;
screenCount := 0;
Green := 0;
Boot('Signing back online');
players[currentPlayer].login();
wait(1000 + Random(1500));
Boot('Closing Poll');
closePollWindow();
exitTreasure();
Minimap.ClickCompass;
mainscreen.setangle(MS_ANGLE_HIGH);
end;
end;
if inSafe() then
begin
screenSetUp();
screenCount := 1;
Pt.start;
Result := False;
Inc(GP);
SDB('Looking for green portal ' + IntToStr(GP) + ' times');
FindColorsTolerance(tFrame, 3100230, Mainscreen.getBounds(), 5, ColorSetting(2, 0.72, 2.62));
tFrameEdge := FindTPAEdges(tFrame);
FindColorsTolerance(tPortal, 2381889, Mainscreen.getBounds(), 20, ColorSetting(2, 0.07, 0.44));
tPortalEdge := FindTPAEdges(tPortal);
if (Length(tFrameEdge) < 10) or (Length(tPortalEdge) < 10) then
Exit(False);
for i := 0 to High(tPortalEdge) do
if (NearbyPointInArrayEx(tPortalEdge[i], 5, 5, tFrameEdge)) then
Insert(tPortalEdge, tEdge);
aEdge := ClusterTPAEx(tEdge, 5, 5);
SortATPAFromMidPoint(aEdge, Mainscreen.playerPoint);
for i := 0 to High(aEdge) do
begin
if (Length(aEdge[i]) < 20) then
Continue();
p := MiddleTPA(aEdge[i]);
b := IntToBox(p.x - 12, p.y - 10, p.x + 12, p.y + 10);
b.setLimit(Mainscreen.getBounds());
with (smartImage) do
begin
clearArea(Mainscreen.getBounds());
drawTPA(tEdge, clWhite);
drawBox(b, False, clWhite);
drawBox(0, 367, 574, 385, true, clAqua);
drawBox(0, 367, 65, 385, true, clTeal);
drawText('Status: ', point(14, 368), UpCharsEx, false, clAqua);
drawText('We are searching for green portal', point(79, 368), UpCharsEx, false, clTeal);
end;
if (getPixelShift(b, 100) > 200) then
begin
Mouse(b.getRandomPoint());
if (isMouseOverText(['Leave'])) then
begin
ClearScreenDebug;
SDB('Found green portal (' + ToStr(GP) + ' tries, ' + ToStr(Pt.getTime / 1000) + ' secs)');
case Random(100) of
0..50:
begin
GP := 0;
Green := 0;
randomComp();
Exit(True);
end;
51..100:
begin
GP := 0;
Green := 0;
smallRandomMouse();
randomComp();
Exit(True);
end;
end;
end;
end;
end;
end;
end;

{ leavePortal()
-------------------------------------------------------------------------------
-- Leaves and terminates if found inside red portal
-------------------------------------------------------------------------------
}

procedure LeavePortal;
begin
SDB('Detected Red Portal, Leaving Portal');
if not (LocateMe = 5) then
begin
while (LocateMe > 4) do
begin
if LocateMe < 5 then
Break;
MMM(PolToPT(180, RandomRange(20, 70), MMCC), 3);
end;
end;
if LocateMe < 4 then
Exit;
SDB('We are in safe area now, shutting down');
end;

{ LookAtPlayers()
-------------------------------------------------------------------------------
-- Sets screen angle according to player colours
-------------------------------------------------------------------------------
}

procedure LookAtPlayers;
begin
minimap.setAngle(PtToPol(0, FA, MMCC));
end;

{ GoToPlayers()
-------------------------------------------------------------------------------
-- Handles swiching weapons, prayer activation and walking out of safe
-------------------------------------------------------------------------------
}


procedure GoToPlayers;
begin
ClearScreenDebug;
SDB('Walking into Fight Area');
MouseSpeed := RandomRange(30, 50);
case Random(100) of
0..30:
begin
case Random(100) of
0..50:
minimap.clickCompass;
51..100:
minimap.setAngle(0);
end;
Wait(random(1000, 4000));
if (quickPrayers) then
begin
if (actionBar.getPrayerPercent() > 0) then
begin
if not prayerActive() then
begin
SDB('Activating prayer');
EP();
end;
end;
end;
case Random(75) of
0..25:
begin
MiniMapWalk1();
end;
26..50:
begin
MiniMapWalk2();
end;
51..75:
begin
MiniMapWalk3();
end;
end;
Wait(1000 + Random(1225));
if (switchWeps) then
begin
switchCombat();
end;
end;
31..75:
begin
wait(random(300, 1050));
case Random(100) of
0..50:
minimap.clickCompass;
51..100:
begin
mainscreen.setangle(MS_ANGLE_HIGH);
minimap.setAngle(0);
end;
end;
if (switchWeps) then
begin
switchCombat();
end;
Wait(300 + Random(950));
case Random(75) of
0..25:
begin
MiniMapWalk1();
end;
26..50:
begin
MiniMapWalk2();
end;
51..75:
begin
MiniMapWalk3();
end;
end;
if (quickPrayers) then
begin
if (actionBar.getPrayerPercent() > 0) then
begin
if not prayerActive() then
begin
SDB('Activating prayer');
EP();
end;
end;
end;
end;
76..100:
begin
case Random(100) of
0..50:
minimap.clickCompass;
51..100:
begin
minimap.setAngle(0);
mainscreen.setangle(MS_ANGLE_HIGH);
end;
end;
if (quickPrayers) then
begin
if (actionBar.getPrayerPercent() > 0) then
begin
if not prayerActive() then
begin
SDB('Activating prayer');
EP();
end;
end;
end;
if (switchWeps) then
begin
switchCombat();
end;
case Random(75) of
0..25:
begin
MiniMapWalk1();
end;
26..50:
begin
MiniMapWalk2();
end;
51..75:
begin
MiniMapWalk3();
end;
end;
end;
end;
if (LocateMe < 2) then
begin
ClearScreenDebug;
HandleUnknown();
Exit;
end;
end;

{ fr33BitMaps()
-------------------------------------------------------------------------------
-- Frees the painted bitmap
-------------------------------------------------------------------------------
}

procedure fr33BitMaps();
begin
freeBitMap(scriptPaintBMP);
end;

{ useAbility()
-------------------------------------------------------------------------------
-- Does our abilities
-------------------------------------------------------------------------------
}

procedure useAbility;
var
adrenaline: integer;
begin
adrenaline := actionBar.getAdrenalinePercent();

if (adrenaline < random(0, 49)) then
begin
SDB('Cannot call any abilities, not enough adrenaline');
end;

if (adrenaline >= 50) and (allow = 0) then
begin
allow := 1;
if ((actionBar.getCurrentBar()) = 1) then
begin
SDB('Using slaughter ability');
end;
if ((actionBar.getCurrentBar()) = 2) then
begin
SDB('Using snapshot ability');
end;
if ((actionBar.getCurrentBar()) = 3) then
begin
SDB('Using asphyxiate ability');
end;
case Random(50) of
0..25:
begin
ActionBar.clickSlot(SLOT50, MOUSE_MOVE);
Fastclick(MOUSE_LEFT);
end;
26..50:
begin
sendKeys(ABILITY50, 200, 600);
end;
end;
end
else if (adrenaline = 100) then
begin
allow := 0;
if ((actionBar.getCurrentBar()) = 1) then
begin
SDB('Using overpower ability');
end;
if ((actionBar.getCurrentBar()) = 2) then
begin
SDB('Using deadshot ability');
end;
if ((actionBar.getCurrentBar()) = 3) then
begin
SDB('Using omnipower ability');
end;
case Random(50) of
0..25:
begin
ActionBar.clickSlot(SLOT100, MOUSE_MOVE);
Fastclick(MOUSE_LEFT);
end;
26..50:
begin
sendKeys(ABILITY100, 100, 900);
end;
end;
end;
end;

{ callAntiBan()
-------------------------------------------------------------------------------
-- Calls our anti ban
-------------------------------------------------------------------------------
}

procedure callAntiBan;
begin
if not (attackPlayers) and loopCount >= (randomRange(20, 30)) then
begin
SDB('It''s time to perform antiban, number is ' + toStr(loopCount));
wait(random(1000, 5000));
HandleAntiBan();
loopCount := 0;
inc(antiTimes);
end else
if (attackPlayers) and loopCount >= (randomRange(75, 125)) then
begin
SDB('It''s time to perform antiban, number is ' + toStr(loopCount));
wait(random(1000, 9000));
HandleAntiBan();
loopCount := 0;
inc(antiTimes);
end;
end;

{ MainLoop()
-------------------------------------------------------------------------------
-- Repeats our tasks
-------------------------------------------------------------------------------
}

procedure MainLoop;
begin
inc(loopCount);
if LocateMe = 1 then
GoInPortal();
if LocateMe = 2 then
GoToPlayers();
if (attackPlayers) then
getTarget();
if inCombat() and (attackPlayers) then
useAbility();
if (incomingUpdate) then
begin
Alarm();
end;
end;

{ checkTerminate()
-------------------------------------------------------------------------------
-- Checks for the messages from the names in the array
-------------------------------------------------------------------------------
}

function checkTerminate(): boolean;
var
KEYWORDS: TStringArray;
begin
KEYWORDS := [
'From Bu',
'From Sick'
];
result := chatbox.findText(KEYWORDS);
end;

{ checkChat()
-------------------------------------------------------------------------------
-- Logs player out if message from Bu11et is found
-------------------------------------------------------------------------------
}

procedure checkChat();
begin
if (PMShutDown) then
begin
if checkTerminate then
begin
Boot('Sounding Alarm, message from Bu11et detected');
Alarm();
Boot('Message from Bu11et detected, Logging out player');
if not inCombat() then
begin
Boot('Sending player North');
minimap.clickCompass;
MiniMapWalk1;
Boot('Logging out player');
players[currentPlayer].exitToLobby();
wait(random(3500, 7000));
Boot('Logging in player');
players[currentPlayer].login();
end else
if inCombat() then
begin
Boot('We are in combat, waiting til signout');
wait(random(30000, 60000));
Boot('Logging out player');
players[currentPlayer].exitToLobby();
wait(random(3500, 7000));
Boot('Logging in player');
players[currentPlayer].login();
end;
end else
if not checkTerminate then
begin
Boot('No messages found from Sickbu11et or Bu11et, not relogging');
end;
end;
end;

{ sendStatus()
-------------------------------------------------------------------------------
-- Sends a balloon hint of the status of the player
-------------------------------------------------------------------------------
}

procedure sendStatus();
begin
if not isLoggedIn() then
begin
showBalloonHint('NS BOT Status', 'We are NOT signed in. '+healthPercent+' '+PrayerPercent+'', 3000, 0);
end;

if inSafe() then
begin
showBalloonHint('NS BOT Status', 'We are in the Fight Area. '+healthPercent+' '+PrayerPercent+'', 3000, 0);
end;

if inCombat() then
begin
showBalloonHint('NS BOT Status', 'We are in combat. '+healthPercent+' '+PrayerPercent+'', 3000, 0);
end;

if LocateMe = 1 then
begin
showBalloonHint('NS BOT Status', 'Looking for safe portal. '+healthPercent+' '+PrayerPercent+'', 3000, 0);
end;

if LocateMe = 2 then
begin
showBalloonHint('NS BOT Status', 'We are walking into Fight Area. '+healthPercent+' '+PrayerPercent+'', 3000, 0);
end;

if LocateMe = 3 then
begin
showBalloonHint('NS BOT Status', 'We are in the Fight Area. '+healthPercent+' '+PrayerPercent+'', 3000, 0);
end;

if inSafe() and inMulti() then
begin
showBalloonHint('NS BOT Status', 'We have been lured. '+healthPercent+' '+PrayerPercent+'', 3000, 0);
end;
end;

{ sixHourFix()
-------------------------------------------------------------------------------
-- Reloads our client if we game session
-------------------------------------------------------------------------------
}

procedure sixHourFix(); override;
begin
print('sixHourFix():', TDebug.HEADER);

if (players.getActive() < 1) then
print('No active players, no use in reloading the client!', TDebug.FATAL);

smartReloadClient((SESSION_TIME * 60000) + random(10000));

if (waitClientReady()) then
begin
print('Client succesfully loaded after reload');
Boot('Logging player in');
wait(random(2500, 6500));

if (players[currentPlayer].login()) then
begin
print('Succesfully logged in after client was reloaded');

Boot('Closing Poll');
wait(random(500, 4000));
closePollWindow();
Boot('Closing treasure');
exitTreasure();
wait(random(1000, 4000));
Boot('Setting screen to face north');
minimap.setAngle(0);

print('sixHourFix()', TDebug.FOOTER);
exit();
end else
print('Failed to login player after restart', TDebug.FATAL);
end else
print('Client never reloaded after restart..', TDebug.FATAL);
end;

var
loop: Integer;
begin
smartShowConsole := FALSE;
installAssets();
initPlayerForm();
runPlayerForm();

if (not playerForm.isScriptReady) then
begin
terminatescript;
end;

smartPlugins := ['d3d9.dll'];
disableSRLDebug := true;
disableSRLLog := true;

smartEnableDrawing := true;
SetupSRL;
declarePlayers;

if (sendStatuses) then
begin
statusMarker.start();
end;

if (eastWestDetection) then
begin
lureMarker.start();
end;

if (PMShutDown) then
begin
PMMarker.start();
end;

if not (attackPlayers) then
begin
abilityMarker.start();
end;

if not (newPaint) then
begin
scriptPaintBMP := loadBitmap(appPath + 'Scripts\Bu11ets_NS_Bot_Images\clanwarsns3.png');
end
else
if (newPaint) then
begin
scriptPaintBMP := loadBitmap(appPath + 'Scripts\Bu11ets_NS_Bot_Images\clanwarsns4.png');
end;
fastReplaceColor(scriptPaintBMP, 0, 1);
addOnTerminate('fr33BitMaps');
screenCount := 0;
AE := 0;
GP := 0;
ClearScreenDebug;

repeat

if not isLoggedIn() then
begin
Alarm();
if (takeScreenshots) then
begin
screenShot;
end;
Boot('Logging player in');
wait(random(2500, 4500));
players[currentPlayer].login();
Boot('Closing Poll');
wait(random(1000, 3000));
closePollWindow();
Boot('Closing treasure');
exitTreasure();
wait(random(1000, 2000));
Boot('Setting screen to face north');
minimap.setAngle(0);
end;
until isLoggedIn();

repeat

if not (attackPlayers) then
begin
if abilityMarker.getTime >= (randomRange(120000, 150000)) then
begin
case Random(50) of
0..25:
case Random(50) of
0..25:
begin
ActionBar.clickSlot(ANTISLOT, MOUSE_LEFT);
end;
26..50:
begin
sendKeys(ANTICIPATION, 200, 400);
end;
end;
26..50:
case Random(50) of
0..25:
begin
ActionBar.clickSlot(FREESLOT, MOUSE_LEFT);
end;
26..50:
begin
sendKeys(FREEDOM, 200, 400);
end;
end;
end;
end;
abilityMarker.reset();
abilityMarker.start();
end;

if (sendStatuses) then
begin
if statusMarker.getTime > (STATUS_FREQUENCY * 3600000) then
begin
SDB('Sending status notification');
sendStatus;
statusMarker.reset();
statusMarker.start();
end;
end;

if (eastWestDetection) then
begin
if lureMarker.getTime > (randomRange(125000, 125000)) then
begin
SDB('Time has passed.. time to look for green portal..');
findGreen();
lureMarker.reset();
lureMarker.start();
end;
end;

if (PMShutDown) then
begin
if PMMarker.getTime > (randomRange(30000, 75000)) then
begin
SDB('Searching for private message..');
checkChat();
PMMarker.reset();
PMMarker.start();
end;
end;

PaintProgress;
MainLoop;
wait(random(6000, 20000));
callAntiBan();

until False;
end.

Ross

2014-12-02 14:46:23

For anyone else interested, here's two other scripts of his:

https://villavu.com/forum/showthread.php?t=111031
https://villavu.com/forum/showthread.php?t=110417



Hi Sean! Looks like you've got the knowledge and definitely have the attitude, so it's a yes from me. Would love to see some public scripts though!

Lucidity

2014-12-02 14:53:15

From: Ross
For anyone else interested, here's two other scripts of his:

https://villavu.com/forum/showthread.php?t=111031
https://villavu.com/forum/showthread.php?t=110417



Hi Sean! Looks like you've got the knowledge and definitely have the attitude, so it's a yes from me. Would love to see some public scripts though!


Thank you, and I hope I have it too. :) I'll be releasing more soon.

Hoodz

2014-12-02 15:00:37

yes from me :D

King

2014-12-02 15:01:16

Hi, attitude around the forums seems good to me, however most activity seems pretty recent. Is there any reason you want to be a member now? How did you get into programming? Just would like a bit more about you, I cannot really tell much from your posts and I haven't talked to you much.

As for the script, it looks pretty good to me, however there are some bits of code that are concerning to me, such as this one

 repeat

if not isLoggedIn() then
begin
Alarm();
if (takeScreenshots) then
begin
screenShot;
end;
Boot('Logging player in');
wait(random(2500, 4500));
players[currentPlayer].login();
Boot('Closing Poll');
wait(random(1000, 3000));
closePollWindow();
Boot('Closing treasure');
exitTreasure();
wait(random(1000, 2000));
Boot('Setting screen to face north');
minimap.setAngle(0);
end;
until isLoggedIn();

What if you never log into the game? Will it just continue to run this procedure forever?

Also, your main procedure uses an
until false;
what if the script gets lost or broken? Will the script exit or just continue with the script?

I don't see many failsafes used throughout the script.

Lucidity

2014-12-02 15:08:12

From: King
Hi, attitude around the forums seems good to me, however most activity seems pretty recent. Is there any reason you want to be a member now? How did you get into programming? Just would like a bit more about you, I cannot really tell much from your posts and I haven't talked to you much.

As for the script, it looks pretty good to me, however there are some bits of code that are concerning to me, such as this one

 repeat

if not isLoggedIn() then
begin
Alarm();
if (takeScreenshots) then
begin
screenShot;
end;
Boot('Logging player in');
wait(random(2500, 4500));
players[currentPlayer].login();
Boot('Closing Poll');
wait(random(1000, 3000));
closePollWindow();
Boot('Closing treasure');
exitTreasure();
wait(random(1000, 2000));
Boot('Setting screen to face north');
minimap.setAngle(0);
end;
until isLoggedIn();

What if you never log into the game? Will it just continue to run this procedure forever?

Also, your main procedure uses an
until false;
what if the script gets lost or broken? Will the script exit or just continue with the script?

I don't see many failsafes used throughout the script.


Hi,

Thank you for pointing out a few things. The inactive player called from SRL will usually terminate the script if it messes up, and I've ran it for 2-3+ months without a single failure. There are some failsafes, for example in GoInPortal. If it's unable to locate the portal, the screen will be moved to another location. It's never messed up and doesn't really need a fail safe but I can see where you're coming from. @Clarity has seen it run for months.

Anyway, I wanted to be a member because I've really noticed everyone likes to help out here, and I want to be apart of it. Sort of like a movement in improving everything and being successful, I like it. I became programming around 4-5 years ago when I realized if I could 10th prestige hack on call of duty, I could make a RSPS.. so I read on java tutorials and kept learning and learning, and then I became interested in real runescape, but didn't have the time.. so I ran into SRL and read the documentation for a few days and learnt a bit and started trying it out and eventually wound up with this :).

Thank you everyone else:) I really appreciate it.

King

2014-12-02 15:14:22

From: Bly
Hi,

Thank you for pointing out a few things. The inactive player called from SRL will usually terminate the script if it messes up, and I've ran it for 2-3+ months without a single failure. There are some failsafes, for example in GoInPortal. If it's unable to locate the portal, the screen will be moved to another location. It's never messed up and doesn't really need a fail safe but I can see where you're coming from. @Clarity has seen it run for months.

Anyway, I wanted to be a member because I've really noticed everyone likes to help out here, and I want to be apart of it. Sort of like a movement in improving everything and being successful, I like it. I became programming around 4-5 years ago when I realized if I could 10th prestige hack on call of duty, I could make a RSPS.. so I read on java tutorials and kept learning and learning, and then I became interested in real runescape, but didn't have the time.. so I ran into SRL and read the documentation for a few days and learn a bit.

Thank you everyone else:) I really appreciate it.


I'm a failsafe Nazi, but in practice if it works, no point in changing it. I would just like to see a few more failsafes, I do see where you have them.

Voted yes based on the response and the script. Good luck and very impressive.

Lucidity

2014-12-02 15:16:58

From: King
I'm a failsafe Nazi, but in practice if it works, no point in changing it. I would just like to see a few more failsafes, I do see where you have them.

Voted yes based on the response and the script. Good luck and very impressive.


Thank you.

3Garrett3

2014-12-02 15:51:08

So before I vote, I have a couple questions. I only know you as Blytez, so I assume when you say "Written By: Da Move Cat/Blytz/Bu11et/Sean" that those are all your aliases? Also, what does this script do (for someone who hasn't played RS legit in about 8 years I have no idea what Clan Wars NS means).

Aside from that, I like the looks of the script for the most part, I'm going to look in depth and if I see anything specific I'll let you know.

Lucidity

2014-12-02 16:05:31

From: 3Garrett3
So before I vote, I have a couple questions. I only know you as Blytez, so I assume when you say "Written By: Da Move Cat/Blytz/Bu11et/Sean" that those are all your aliases? Also, what does this script do (for someone who hasn't played RS legit in about 8 years I have no idea what Clan Wars NS means).

Aside from that, I like the looks of the script for the most part, I'm going to look in depth and if I see anything specific I'll let you know.


Those were my previous names yes, and the script takes you into Free-for-all safe portal and attacks targets.

3Garrett3

2014-12-02 17:00:43

From: Bly
Those were my previous names yes, and the script takes you into Free-for-all safe portal and attacks targets.


Still over my head but I'll accept it ;).

You've got some weird standards in a lot of places, and a lot of one line functions that could probably be written together to save space.

A short list:

Alarm function has needless begin/end in it.
Your map walk functions (3 of them) are basically the exact same thing and could be better handled with a case statement instead of three functions.
The health percent and prayer percent functions could be one liners wherever needed in the script.
A bunch of the functions below the health and prayer functions are one liner functions that could probably not be there.
The timeRunning function has a useless parameter in it, and as such it could be called anywhere as a one liner.

(Just skipping all the one liner function comments for now on. I realize they're likely for ease of calling a function name rather than the actual code to save a bit of time (something I'm guilty of sometimes too) but there's a whole lot of them.)

Why do you have a custom TPA debug function? There is one in SRL so you probably don't need that do you?
Your MMM function is kindof a mess, I don't like how you have like 6 lines to determine randomness when it could be done in 1.
There's a lot of math-y stuff above MMM and I just assume you've written it and it works. Seems like stuff that I know is in SRL too though so I'm wondering if you've looked deep into SRL/Simba math functions before writing them.

At this point I see that I was looking through your include, so maybe everything was just written for fun. Who knows. Too late to delete comments now (since most of them are about functions that don't really need to exist).

Antiban seems well written, I like how you've got plenty of options to use. Nice use of case statements.

Your lookingAtPortal function doesn't need:


if (not LocatePortal(MSPoint, MMPoint)) then
Exit(False);
LocatePortal(MSPoint, MMPoint);

The second LocatePortal is not needed because you called it literally 2 lines before it, those variables will already be set. Same for the FacePortal function (I notice you don't have the failsafe in LookPortal).

You do the same thing in goToPortal, you don't need to call LocateMe twice, you're never going to make it to the second if statement if you've exited out from the first one.

I know I said I'd stop pointing out one liners but you've got another unique version of it in the checkOurFight function. In the function below that (I'm scrolling so much and getting tired of it) you've got another multiple if statements that could use an else instead of calling the same function over and over. It's possible with lag glitches (this function) you detect the glitch the first time, do the antiglitch stuff and then detect it again in the second one so there's no happy times because you're not glitching. Just use an else on the first detection to always get this OR that. Right now you're leaving it open to anything.

In leavePortal you have:


while (LocateMe > 4) do
begin
if LocateMe < 5 then
Break;
MMM(PolToPT(180, RandomRange(20, 70), MMCC), 3);
end;

The following should do the exact same thing:


while (LocateMe > 4) do
MMM(PolToPT(180, RandomRange(20, 70), MMCC), 3);

in UseAbility… OH GOD that's a lot of begin/end that are not needed ever. Those should be if … then … else if statements, too many ifs being called for no reason. Same for sendStatus and the main loop.

Congratulations, I made it through most of your script in 30 minutes. Don't tell my boss.

Sooo I think a lot of those comments are on the same thing. The big things like DTMs, TPAs, etc all looked pretty good and I liked that you look like you know how to do math, which is very nice. Let me think on it and try not to fall asleep at my desk.

Edit:

LOL looked through my post and the first thing I wrote was "A short list" and then exploded words everywhere. I apologize to everyone who read this.

Lucidity

2014-12-02 17:09:43

From: 3Garrett3
Still over my head but I'll accept it ;).

You've got some weird standards in a lot of places, and a lot of one line functions that could probably be written together to save space.

A short list:

Alarm function has needless begin/end in it.
Your map walk functions (3 of them) are basically the exact same thing and could be better handled with a case statement instead of three functions.
The health percent and prayer percent functions could be one liners wherever needed in the script.
A bunch of the functions below the health and prayer functions are one liner functions that could probably not be there.
The timeRunning function has a useless parameter in it, and as such it could be called anywhere as a one liner.

(Just skipping all the one liner function comments for now on. I realize they're likely for ease of calling a function name rather than the actual code to save a bit of time (something I'm guilty of sometimes too) but there's a whole lot of them.)

Why do you have a custom TPA debug function? There is one in SRL so you probably don't need that do you?
Your MMM function is kindof a mess, I don't like how you have like 6 lines to determine randomness when it could be done in 1.
There's a lot of math-y stuff above MMM and I just assume you've written it and it works. Seems like stuff that I know is in SRL too though so I'm wondering if you've looked deep into SRL/Simba math functions before writing them.

At this point I see that I was looking through your include, so maybe everything was just written for fun. Who knows. Too late to delete comments now (since most of them are about functions that don't really need to exist).

Antiban seems well written, I like how you've got plenty of options to use. Nice use of case statements.

Your lookingAtPortal function doesn't need:


if (not LocatePortal(MSPoint, MMPoint)) then
Exit(False);
LocatePortal(MSPoint, MMPoint);

The second LocatePortal is not needed because you called it literally 2 lines before it, those variables will already be set. Same for the FacePortal function (I notice you don't have the failsafe in LookPortal).

You do the same thing in goToPortal, you don't need to call LocateMe twice, you're never going to make it to the second if statement if you've exited out from the first one.

I know I said I'd stop pointing out one liners but you've got another unique version of it in the checkOurFight function. In the function below that (I'm scrolling so much and getting tired of it) you've got another multiple if statements that could use an else instead of calling the same function over and over. It's possible with lag glitches (this function) you detect the glitch the first time, do the antiglitch stuff and then detect it again in the second one so there's no happy times because you're not glitching. Just use an else on the first detection to always get this OR that. Right now you're leaving it open to anything.

In leavePortal you have:


while (LocateMe > 4) do
begin
if LocateMe < 5 then
Break;
MMM(PolToPT(180, RandomRange(20, 70), MMCC), 3);
end;

The following should do the exact same thing:


while (LocateMe > 4) do
MMM(PolToPT(180, RandomRange(20, 70), MMCC), 3);

in UseAbility… OH GOD that's a lot of begin/end that are not needed ever. Those should be if … then … else if statements, too many ifs being called for no reason. Same for sendStatus and the main loop.

Congratulations, I made it through most of your script in 30 minutes. Don't tell my boss.

Sooo I think a lot of those comments are on the same thing. The big things like DTMs, TPAs, etc all looked pretty good and I liked that you look like you know how to do math, which is very nice. Let me think on it and try not to fall asleep at my desk.

Edit:

LOL looked through my post and the first thing I wrote was "A short list" and then exploded words everywhere. I apologize to everyone who read this.


Well, some functions were created by Main & Clarity, but a majority of the work was done by me. I gave credits in the beginning of the script.

Thank you though it means a lot to me, and I'll work on improving it.

3Garrett3

2014-12-02 17:30:26

From: Bly
Well, some functions were created by Main & Clarity, but a majority of the work was done by me. I gave credits in the beginning of the script.

Thank you though it means a lot to me, and I'll work on improving it.


Aha! So I should blame @Clarity then! I like the attitude you have towards progressing and I like the responses you've given to others above me. Like I mentioned at the end of my comment, the points I was picky about are non-essential things and you have a firm grasp of the important functions by the looks of it. I say yes

Lucidity

2014-12-02 17:32:34

From: 3Garrett3
Aha! So I should blame @Clarity then! I like the attitude you have towards progressing and I like the responses you've given to others above me. Like I mentioned at the end of my comment, the points I was picky about are non-essential things and you have a firm grasp of the important functions by the looks of it. I say yes


Yeah I understand, I've been learning with trial and error. Sometimes even nagging Clarity, so big ups for him for being nice and teaching me a few things.

Sjoe

2014-12-02 19:02:55

voted yes

and posting for showing my avatar

Lucidity

2014-12-02 20:35:10

From: Sjoe
voted yes

and posting for showing my avatar


Thank you, I appreciate it. :)

Clarity

2014-12-03 00:13:06

I'd like to put out a brief word to members looking at this app that, disregarding the script flaws discussed above for a moment, Bly deserves membership by a long shot.

Over the past several months, Bly has been corresponding privately with me over Skype, constantly looking for advice and tips on improving his scripting quality and efficiency. While I am "credited" in this script, I merely acted as a guide so that Bly could do it himself and improve his knowledge. He is very motivated and learns wonderfully quickly.

He has tirelessly spent those months transforming this script from what started off basically as a simple auto-clicker to what you see in the application now.

I am very proud to finally see this long overdue application, and solidly vote yes. Best of luck, @Bly. While I know you won't release this script publicly, I do hope you contribute some public releases! I suspect some have voted "No" due to relative lack of public contributions.

Lucidity

2014-12-03 00:32:47

From: Clarity
I'd like to put out a brief word to members looking at this app that, disregarding the script flaws discussed above for a moment, Bly deserves membership by a long shot.

Over the past several months, Bly has been corresponding privately with me over Skype, constantly looking for advice and tips on improving his scripting quality and efficiency. While I am "credited" in this script, I merely acted as a guide so that Bly could do it himself and improve his knowledge. He is very motivated and learns wonderfully quickly.

He has tirelessly spent those months transforming this script from what started off basically as a simple auto-clicker to what you see in the application now.

I am very proud to finally see this long overdue application, and solidly vote yes. Best of luck, @Bly. While I know you won't release this script publicly, I do hope you contribute some public releases! I suspect some have voted "No" due to relative lack of public contributions.


Thank you Clarity, you pretty much motivated me to learn and try to make it better. I really really appreciate what you've said. It means a lot:)

slacky

2014-12-03 00:55:47

I have a few questions:
1. Do you have previous experience with programming, or are you new to this?
1. B: Do you know Java, or are you just familiar with the basics?
2. How long have you been writing scripts with Simba, except for some "auto clickers"?
3. Will you be able to write a good script if you could not use any resource like Clarity, or other published scripts?

I'm a bit skeptic, from the looks of it, it seems like you have managed (with help) to write what looks like a decent script, yet only a few months ago you where all new to scripting?. That makes me suspect that this "little" help that clarity offered was not so little after all.

I probably wont vote unless I get this answered :b

Lucidity

2014-12-03 02:04:46

From: slacky
I have a few questions:
1. Do you have previous experience with programming, or are you new to this?
1. B: Do you know Java, or are you just familiar with the basics?
2. How long have you been writing scripts with Simba, except for some "auto clickers"?
3. Will you be able to write a good script if you could not use any resource like Clarity, or other published scripts?

I'm a bit skeptic, from the looks of it, it seems like you have managed (with help) to write what looks like a decent script, yet only a few months ago you where all new to scripting?. That makes me suspect that this "little" help that clarity offered was not so little after all.

I probably wont vote unless I get this answered :b


Hi,

1. I do have previous experience, I use to run a private server with ~100-200 players, and make some websites for money on the side.
1b. I'm pretty well knowledgeable with the language.
2. I've been writing scripts since June, this year.
3. I believe so, I've made a few scripts that I'm planning to release once I am able to build up an account to go rework the scripts. =)

Clarity didn't give any code, he mostly gave the logic as in worded how I should do things. The only direct code that Clarity made would be the debugging (crosshair debug for target finding) and his asset installer.

Thank you for the feedback :)

slacky

2014-12-03 03:06:48

From: Bly
Hi,

1. I do have previous experience, I use to run a private server with ~100-200 players, and make some websites for money on the side.
1b. I'm pretty well knowledgeable with the language.
2. I've been writing scripts since June, this year.
3. I believe so, I've made a few scripts that I'm planning to release once I am able to build up an account to go rework the scripts. =)

Clarity didn't give any code, he mostly gave the logic as in worded how I should do things. The only direct code that Clarity made would be the debugging (crosshair debug for target finding) and his asset installer.

Thank you for the feedback :)

Okay. So I decided to not be an asshole, and just vote Yes then.

A few pointers:

You need to practice some more on your standards, they are somewhat iffy. I'm thinking about shit like cryptic method-names, messy indentation, and small things like "Tpoint" instead of "TPoint", and stuff like the (method) descriptions could use some better formating, and some more proper descriptions.
IE:

{ ToMM()
-------------------------------------------------------------------------------
-- Determines if in circle
-------------------------------------------------------------------------------
}

function ToMM(T: TPoint): Tpoint;
var
Ang, Dis: Integer;
begin
Ang := PtToPol(0, T, MMCC);
Dis := PtToHyp(T, MMCC);
Result := PolToPt(Ang, Dis, MMCC);
while not (WithInCircle(minimap.cx, minimap.cy, 75, Result)) do
begin
Dis := Dis - Random(10);
Result := PolToPt(Ang, Dis, MMCC);
end;
end;
The header comment-format looks bad, the description is wrong, and the function-name is somewhat cryptic (not one of the worse tho).

You can also do with a bit more research: Check what methods already exist in Simba, and SRL. For example "WithInBox", you could use PointInBox(..).

There is also stuff like unneeded functions. Take the PtToHyp for example, do you really need a special function just to do Round(Hypot(…))? That just adds extra overhead (another function-call).
Also, some of your functions can be simplified, for example:

//simple:
function InCircle(pt, center:TPoint; radius: Integer): Boolean;
begin
Result := Sqr(pt.x - center.x) + Sqr(pt.y - center.y) <= Sqr(radius);
end;

//yours:
function WithinCircle(Cx, Cy, Ra: Integer; I: Tpoint): Boolean;
var
TP1: Tpoint;
begin
TP1 := point(Cx, Cy);
if PtToHyp(I, TP1) < Ra then
Result := True
else
Result := False;
end;
Also, the name "PtToHyp" could use some rethinking, this is for example more clear: DistanceBetween(ptA,ptB..) (not the best example), or better yet, write a type-helper: "TPoint.DistanceTo(pt..)"


Avoid nested logic, it's hard to follow, harder to maintain, and often looks bad. You can in many case avoid some nested logic by for example having a few Exit() statements, which makes for an early return, or by separating the function in to smaller functions, or simply rewriting the concept. Referring to function GetTarget: Boolean;

Lucidity

2014-12-03 09:53:26

From: slacky
Okay. So I decided to not be an asshole, and just vote Yes then.

A few pointers:

You need to practice some more on your standards, they are somewhat iffy. I'm thinking about shit like cryptic method-names, messy indentation, and small things like "Tpoint" instead of "TPoint", and stuff like the (method) descriptions could use some better formating, and some more proper descriptions.
IE:

{ ToMM()
-------------------------------------------------------------------------------
-- Determines if in circle
-------------------------------------------------------------------------------
}

function ToMM(T: TPoint): Tpoint;
var
Ang, Dis: Integer;
begin
Ang := PtToPol(0, T, MMCC);
Dis := PtToHyp(T, MMCC);
Result := PolToPt(Ang, Dis, MMCC);
while not (WithInCircle(minimap.cx, minimap.cy, 75, Result)) do
begin
Dis := Dis - Random(10);
Result := PolToPt(Ang, Dis, MMCC);
end;
end;
The header comment-format looks bad, the description is wrong, and the function-name is somewhat cryptic (not one of the worse tho).

You can also do with a bit more research: Check what methods already exist in Simba, and SRL. For example "WithInBox", you could use PointInBox(..).

There is also stuff like unneeded functions. Take the PtToHyp for example, do you really need a special function just to do Round(Hypot(…))? That just adds extra overhead (another function-call).
Also, some of your functions can be simplified, for example:

//simple:
function InCircle(pt, center:TPoint; radius: Integer): Boolean;
begin
Result := Sqr(pt.x - center.x) + Sqr(pt.y - center.y) <= Sqr(radius);
end;

//yours:
function WithinCircle(Cx, Cy, Ra: Integer; I: Tpoint): Boolean;
var
TP1: Tpoint;
begin
TP1 := point(Cx, Cy);
if PtToHyp(I, TP1) < Ra then
Result := True
else
Result := False;
end;
Also, the name "PtToHyp" could use some rethinking, this is for example more clear: DistanceBetween(ptA,ptB..) (not the best example), or better yet, write a type-helper: "TPoint.DistanceTo(pt..)"


Avoid nested logic, it's hard to follow, harder to maintain, and often looks bad. You can in many case avoid some nested logic by for example having a few Exit() statements, which makes for an early return, or by separating the function in to smaller functions, or simply rewriting the concept. Referring to function GetTarget: Boolean;


Those were used for determining the distance from player location to portal, but I ended up using them to see if the attack target was inbound. Thank you, and a couple functions were done by Main and I re-did them because they were from SRL-5 and not working. Yeah the comment for the function was incorrect, I got lazy on commenting them all and copy and pasted for the comments, forgot to update it. Thanks.

Thank you, I'll definitely be working on improvement.

3Garrett3

2014-12-03 10:36:14

From: slacky
Okay. So I decided to not be an asshole


Dear Diary,

Today was the happiest day of my life.

-Garrett

OT: Votes look good, vouch from Clarity is good, everything is awesome. Keep it up

Lucidity

2014-12-03 11:05:33

From: 3Garrett3
Dear Diary,

Today was the happiest day of my life.

-Garrett

OT: Votes look good, vouch from Clarity is good, everything is awesome. Keep it up


Thank you, I really appreciate it! :)

Ashaman88

2014-12-03 11:55:39

Good enough for me - voted yes

Frement

2014-12-03 12:00:07

If it's good enough for asha, it's good enough for me.

Lucidity

2014-12-03 14:28:42

Thank you Ash and Frement, getting approval from you both and clarity has really boosted my confidence.

The Mayor

2014-12-04 20:40:19

I assume this is based off Mains old script? I would prefer to see what parts came from his script and what parts you wrote yourself, rather than giving him a general mention. Nonetheless it would have been quite a bit of work to convert this from srl5 to srl6 ;)

The Mayor

2014-12-04 20:51:41

From: slacky
Okay. So I decided to not be an asshole.


Once does not simply 'decide' to be an asshole. You either are one or you're not.

Olly

2014-12-04 21:24:08

This is based (uh.. exact copy) of mains old script, you should note that.

More to the point you need to really give out credit? Quite disappointed actually.

You even copied useless things such as:
Function Compas: Integer;
Begin
Result := Round( RS_GetCompassAngleDegrees);
End;

And the most advanced (math) stuff is just a straight copy and paste:
PtToPol, PolToPt, PtToHyp, WithInLine, WithInCircle, SphereCam.

List goes on and on, the AdvMMToMs I doubt even works well? It's not changed from Mains what so ever, and that was designed for RS in 2011.

There's alot more… heck the whole script.

Your whole FindPortal stuff I wrote, not one mention of me.
Your LocatePotal = exactly what I gave you, properly even the same DTM.

Mains script thread. https://villavu.com/forum/showthread.php?t=66235

I dont mean to be a dick, but this is just a exactly copy of mains script + with some of my functions. All you've seemed to do is add some smart debug, and a srl-player form.

You've basically fooled everyone…. I don't vote on any applications so whatever.

Justin

2014-12-04 21:51:37

Application declined. Please see Olly's post.

Closed & Archived.