eska
2012-03-23 01:03:18
How Long have You Played Runescape?
7 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
No
What is your general programming knowledge?
C++, C#, C, java, a bit of HTML and now pascal that I recently learned with Simba
Are you a member of any other communities?
No
Tell us about yourself…
Please show us one (or multiple) of your scripts.
Script is to big to fit in, mainly because of the bitmap. So I removed it to paste it here.
7 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
No
What is your general programming knowledge?
C++, C#, C, java, a bit of HTML and now pascal that I recently learned with Simba
Are you a member of any other communities?
No
Tell us about yourself…
From: sir eska eau
I live in Canada, I'm a student in computer science. I'm passionate about programming, technology, video games, astronomy and evolutionary biology.
I've never really made script for runescape except for a partyroom looter that I made for RSBuddy, kept private and then shortly after bot nuke GF'd me and my script.
As soon as I joined this community I started downloading script and adapt them to my liking. For example, take a LRC script, add mouse key to it as well as low alchemy support, or take a broken script and make it work again.
I then started to work on my own script, the script I'm applying with, a monkey knife fighter thiever. Bonus xp was on his way however so I was in a rush to get 99 thieving before quickly making a mahogany table maker (quick and dirty) to get 99 construction on BXWE. I made it, and so now I started working on my monkey knife fighter script once again.
I've recently released it and got positive feedback telling me I should apply with this script, so here I am.
Comment about the script: It would seem like I can't attach it to this post for some reason… and the comment are all messed up in the text for because spaces aren't the same in the forum than in Simba. Oh well..
It consist of about 1300 lines of code and comments + a big bitmap for the paint that makes a total of 3000 lines. I won't go in great detail about all the failsafe / technique it uses because you can look at the code yourself. See my sig for more info about my scripts.
Please show us one (or multiple) of your scripts.
Script is to big to fit in, mainly because of the bitmap. So I removed it to paste it here.
program MonkeyThiever;
{$i srl/srl/misc/smart.simba}
{$i SRL/SRL.simba}
{$i sps/sps.simba}
{$I Srl/Srl/Skill/Fighting.Simba}
{$i SRL/SRL/Misc/PaintSmart.simba}
{-------------------------------------------------------------------------------
| * * * * * * * * * * * * * * * * Credit * * * * * * * * * * * * * * * * * |
--------------------------------------------------------------------------------
| * Pown Otto for his awesome graphic paint. |
| * Flight for his OnScreen function. |
| * Anyone who made a tutorial, I probably watched it. Thanks |
-------------------------------------------------------------------------------}
{==============================================================================|
| Monkey Thiever by Sir Eska Eau V0.4 |
|==============================================================================|
| |
| Monkey |
| Thiever: This script pickpocket monkey knife fighter on Ape Atoll, the | |
| fastest XP in the game! The script eat when low life points and |
| logout when extremly low life points without food. If you fail to |
| punch a monkey 3/4 time in a row, you will be placed in prison. No |
| worries, this script knows how to escape the prison! Once it's out |
| it will automaticaly run back to the monkey knife fighter building,|
| go upstair and start pickpocketing them once again. The walking |
| methods used are: DDTMs, radial walking (failsafe to DDTMs) and |
| finaly SPS (failsafe to radial walking). Should all 3 methods fail,|
| you will be loged out. This script support AntiRandom even if it |
| isn't needed, since you can't recieve a random while in a monkey |
| form! Finaly, the antiban mimic what a real human would do: you |
| will find that the script perform more antiban when the player is |
| stunned. Should the script fail to detect it is in the prison or |
| fail to find a monkey, it will logout the player after a certain |
| amount of search attempt. |
| |
| For instructions on how to use, please visit the thread related |
| to this script: |
| |
| [url]http://villavu.com/forum/showthread.php?t=77489[/url] |
| |
| Please post on this thread if you enjoy this script! Progress |
| report are also very welcome. |
| |
{==============================================================================|
| CHANGE HISTORY |
|==============================================================================|
| VBETA: * Beta release. |
| * Alot of small fixes. |
| * Some more fixes. |
| * Guess what? MORE FIXES!!! |
| |
| V0.1 : * Initial release. |
| |
| V0.11: * Changed the way we detect if we are in prison. It should work now |
| even if you plant your caracter in prison on purpose |
| * Fixed a fail safe that was meant to log you out if it can't find |
| monkeys for a certain amount of time. |
| |
-------------------------------------------------------------------------------}
{-------------------------------------------------------------------------------
| * * * * * * * * * * * * * DO NOT CHANGE THOSE * * * * * * * * * * * * * * |
-------------------------------------------------------------------------------}
type //|
ColorObject = record //|
Color: Integer; //|
HMod: Extended; //|
SMod: Extended; //|
Tolerance: Integer; //|
UpText: TStringArray; //|
end; //|
//|
type //|
PaintTitle = record //|
title: string; //|
location: TPoint; //|
end; //|
//|
var //|
SRLStats_Username, SRLStats_Password: String; //|
{------------------------------------------------------------------------------}
{-------------------------------------------------------------------------------
| * * * * * * * * * * * * * Adjust as needed * * * * * * * * * * * * * * * *|
-------------------------------------------------------------------------------}
const // Global constant
USE_PAINT = True; // Set to False if you don't want a nice graphic paint
DRAW_COLOR_DETECTED= True; // If you want to see what the script see.
SERVER = 77; // The runescape server you want to use.
procedure LoadUserVars;
begin
Smart_Server := 63; // The server you want to login into.
SRLStats_Username := ''; // SRL Stats username. You can leave it blank.
SRLStats_Password := ''; // SRL Stats password.
end;
procedure DeclarePlayers;
begin
HowManyPlayers := 1; // Change this to add more players
CurrentPlayer := 0;
NumberOfPlayers(HowManyPlayers);
with Players[0] do
begin
Name := ''; // Username
Pass := ''; // Password
Pin := ''; // Bank pin
Member := True;
Active := True;
end;
{ // Remove comment and adjust numbers to add more players.
with Players[1] do
begin
Name := ''; // Username
Pass := ''; // Password
Pin := ''; // Bank pin
Member := True;
Active := True;
end;
}
end;
{*******************************************************************************
* * * * DO NOT CHANGE ANYTHING BELLOW UNLESS YOU KNOW WHAT YOU ARE DOING * * * *
*******************************************************************************}
var
gStatus: string;
gSuccesfullPunches: extended;
gXpAtLastCommit, gFailToFind, gStartingXp, gLastCommitSent,
gPrisonEscape, gTimeLastTextReport: Integer;
monkeyFighterColorObject, bambooLadderColorObject, // Custom color object
jailLockColorObject: ColorObject; // Custom color object
dtmLobster, dtmMithScimmy, dtmAddyScimmy, // Static DTMs
bmpPaint: Integer; // Bitmaps
gPaintTitleArray: array of PaintTitle; // Array of type paintTitle (used to
// draw title that do not change on
// the graphic paint).
const
SCRIPT_NAME= 'MonkeyThiever';
SCRIPT_VERSION= 'V0.11';
SIGNED= True;
MEMBERS= True;
ClearTime= 20;
DrawDebugs= True;
AREA_X1= MSX2/2-50; // Area used to restrain the area we are searching for a
AREA_Y1= MSY2/2-40; // monkey. This allow to reduce the occurance of going
AREA_X2= MSX2/2+50; // to another monkey while pickkpocketing another one.
AREA_Y2= MSY2/2+50;
// *****
// * TextProgressReport : Display some interesting information every 2 minutes
// * or once the script closes.
// *
procedure TextProgressReport;
begin
writeLn('---------------------------------------------------------');
writeLn('--------------MonkeyThiever by Sir Eska Eau--------------');
writeLn('------------------------- ' + SCRIPT_VERSION
+ ' --------------------------');
writeLn('Time running: ' + TimeRunning);
writeLn('Total XP: ' + IntToStr((GetXPBarTotal - gStartingXp)));
writeLn('XP/Hour is: ' + inttoStr(Round(((GetXPBarTotal - gStartingXp)
/ (GetTimeRunning / 1000)) * 3600)));
writeLn('Successful punches: ' + ToStr(Round(gSuccesfullPunches)));
writeLn('Prison escapes: ' + IntToStr(gPrisonEscape));
writeLn('---------------------------------------------------------');
end;
// *****
// * DisplayOnScreenProgressReport : Display some interesting information
// * directly on the runescape client.
// * Author: Heavily inspired from Flight's onScreen function.
// *
procedure DisplayOnScreenProgressReport(onlyStatus: Boolean);
var
partOfPaint, i, currentXP, numberOfLoop, XPSinceLastCommit: Integer;
text: string;
pointXY: TPoint;
begin
currentXP:= GetXPBarTotal;
XPSinceLastCommit:= (currentXP - gXpAtLastCommit)
if ((TimeFromMark(gLastCommitSent) > 310000)) then // Just a bit over 5 min
begin
if (XPSinceLastCommit > 20000) then
XPSinceLastCommit:= 19000;
if (XPSinceLastCommit < 0) then
XPSinceLastCommit:= 10;
stats_IncVariable('Total EXP Gained', XPSinceLastCommit);
stats_IncVariable('Thieving EXP (Gained)', XPSinceLastCommit);
stats_Commit;
gXpAtLastCommit:= CurrentXP;
MarkTime(gLastCommitSent);
end;
if (onlyStatus) then // To only refresh the status, most of the time we don't
begin // need to refresh the whole paint just to say we are
numberOfLoop:= 0; // punching a monkey...
end else
begin
numberOfLoop:= 6;
end;
for i:= 0 to numberOfLoop do
begin
case i of
0:
begin
pointXY:= point(120, 35);
text:= gStatus;
end;
1:
begin
pointXY:= point(120, 60);
text:= MsToTime(GetTimeRunning, Time_Bare);
end;
2:
begin
pointXY:= point(120, 85);
text:= inttostr(currentXP - gStartingXp);
end;
3:
begin
pointXY:= point(120, 110);
text:= inttoStr(Round(((currentXP - gStartingXp)
/ (GetTimeRunning / 1000)) * 3600)) + '/hour';
end;
4:
begin
pointXY:= point(430, 35);
text:= tostr(gSuccesfullPunches);
end;
5:
begin
pointXY:= point(430, 60);
text:= IntToStr(gPrisonEscape);
end;
6:
begin
pointXY:= point(430, 85);
text:= 'N/A';
end;
end;
// We copy as small part of the bitmap (the part behind the text) to cover
// the old text. This is to avoid reloading the whole paint for no reason.
if (i = 0) then
begin
partOfPaint:= GetMufasaBitmap(bmpPaint).Copy(pointXY.X, pointXY.Y,
pointXY.X + 140, pointXY.Y + 20).Index;
end else
begin
partOfPaint:= GetMufasaBitmap(bmpPaint).Copy(pointXY.X, pointXY.Y,
pointXY.X + 77, pointXY.Y + 20).Index;
end;
// We copy the part of the bitmap we just copied right over we took it to
// hide the "old" text.
SMART_DrawBitmap(False, partOfPaint, Point(pointXY.X + MCX1,
pointXY.Y + MCY1));
// Since this is in a loop we need to free the bitmap everytime or else we
// will have a memory leak!
FreeBitmap(partOfPaint);
// We (finaly) draw the text we wanted to write all along.
SMART_DrawTextEx(False, pointXY.X + MCX1, pointXY.Y + MCY1, SmallChars,
text, clWhite);
end;
end;
// *****
// * StatusReport : Refresh the status text of the paint array. None of the
// * other variables in the paint are modified to
// * reduce ressource consomation.
// *
procedure StatusReport(status: string);
begin
gStatus:= status;
if (USE_PAINT) then
DisplayOnScreenProgressReport(True);
end;
// *****
// * ChangeUser : Write a message of the reason why we need to change user
// * and then proceed to logout the current user and set the next
// * user up.
// *
procedure ChangeUser(reason: string);
begin
WriteLn('We are loging out: ' + reason + '.');
Wait(5000 + Random(5000));
Logout;
Players[CurrentPlayer].Active:= False;
NextPlayer(Players[CurrentPlayer].Active);
end;
// *****
// * SetDDTMPoint : Recieve a number related to a DDTM and return the DDTM.
// *
function SetDDTMPoint(i: Integer): Integer;
var
tolerance: Integer;
dtmMainPoint: TDTMPointDef;
dtmSubPoints: Array of TDTMPointDef;
TempTDTM: TDTM;
begin
tolerance:= 15; // For adjusting tolerance easily
// Will eventualy make it dynamic on
// execution.
case i of
0: // Dirt road.
begin
SetArrayLength(dtmSubPoints, 8);
dtmMainPoint.x := 752;
dtmMainPoint.y := 279;
dtmMainPoint.AreaSize := 1;
dtmMainPoint.AreaShape := 0;
dtmMainPoint.Color := 3367279;
dtmMainPoint.Tolerance := tolerance;
dtmSubPoints[0].x := 752;
dtmSubPoints[0].y := 279;
dtmSubPoints[0].AreaSize := 1;
dtmSubPoints[0].AreaShape := 0;
dtmSubPoints[0].Color := 3367279;
dtmSubPoints[0].Tolerance := tolerance;
dtmSubPoints[1].x := 756;
dtmSubPoints[1].y := 275;
dtmSubPoints[1].AreaSize := 1;
dtmSubPoints[1].AreaShape := 0;
dtmSubPoints[1].Color := 3168871;
dtmSubPoints[1].Tolerance := tolerance;
dtmSubPoints[2].x := 753;
dtmSubPoints[2].y := 284;
dtmSubPoints[2].AreaSize := 1;
dtmSubPoints[2].AreaShape := 0;
dtmSubPoints[2].Color := 1918803;
dtmSubPoints[2].Tolerance := tolerance;
dtmSubPoints[3].x := 752;
dtmSubPoints[3].y := 288;
dtmSubPoints[3].AreaSize := 1;
dtmSubPoints[3].AreaShape := 0;
dtmSubPoints[3].Color := 2051418;
dtmSubPoints[3].Tolerance := tolerance;
dtmSubPoints[4].x := 750;
dtmSubPoints[4].y := 287;
dtmSubPoints[4].AreaSize := 1;
dtmSubPoints[4].AreaShape := 0;
dtmSubPoints[4].Color := 3367279;
dtmSubPoints[4].Tolerance := tolerance;
dtmSubPoints[5].x := 749;
dtmSubPoints[5].y := 279;
dtmSubPoints[5].AreaSize := 1;
dtmSubPoints[5].AreaShape := 0;
dtmSubPoints[5].Color := 3367279;
dtmSubPoints[5].Tolerance := tolerance;
dtmSubPoints[6].x := 751;
dtmSubPoints[6].y := 277;
dtmSubPoints[6].AreaSize := 1;
dtmSubPoints[6].AreaShape := 0;
dtmSubPoints[6].Color := 3367279;
dtmSubPoints[6].Tolerance := tolerance;
dtmSubPoints[7].x := 748;
dtmSubPoints[7].y := 292;
dtmSubPoints[7].AreaSize := 1;
dtmSubPoints[7].AreaShape := 0;
dtmSubPoints[7].Color := 3367279;
dtmSubPoints[7].Tolerance := tolerance;
end;
1: // Monkey house
begin
SetArrayLength(dtmSubPoints, 6);
dtmMainPoint.x := 908;
dtmMainPoint.y := 253;
dtmMainPoint.AreaSize := 1;
dtmMainPoint.AreaShape := 0;
dtmMainPoint.Color := 7243667;
dtmMainPoint.Tolerance := tolerance;
dtmSubPoints[0].x := 908;
dtmSubPoints[0].y := 253;
dtmSubPoints[0].AreaSize := 1;
dtmSubPoints[0].AreaShape := 0;
dtmSubPoints[0].Color := 7243667;
dtmSubPoints[0].Tolerance := tolerance;
dtmSubPoints[1].x := 922;
dtmSubPoints[1].y := 243;
dtmSubPoints[1].AreaSize := 1;
dtmSubPoints[1].AreaShape := 0;
dtmSubPoints[1].Color := 5399919;
dtmSubPoints[1].Tolerance := tolerance;
dtmSubPoints[2].x := 922;
dtmSubPoints[2].y := 264;
dtmSubPoints[2].AreaSize := 1;
dtmSubPoints[2].AreaShape := 0;
dtmSubPoints[2].Color := 6124157;
dtmSubPoints[2].Tolerance := tolerance;
dtmSubPoints[3].x := 903;
dtmSubPoints[3].y := 265;
dtmSubPoints[3].AreaSize := 1;
dtmSubPoints[3].AreaShape := 0;
dtmSubPoints[3].Color := 6321793;
dtmSubPoints[3].Tolerance := tolerance;
dtmSubPoints[4].x := 897;
dtmSubPoints[4].y := 259;
dtmSubPoints[4].AreaSize := 1;
dtmSubPoints[4].AreaShape := 0;
dtmSubPoints[4].Color := 7243667;
dtmSubPoints[4].Tolerance := tolerance;
dtmSubPoints[5].x := 903;
dtmSubPoints[5].y := 247;
dtmSubPoints[5].AreaSize := 1;
dtmSubPoints[5].AreaShape := 0;
dtmSubPoints[5].Color := 7243667;
dtmSubPoints[5].Tolerance := tolerance;
end;
end;
TempTDTM.MainPoint := dtmMainPoint;
TempTDTM.SubPoints := dtmSubPoints;
Result := AddDTM(TempTDTM);
end;
// *****
// * WalkToDDTM : Recieve a DDTM in parameters and attempt to walk to it.
// *
function WalkToDDTM(i: Integer; var x, y: Integer; spotName: string): Boolean;
var
DDTM: Integer;
begin
DDTM:= SetDDTMPoint(i);
if (DTMRotated(DDTM, x, y, MMX1, MMY1, MMX2, MMY2)) Then
begin
StatusReport('DDTM walk to: ' + spotName + '.');
Mouse(x, y, 1, 1, True);
Wait(500 + Random(100));
Result:= True;
end else
begin
StatusReport('DDTM: can''t find ' + spotName + '.');
Wait(500 + Random(100));
Result:= False;
end;
GetMousePos(x, y);
FreeDTM(DDTM); // We free DDTM right here. Due to their
// dynamic nature it is unlikely that the
// exact same DDTM will be re used many time.
end;
// *****
// * LoadPaintTitleArray : Fills an array with object of type PaintTitles used
// * to draw things that do not change on the paint to
// * reduce ressource consomation.
// *
procedure LoadPaintTitleArray;
var
titleLocationPaintTitle: PaintTitle;
i: Integer;
begin
SetLength(gPaintTitleArray, 9);
for i := 0 to 8 do
begin
case i of
0:
with titleLocationPaintTitle do
begin
title:= SCRIPT_VERSION
+ ' by Sir Eska Eau';
location:= Point(226, 8);
end;
1:
with titleLocationPaintTitle do
begin
title:= 'Status: ';
location:= Point(15, 35);
end;
2:
with titleLocationPaintTitle do
begin
title:= 'Time running: ';
location:= Point(15, 60);
end;
3:
with titleLocationPaintTitle do
begin
title:= 'Total XP: ';
location:= Point(15, 85);
end;
4:
with titleLocationPaintTitle do
begin
title:= 'XP/Hour: ';
location:= Point(15, 110);
end;
5:
with titleLocationPaintTitle do
begin
title:= 'Successful punches: ';
location:= Point(280, 35);
end;
6:
with titleLocationPaintTitle do
begin
title:= 'Prison escape: ';
location:= Point(280, 60);
end;
7:
with titleLocationPaintTitle do
begin
title:= 'Reserved space: ';
location:= Point(280, 85);
end;
8:
with titleLocationPaintTitle do
begin
title:= 'Graphics by Pown Otto';
location:= Point(345, 110);
end;
end;
gPaintTitleArray[i]:= titleLocationPaintTitle;
end;
end;
// *****
// * DropScimitar :
// *
// *
procedure LoadTypes;
begin
// Color Object definitions
with monkeyFighterColorObject do
begin
Color:= 2371157;
HMod:= 0.52;
SMod:= 5.16;
Tolerance:= 5;
UpText:= ['onkey', 'nife', 'fighter'];
end;
with bambooLadderColorObject do
begin
Color:= 2574168
HMod:= 0.02
SMod:= 0.06
Tolerance:= 13
UpText:= ['limb', 'amboo', 'adder'];
end;
with jailLockColorObject do
begin
Color:= 8092546;
HMod:= 0.13
SMod:= 0.07
Tolerance:= 22
UpText:= ['ail', 'oor'];
end;
end;
// *****
// * DropScimitar : Search for a mithril scimitar and drop it, if it can't find
// * one, it search for an adamant scimitar and drop it.
// * If nothing is found, nothing happen.
function DropScimitar: Boolean;
var
x, y: Integer;
begin
if (FindDTM(dtmMithScimmy, x, y, MIX1, MIY1, MIX2, MIY2)) then
begin
MMouse(x, y, 10, 10);
Wait(30+Random(30));
if (WaitUpTextMulti(['Wield','Mithril', 'scimitar'], 200)) then
begin
Result:= True;
ClickMouse2(False); // Right click
WaitOptionEx('rop', 'action', ClickLeft, 200+Random(100))
end;
end else
begin
if (FindDTM(dtmAddyScimmy, x, y, MIX1, MIY1, MIX2, MIY2)) then
begin
Result:= True;
MMouse(x, y, 10, 10);
Wait(30+Random(30));
if (WaitUpTextMulti(['Wield','Adamant', 'scimitar'], 200)) then
begin
ClickMouse2(False); // Right click
WaitOptionEx('rop', 'action', ClickLeft, 200+Random(100));
end;
end;
end;
end;
// *****
// * EatSomething : Simply eat a lobster if one is found in the inventory.
// *
function EatSomething: Boolean;
var
x, y: Integer;
begin
if (FindDTM(dtmLobster, x, y, MIX1, MIY1, MIX2, MIY2)) then
begin
Result:= True;
MMouse(x, y, 10, 10);
Wait(30+Random(30));
if (WaitUpTextMulti(['Eat', 'obster'], 200)) then
ClickMouse2(True); // Nom nom nom
end;
end;
function DropLobster: Boolean;
var
x, y: Integer;
begin
Result:= True;
if (FindDTM(dtmLobster, x, y, MIX1, MIY1, MIX2, MIY2)) then
begin
Result:= True;
MMouse(x, y, 10, 10);
Wait(30+Random(30));
if (WaitUpTextMulti(['Eat', 'obster'],200)) then
begin
ClickMouse2(False);
WaitOptionEx('rop', 'action', ClickLeft, 200+Random(100))
end;
end;
end;
// *****
// * DoAntiBan : A collection of random action to reduce the probability of
// * getting banned by Jagex.
// *
procedure DoAntiBan;
var
r: Integer;
begin;
if not (LoggedIn) then Exit;
r:= Random(100);
case r of
15:
begin
StatusReport('Antiban: Hover skill.');
HoverSkill('thieving', False);
GameTab(Tab_Inv);
end;
21, 22, 23, 24, 25,
26, 27, 28, 29, 30,
51, 52, 53, 54, 55,
61, 62, 63, 64, 65,
66, 67, 68, 69:
begin
StatusReport('Antiban: Eat Something.');
GameTab(Tab_Inv);
Wait(200+Random(50));
if (HPPercent < 80) then
EatSomething;
end;
30, 31, 32, 33, 34,
35, 36, 37, 38, 39,
40:
begin
StatusReport('Antiban: Switch to tab');
GameTab(Tab_Inv);
Wait(200+Random(50));
DropScimitar;
end;
50:
begin
StatusReport('Antiban: Pick up mouse.');
PickUpMouse;
end;
10, 60:
begin
StatusReport('Antiban: Right click.');
RandomRClick;
end;
70:
begin
StatusReport('Antiban: Examine invy.');
GameTab(Tab_Inv);
Wait(50+Random(80));
ExamineInv;
end;
// There is alot of switch tab because I don't want
90: // it to be 100% random and go in stuff that no one
begin // ever goes like music, emote and shit.
StatusReport('Antiban: Switch tab.');
GameTab(tab_Combat);
Wait(RandomRange(200, 400));
GameTab(Tab_Inv);
end;
91:
begin
StatusReport('Antiban: Switch tab.');
GameTab(tab_Equip);
Wait(RandomRange(200, 400));
GameTab(Tab_Inv);
end;
92:
begin
StatusReport('Antiban: Switch tab.');
GameTab(tab_Friends);
Wait(RandomRange(200, 400));
GameTab(Tab_Inv);
end;
93:
begin
StatusReport('Antiban: Switch tab.');
GameTab(tab_FriendChat);
Wait(RandomRange(200, 400));
GameTab(Tab_Inv);
end;
94, 95:
begin
StatusReport('Antiban: Switch tab.');
GameTab(tab_Stats);
Wait(RandomRange(200, 400));
GameTab(Tab_Inv);
end;
96:
begin
StatusReport('Antiban: Switch tab.');
GameTab(tab_Prayer);
Wait(RandomRange(100, 300));
GameTab(tab_Quest);
Wait(RandomRange(200, 400));
GameTab(Tab_Inv);
end;
end;
end;
// *****
// * HPLow : Return True if the hit points are bellow 55 percent.
// *
function HPLow: Boolean;
begin
Result:= (HPPercent < 55);
end;
// *****
// * PlayerStunned : Search for a HP bar over the player. If found, the player
// * is stunned. Made a dedicated function for this just to
// * make the code easier to understand.
// *
function PlayerStunned: Boolean;
begin
Result:= Infight;
end;
// *****
// * FindObjectTPA : Uses ATPA to locate an object of type colorObject in a
// * certain area. If found, it will return the x and y
// * coordnate or the object.
// *
function FindObjectTPA(var x, y: Integer; areaX1, areaY1, areaX2,
areaY2: Integer; objectColorObject:ColorObject): Boolean;
var
CTS, i, size: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed; // To restore the color tolerance later
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(objectColorObject.HMod, objectColorObject.SMod);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, objectColorObject.Color, areaX1,
areaY1, areaX2, areaY2, objectColorObject.Tolerance);
ColorToleranceSpeed(CTS); // Restore previous color tolerance speed
ATPA := TPAToATPAEx(TPA, 20, 20);
size:= High(ATPA); // To avoid calling High more than one time
// for no reason since the value never changes
// once we are in this function.
if (DRAW_COLOR_DETECTED) then
begin
SMART_ClearCanvasArea(IntToBox(MSX1, MSY1, MSX2, MSY2));
SMART_DrawDotsMulti(False, ATPA);
end;
For I := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 5, 5); // We randomise now so that when we use the
// use the coordonate outside of this function,
// we don't miss the target because of post
// randomisation.
Wait(100 + Random(50));
if (IsUpTextMultiCustom(objectColorObject.UpText)) then
begin
Result := True;
GetMousePos(x, y);
Break; // We found the object so we exit the loop
end else
begin
Result:= False;
end;
end;
end;
// *****
// * InPrison : Detect the if something is talking to us. If so, we are in
// * most liekly in prison.
// *
function InPrison: Boolean;
var
location: TPoint;
begin
location:= SPS_GetMyPos;
if ((location.x > 2895) and (location.x < 2955) and (location.y < 5530)
and (location.y > 5465)) then
Result:= true
end;
// *****
// * WalkToMonkeyHouse : Start out of the prison and walk to the monkey knife
// * fighter using DDTMs. If DDTMs walking fail, will use
// * radial walk. If radial walking fail, will use SPS
// * walking. Finaly, if all 3 fail, will change user.
// *
function WalkToMonkeyHouse(var x, y: Integer): Boolean;
begin
if not (WalkToDDTM(1, x, y, 'monkeys')) then
begin
if not (RadialWalkTolerance(7572883, 275, 180, 60, 2, 2, 10)) then
begin
if not (SPS_WalkPath([Point(2913, 5485), Point(2889, 5487),
Point(2874, 5468), Point(2849, 5477),
Point(2838, 5497)])) then
begin
Result:= False;
ChangeUser('Failed to walk to monkeys');
Exit;
end;
end;
end;
Wait(2000 + Random(500)); // To give some time for the flag to appear.
Flag; // We wait for the flag to dissapear before
// going up the ladder.
// We should now be at the monkey house
// Now, we just go up the ladder to be alone
MakeCompass('S');
SetAngle(SRL_ANGLE_HIGH);
if (FindObjectTPA(x, y, MSX1, MSY1, MSX2, MSY2, BambooLadderColorObject)) then
begin // We click the ladder
ClickMouse2(True);
end;
ClickNorth(SRL_ANGLE_HIGH);
Wait(3000 + Random(2000));
Result:= True;
end;
// * WalkToMonkeyHouse : Start in the prison and walk to the dirt road just
// * outside fighter using DDTMs. If DDTMs walking fail,
// * will use radial walk. If all both fail, will change
// * user.
// *
function WalkToDirtRoad(var x, y: Integer): Boolean;
begin
if not (WalkToDDTM(0, x, y, 'dirt road')) then
begin
WriteLn('Walking using SPS!');
if not (SPS_WalkToPos(Point(2889, 5487))) then
begin
if not (RadialWalkTolerance(3301484, 290, 250, 45, 2, 2, 10)) then
begin
Result:= False;
ChangeUser('Failed to walk to dirt road');
Exit;
end else
begin
WriteLn('Radial walk is a succes!');
Flag;
Wait(1000 + Random(500));
end;
end;
end;
Result:= True;
end;
function WalkToCorner: Boolean;
var x, y: Integer;
begin
if not (WalkToDDTM(0, x, y, 'corner')) then
begin
if not (RadialWalkTolerance(3301484, 300, 270, 65, 2, 2, 10)) then
begin
Result:= False;
ChangeUser('Failed to walk to corner');
Exit;
end else
begin
WriteLn('Radial walk is a succes!');
Wait(8000 + Random(1000));
end;
end;
Result:= True;
end;
// *****
// * LockPickJailDoor : Search, find, and try to pick lock the door until it
// * succeed or until 2 minutes has passed.
// *
function LockPickJailDoor: Boolean;
var
x, y, t, previousXP, newXP, pickLockTime: Integer;
begin
if not (LoggedIn) then
Exit;
MarkTime(t);
repeat
if not (WalkToCorner) then // To get in the north east corner of
begin // the prison to make sure we can see
Result:= False; // the lock on the door.
Exit;
end;
Wait(1500+Random(500)); // To give us time to move to the corner
previousXp:= GetXPBarTotal; // before attempting to picklock.
MarkTime(pickLockTime);
repeat
if (FindObjectTPA(x, y, MSX1, MSY1, MSX2, MSY2, jailLockColorObject)) then
begin
StatusReport('Lockpicking the door...');
ClickMouse2(True);
Wait(1000 + Random(500));
newXp:= GetXPBarTotal;
end;
until (TimeFromMark(pickLockTime) > 10000)
or FindBlackChatMessage('anage to pick')
or (newXP - 2 = previousXP);
until (TimeFromMark(t) > 120000) // We also check XP because
or FindBlackChatMessage('anage to pick') //FindBlackChatMessage
or (newXP - 2 = previousXP) // sometime fail to find the message
or (newXP - 1 = previousXP); // even if it is right there.
if (TimeFromMark(t) > 120000) then
begin
Result:= False;
ChangeUser('Failed to picklock the door');
Exit;
end;
Result:= True; // True if it made it past all the fail safe.
end;
// * JailBreak : Calls the functions needed to escape the prison and walk back
// * where the monkey knife fighter are.
// *
function JailBreak: Boolean;
var
x, y, t, flagTime: Integer;
begin
if not (LoggedIn) then
Exit;
ClickNorth(SRL_ANGLE_HIGH);
if not (LockPickJailDoor) then
Exit;
MarkTime(t);
repeat
if not (WalkToDirtRoad(x, y)) then
begin
Result:= False;
ChangeUser('Failed to walk to the dirt road');
Exit;
end else
begin
MarkTime(flagTime);
Flag;
if (TimeFromMark(flagTime) < 2000) then
begin
StatusReport('Monkey blocking, waiting.');
Wait(500 + Random(500));
end;
end;
until (TimeFromMark(t) > 120000) or (((MMCX + 10) > x) and ((MMCX - 10) < x)
and ((MMCY + 10) > y) and ((MMCY - 10) < y));
// This checks if the mouse is pointing really close to the center of
// the minimap. If it is the case, then it mean that the DDTM or the
// radial walk made it to their destination.
if (TimeFromMark(t) > 120000) then // Escape failed if it took more than
begin // 2 minutes.
Result:= False;
ChangeUser('The jail escape took more than 2 minutes');
Exit;
end;
result:= True;
end;
// *****
// * PickMonkey : Search, find and pickpocket the closest monkey.
// *
procedure PickMonkey(areaX1, areaY1, areaX2, areaY2: Integer);
var
x, y: Integer;
begin
if not (LoggedIn) then
Exit;
if (FindObjectTPA(x, y, areaX1, areaY1, areaX2, areaY2,
monkeyFighterColorObject)) then
begin
gStatus:= 'Pickpocketing monkey...';
if (USE_PAINT) then
DisplayOnScreenProgressReport(True);
ClickMouse2(False);
WaitOptionEx('ickpocket', 'action', ClickLeft, 70 + Random(40))
end;
end;
// *****
// * PunchMonkey : Search, find and punch the closest monkey.
// *
function PunchMonkey(areaX1, areaY1, areaX2, areaY2: Integer): Boolean;
var
x, y: Integer;
begin
Result:= False;
if not (LoggedIn) then
Exit;
if (FindObjectTPA(x, y, areaX1, areaY1, areaX2, areaY2,
monkeyFighterColorObject)) then
begin // We do not check if we are stunned
gStatus:= 'Punching monkey...'; // because it allows us to save some
// precious seconds.
if (USE_PAINT) then
DisplayOnScreenProgressReport(True);
gFailToFind:= 0; // We reset our failsafe since we found a monkey.
ClickMouse2(False); // Right click on the monkey
if (WaitOptionEx('unch', 'action', ClickLeft, 150+Random(50))) then
begin
Result:= True;
gFailToFind:= 0; // We reset our failsafe since we found a monkey.
// monkey.
end;
end else
begin
StatusReport('Can''t find monkey: ' + Inttostr(gFailToFind));
inc(gFailToFind);
end;
end;
// *****
// * Steal : Calls all the functions related to pickpocketing monkeys.
// *
procedure Steal(areaX1, areaY1, areaX2, areaY2: Integer);
begin
if not (LoggedIn) then
Exit;
if (gFailToFind > 5) then
MMouse(200,200,100,100); // Attempt to unstuck the mouse (this happen on
// rare occasion)
if not (PlayerStunned) then
begin
if (PunchMonkey(areaX1, areaY1, areaX2, areaY2)) then
begin
wait(250+Random(30)); // if we don't wait the we won't
// even recieve the xp!
if not (PlayerStunned) then
PickMonkey(areaX1, areaY1, areaX2, areaY2);
wait(250+Random(30));
if not (PlayerStunned) then
PickMonkey(areaX1, areaY1, areaX2, areaY2);
wait(100+Random(30));
end;
end;
end;
// *****
// * MainLoop : The heart of the script. It calls all the important function
// * and procedure to make the script work properly.
// *
procedure MainLoop;
var
x, y, t, i, r, r2: Integer;
begin
if not (LoggedIn) then
Exit;
FindNormalRandoms;
if (TimeFromMark(gTimeLastTextReport) > 120000) then
begin
MarkTime(gTimeLastTextReport);
TextProgressReport;
end;
case gFailToFind of
0..2: Steal(AREA_X1, AREA_Y1, AREA_X2, AREA_Y2); // We search a small area
3..100: Steal(MSX1, MSY1, MSX2, MSY2); // We search the whole screen
end;
if (PlayerStunned) then
begin
repeat
Wait(400 + Random(200));
DoAntiBan;
until not PlayerStunned or (TimeFromMark(t) > 2500);
Wait(300 + Random(300));
end else
begin
gSuccesfullPunches:= gSuccesfullPunches + 1; // For the progress report
end;
if (Random(10) = 1) then // There is a small chance to get an
begin // antiban action while not stunned.
DoAntiBan; // This is to reflect what a real player
wait(200+Random(50)); // would do, and also to not hurt our
end; // Xp/hour rate too much.
if not (PlayerStunned) then
Wait(100+Random(200)); // We wait only if we are not stunned.
if (HPLow) then
begin
StatusReport('We are low HP... eating.');
EatSomething;
if (HPPercent < 30) then
begin
ChangeUser('Low hp, no food');
Exit;
end;
end;
if (InvFull) then
begin
StatusReport('Making invy space.');
r:= RandomRange(4, 15);
for i:=0 to r do
begin
r2:= RandomRange(1, 4);
case r2 of
1:
begin
if (EatSomething) then
Wait(1500 + Random(500));
end;
2:
begin
if (DropScimitar) then
Wait(500 + Random(500));
end;
3:
begin
if (DropLobster) then
Wait(900 + Random(500));
end;
end;
end;
end;
if (gFailToFind > 20) then
begin
PlaySound('C:/Simba/alarm.wav');
Wait(5000);
if (gFailToFind > 30) then
begin
ChangeUser('We failed to find monkeys 30 time in a row');
Exit;
end;
end;
if (InPrison) then
begin
StatusReport('We are in jail!');
if not (JailBreak) then
begin
Exit;
end else
begin
if not (WalkToMonkeyHouse(x, y)) then
begin
Exit;
end;
end;
inc(gPrisonEscape);
end;
end;
// *****
// * FreeAllDTMsBMPs : Free the memory of all the global DTMs used in the script
// * to reduce the risk of memory leak.
// *
procedure FreeAllMemory;
begin
try
// DTMs
FreeDTM(dtmLobster);
FreeDTM(dtmMithScimmy);
FreeDTM(dtmAddyScimmy);
// Bitmaps
FreeBitmap(bmpPaint);
except
WriteLn('Some memory might have been leaked.');
end;
TextProgressReport;
SMART_ClearCanvas;
end;
// *****
// * LoadBmp : Loads are the bitmaps in variables.
// *
procedure LoadBmp;
var
arraySize, i: Integer;
begin
bmpPaint := BitmapFromString(510, 133, '');
SMART_DrawBitmap(True, bmpPaint, Point(MCX1, MCY1));
arraySize:= high(gPaintTitleArray);
for i := 0 to arraySize do // Paint all the title on the on screen report.
begin
SMART_DrawTextEx(False, MCX1 + gPaintTitleArray[i].Location.X,
MCY1 + gPaintTitleArray[i].Location.Y, UpCharsEx,
gPaintTitleArray[i].Title, clBtnFace);
end;
end;
// *****
// * LoadDTMs : Loads are the statics deformable template model in variables.
// *
procedure LoadDTMs;
begin
dtmAddyScimmy:= DTMFromString('mWAAAAHicY2FgYPjNxMDwD4h/AvEXIG5lhOBOIO4B4rjcO'
+ 'AZ9c30GQ0sjhuDEYAYuoB5kzIiGQQAAVnwJow==');
dtmMithScimmy:= DTMFromString('mFQEAAHic42VgYBACYi4gZmaAADYg5gRifiDmA2IRIJYAY'
+ 'mkgloSq54Gy5aDigkjiQlC9IDNZoWayA3FmdhWQZCIJczGQDhjJwCgAAE1'
+ 'zAww=');
dtmLobster:= DTMFromString('mWAAAAHicY2FgYBBiZmAQBWJhIOYA4p+MDAxfgZiBiYHhB5Be'
+ 'GSLBsDVKkmGatyjDwgBxBi6gFDJmRMMgAACWwwel');
Wait(500 + Random(1000));
end;
// *****
// * SetupPlayer : Initialise important variables related to a runescape
// * account.
// *
procedure SetupPlayer;
begin
if not (LoggedIn) then
LoginPlayer;
wait(500 + random(400));
ToggleXPBar(True);
if (IsXPBarOpen) Then
begin
gStartingXp := GetXPBarTotal;
gXpAtLastCommit:= gStartingXp;
end;
Setchat('All', 0);
end;
// *****
// * SetUpScript : Define some mandatory variables for the script
// *
procedure SetUpScript;
begin
ClearReport;
ClearDebug;
Smart_Server := 63;
Smart_Signed := True;
Smart_Members := True;
Smart_SuperDetail := False;
SetupSRL;
SPS_Setup(RUNESCAPE_SURFACE,['6_13', '7_13']);
ActivateClient;
DeclarePlayers;
LoadUserVars; // Load user defined variables
MouseSpeed:= 12 + Random(3);
SetupRandomTool(30000 + Random(5000), 2, 'C:/Simba/alarm.wav');
if (USE_PAINT) then
begin
LoadPaintTitleArray;
LoadBmp;
end;
LoadTypes;
LoadDTMs;
AddOnTerminate('FreeAllMemory');
if (SRLStats_Username = '') then
begin
SRLStats_Username := 'Anonymous';
SRLStats_Password := 'anon1337';
end;
SetupSRLStats(913, SRLStats_Username, SRLStats_Password);
gFailToFind:= 0; // Used to detect if we are stuck.
gSuccesfullPunches:= 0; // Used for the on text/screen report.
gPrisonEscape:= 0; // Used for the on text/screen report
MarkTime(gTimeLastTextReport); // Used to only post a text report every 2 min
MarkTime(gLastCommitSent); // Used to send stats every 5 min.
end;
// *****
// * Main program
// *
begin
SetUpScript;
StatusReport('Loading please wait...');
SetupPlayer;
repeat
if not (LoggedIn and not (CurrentPlayer > howManyPlayers)) then
SetupPlayer;
if (USE_PAINT) then
DisplayOnScreenProgressReport(False); // refresh all the information
MainLoop;
until AllPlayersInactive;
end.