Rick
2009-08-21 08:08:38
How Long have You Played Runescape?
3 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
C#, Some C++, VB
Are you a member of any other communities?
Was on Mopar, but I'm only active on SRL now.
Tell us about yourself…
Please show us one (or multiple) of your scripts.
3 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
C#, Some C++, VB
Are you a member of any other communities?
Was on Mopar, but I'm only active on SRL now.
Tell us about yourself…
From: r!ch!e
My name is Richard.
I enjoy learning programming languages. And of course long walks on the beach. :p
I wish to become more active in the forums.
3 years has passed since I registered and now I feel that I really understand scripting with SRL.
Please show us one (or multiple) of your scripts.
{=========================================================================]
| Strong Holder |
| Version: 0.35 |
[=========================================================================]
| Description: |
| Trains on any Monster based on user input. |
[=========================================================================]
| Setup: Click Play and Fill in Form, or, set UseForm to False and fill |
| out Declare Players |
[=========================================================================]
| Version: |
| 0.10 - Beta. Random Testing. |
| 0.15 - Fixed Major Heal Bug. |
| 0.20 - First Release. |
| 0.35 - Added Multiplayer, SRL Player Form, Small Fixes |
[=========================================================================]
| Notes: Made by r!ch!e |
| My first SRL script. Please inform me of bugs. |
[=========================================================================]
| About the Name: This was originally for the Stronghold of Security, |
| hence the name, but I adapted it to any monster. |
[=========================================================================}
program StrongHolder;
{.include SRL/SRL/Misc/SMART.SCAR}
{.include SRL/SRL.scar}
{.include SRL/SRL/Misc/Users.scar}
{.include SRL/SRL/Skill/Fighting.scar}
{******************************************************************************)
Setup Here
*******************************************************************************}
const
UseForm = True; // Use SRL PlayerForm ? Or Declare Players ?
DoDebug = 4; // 1 = Status, 2 = Writeln, 3 = Disguise, 4 = All, 5 = None :(
procedure DeclarePlayers;
begin
if not UseForm then
begin
HowManyPlayers := 3;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name :='User Name';
Players[0].Pass :='Password';
Players[0].Nick :='3 - 4 Letters of User Name';
Players[0].Active := True;
Players[0].Booleans[0] := True; //Eat Food?
Players[0].Booleans[1] := True; //Use Run?
Players[0].Integers[0] := 90; //Will Eat/Rest until X% HP
Players[0].Integers[1] := 30; //At X% HP will Eat/Rest
Players[0].Integers[2] := 3; //FightMode. 1 = Attack, 2 = Strengh, 3 = Shared, 4 = Defence
Players[0].Integers[3] := 5789791; //Monster Colours { Actual }
Players[0].Integers[4] := 5658205; //Monster Colours { Minotaur Colours }
Players[0].Integers[5] := 4342343; //Monster Colours { :) }
Players[0].Strings[0] := 'inot'; //Part of Monster Name. Ex. Minotaur = inot
Players[1].Name := 'User Name';
Players[1].Pass := 'Password';
Players[1].Nick := '3 - 4 Letters of User Name';
Players[1].Active := False;
Players[1].Booleans[0] := True; //Eat Food?
Players[1].Booleans[1] := True; //Use Run?
Players[1].Integers[0] := 90; //Will Eat/Rest until X% HP
Players[1].Integers[1] := 30; //At X% HP will Eat/Rest
Players[1].Integers[2] := 3; //FightMode. 1 = Attack, 2 = Strengh, 3 = Shared, 4 = Defence
Players[1].Integers[3] := 5789791; //Monster Colours { Actual }
Players[1].Integers[4] := 5658205; //Monster Colours { Minotaur Colours }
Players[1].Integers[5] := 4342343; //Monster Colours { :) }
Players[1].Strings[0] := 'inot'; //Part of Monster Name. Ex. Minotaur = inot
Players[2].Name := 'User Name';
Players[2].Pass := 'Password';
Players[2].Nick := '3 - 4 Letters of User Name';
Players[2].Active := False;
Players[2].Booleans[0] := True; //Eat Food?
Players[2].Booleans[1] := True; //Use Run?
Players[2].Integers[0] := 90; //Will Eat/Rest until X% HP
Players[2].Integers[1] := 30; //At X% HP will Eat/Rest
Players[2].Integers[2] := 3; //FightMode. 1 = Attack, 2 = Strengh, 3 = Shared, 4 = Defence
Players[2].Integers[3] := 5789791; //Monster Colours { Actual }
Players[2].Integers[4] := 5658205; //Monster Colours { Minotaur Colours }
Players[2].Integers[5] := 4342343; //Monster Colours { :) }
Players[2].Strings[0] := 'inot'; //Part of Monster Name. Ex. Minotaur = inot
end else
SRLPlayerForm(True, ['Eat Food?', 'Use Run?'], ['HPMax (Restore to X% Health)', 'HPRest (At X% will Eat/Rest)', 'Fight Mode (1[Attk], 2[Str], 3[Ctrl], 4[Def])', 'Colour 1', 'Colour 2', 'Colour 3'], ['Part of Monsters Name (Ex. "inot")'], []);
end;
{******************************************************************************)
End Setup
*******************************************************************************}
var
Colours: Array [0..2] Of Integer;
BadMark, Fail: Integer;
{******************************************************************************)
AntiBan + Debug
*******************************************************************************}
procedure Debug(reason:string);
begin
Case DoDebug of
1: Status(Reason);
2: Writeln(Reason);
3: Disguise(Reason);
4: begin
Status(Reason);
Writeln(Reason);
Disguise(Reason);
end;
5: Writeln('');
end;
end;
procedure AntiBan;
begin
Debug('AntiBan ...');
if not LoggedIn then Exit;
FindNormalRandoms;
case Random(20) of
0: begin
case Players[CurrentPlayer].Integers[2] of
1: begin
HoverSkill('Attack', false);
Wait(2453+Random(432));
end;
2: begin
HoverSkill('Strength', false);
Wait(2453+Random(432));
end;
3: begin
HoverSkill('Attack', false);
Wait(2453+Random(432));
end;
4: begin
HoverSkill('Defence', false);
Wait(2453+Random(432));
end;
end;
end;
1: PickUpMouse;
2: begin
MakeCompass('N');
Wait(200+random(60));
MakeCompass('S');
Wait(80+random(25));
MakeCompass('N');
end;
3: RandomRClick;
4: GameTab(1 + Random(12));
5: PickUpMouse;
6: RandomMovement;
7: BoredHuman;
8: begin
SetAngle(False);
Wait(30 + random(10));
SetAngle(True);
end;
9: HoverSkill('Hitpoints', false);
10: BoredHuman;
11: BoredHuman;
end;
FindNormalRandoms;
end;
procedure WaitEx(Time: Integer);
Var
Mark: integer;
begin
if not LoggedIn then Exit;
MarkTime(Mark);
while (TimeFromMark(Mark) < Time) do
begin
FindNormalRandoms;
end;
end;
{******************************************************************************)
Healing Functions
*******************************************************************************}
{*******************************************************************************
function RestHPUntil(Percent: Integer): Boolean;
By: r!ch!e [RestHPUntil]. Based off of ZephyrsFury [RestUntil].
Description: Rests until HP is equal to Percent. Results True if successful.
Modded RestUntil. Restores Hitpoints instead of run.
*******************************************************************************}
function RestHPUntil(Percent: Integer): Boolean;
var
s: string;
i,ii, Mark: integer;
begin
Result := False;
if Percent > 100 then
begin
WriteLn('Invalid HP Percent');
Exit;
end;
ii:= GetSkillInfo('hp',false)
i := Round(GetMMLevels('hp', s) * 100 / ii)
if (i >= Percent) or InFight then Exit;
SetRest;
MarkTime(Mark);
Debug('Resting ...');
while (i < Percent) do
begin
if (TimeFromMark(Mark) > 600000) then Exit;
WaitEx(10000 + random(300));
AntiBan; //Stay Logged in, Stops Banage, Checks for Randoms :)
i := Round(GetMMLevels('hp', s) * 100 / ii);
end;
case i of
Percent: Result:= True;
end;
if not Result then Exit;
WaitEx(100 + Random(50));
end;
function Eat(Percent: Integer):boolean;
var
s: string;
i, ii, iii, x, y, Mark, FailA: integer;
begin
Result := False;
if Percent > 100 then
begin
WriteLn('Invalid HP Percent');
Exit;
end;
ii:= GetSkillInfo('hp',false)
i := Round(GetMMLevels('hp', s) * 100 / ii)
if (i >= Percent) then Exit;
GameTab(4);
MarkTime(Mark);
Debug('Eating ...');
while (i < Percent) do
begin
if (TimeFromMark(Mark) > 180000) then Exit;
for iii := 1 to 28 do
if ExistsItem(iii) then
begin
MMouseItem(iii);
WaitEx(200 + random(30));
if WaitUpText('at', 400) then
begin
GetMousePos(x, y);
Mouse(x,y,0,0,false);
WaitEx(30 + random(50));
if ChooseOption('Eat') then
begin
WaitEx(250 + random(120));
i := Round(GetMMLevels('hp', s) * 100 / ii);
end;
end else
begin
i := Round(GetMMLevels('hp', s) * 100 / ii);
FailA:= FailA + 1;
if (FailA > 28) then
begin
RestHPUntil(Percent);
Exit;
end;
end;
end;
end;
if (i > Percent) then Result:= True;
if (not(Result)) then Exit;
WaitEx(100 + Random(50));
AntiBan;
end;
function Heal(Percent: Integer; Food: Boolean): boolean;
begin
Result:= False;
if Percent > 100 then
begin
Writeln('Invalid HP Percent');
Exit;
end;
if not(LoggedIn) or (HPPercent >= Percent) then Exit;
if Food then
begin
if Eat(Percent) then
begin
Result:= True;
Exit;
end else
begin
if RestHPUntil(Percent) then
begin
Result:= True;
Exit;
end;
end;
end else
if RestHPUntil(Percent) then Result:= True;
end;
procedure HPCheck(Percent: Integer);
begin
Debug('Checking HP ...');
if Percent > 100 then
begin
Writeln('Invalid HP Percent');
//Exit; Let's be nice ;p
Percent := 100;
end;
if not(LoggedIn) or (HPPercent >= Percent) then Exit;
if (HPPercent < Percent) then
begin
Heal(Players[CurrentPlayer].Integers[0], Players[CurrentPlayer].Booleans[0]);
end;
end;
{******************************************************************************)
Fighting Functions
*******************************************************************************}
function FindMonster(Name: String; Colours: TIntegerArray; Tol: Integer): Boolean;
var
x, y, i, ii, iii: Integer;
MTPA: TPointArray;
MATPA: T2DPointArray;
MPoint: TPoint;
begin
Result:= False;
Debug('Finding Monster ...');
if not LoggedIn or InFight then Exit;
iii:= High(Colours)
for i:= 0 to iii do
if FindColorsSpiralTolerance(MSCX + 3, MSCY - 3, MTPA, Colours[i], MSX1, MSY1, MSX2, MSY2, Tol) then
if not FindColorTolerance(x, y, 65280, MPoint.x - 40, MPoint.y - 40, MPoint.x + 40, MPoint.y + 40, 5) then
Break;
begin
MATPA := TPAtoATPAEx(MTPA, 10, 10);
if Length(MATPA) = 0 then Exit;
ii:= High(MATPA);
for i := 0 to ii do
begin
MPoint:= MiddleTPA(MATPA[i])
begin
MMouse(MPoint.x, MPoint.y, 2, 2);
WaitEx(90 + random(60));
if IsUpText(Name) then
begin
GetMousePos(x, y);
case Random(3) of
0..2: begin
Mouse(x, y, 0, 0, False);
WaitEx(100 + random(50));
if ChooseOption('ttac') then
begin
Result:= True;
Debug('Fighting Monster ...');
Exit;
end;
end;
3: begin
if IsUpText(Name) then
begin
Mouse(x, y, 0, 0, True);
WaitEx(600 + Random(75));
if InFight then
begin
Result:= True;
Debug('Fighting Monster ...');
Exit;
end;
end;
end;
end;
end;
end;
end;
end;
if not Result then Fail:= Fail + 1;
end;
procedure InTheFray; //by Narcle. Modded a little.
Var
Mark: integer;
begin
Debug('Waiting for Fight ...');
MarkTime(Mark);
while not InFight and (TimeFromMark(mark) < 6000) do WaitEx(100);
Debug('Fighting ...');
AntiBan;
repeat
HpCheck(Players[CurrentPlayer].Integers[1]);
WaitEx(3000);
until(not(InFight) or not (LoggedIn))
end;
{******************************************************************************)
Setup Procedures
*******************************************************************************}
procedure Report;
var
i: Integer;
begin
Debug('Proggress Report ...');
ClearReport;
ChangeReportWidth(325);
AddToReport(' __________________________________ ');
AddToReport('| |');
AddToReport('| --------- StrongHolder --------- |');
AddToReport('|__________________________________|');
AddToReport('| |');
AddToReport('|Ran For: ' + TimeRunning + ' Minutes |');
for i := 0 to (HowManyPlayers - 1) do
AddToReport('|Player[' + IntToStr(i) + ']: Exp Gained: ' + IntToStr(Players[i].Integers[7] - Players[i].Integers[6]) + ' |');
AddToReport('|__________________________________|');
AddToReport('| |');
AddToReport('| ------------ r!ch!e ------------ |');
AddToReport('|__________________________________|');
AddToReport('');
end;
procedure Sig;
begin
ClearDebug;
Debug('Sig ...');
ChangeReportWidth(275);
Writeln(' ____ _ ___ _ _ _ ____ ');
Writeln('( _ \/ \ / __)/ )( \/ \( __) ');
Writeln(' ) /\_/( (__ ) __ (\_/ ) _) ');
Writeln('(__\_)(_) \___)\_)(_/(_)(____) ');
Wait(2000);
end;
procedure GetXPLvl(old: Boolean);
var
oXP, nXP: Integer;
begin
case old of
True: begin
case Players[CurrentPlayer].Integers[2] of
1: oXP := GetXp('attack');
2: oXP := GetXp('strength');
3: oXP := GetXP('shared');
4: oXP := GetXp('defence');
end;
Players[CurrentPlayer].Integers[6] := oXP;
Debug('Got Old Exp Levels ...');
end;
False: begin
case Players[CurrentPlayer].Integers[2] of
1: nXP := GetXp('attack');
2: nXP := GetXp('strength');
3: nXP := GetXP('shared');
4: nXP := GetXp('defence');
end;
Players[CurrentPlayer].Integers[7] := nXP;
Debug('Got New Exp Levels ...');
end;
end;
end;
procedure NextPlayerEx(Active: Boolean);
begin
GetXPLvl(False);
case Active of
True: NextPlayer(True);
False: NextPlayer(False);
end;
procedure SetFightingMode;
begin
if not LoggedIn then Exit;
SetFightMode(Players[CurrentPlayer].Integers[2]);
end;
procedure SetupRS;
var
i: Integer;
begin
if not LoggedIn then Exit;
Debug('Setting up RuneScape ...');
for i:= 0 to High(Colours) do
Colours[i]:= Players[CurrentPlayer].Integers[i+3];
SetFightingMode;
Wait(500 + random(200));
if Players[CurrentPlayer].Booleans[1] then SetRun(true);
SetAngle(True);
GetXPLvl(True);
Wait(200 + random(50));
end;
procedure SetupSmart;
begin
Debug('Setting up SMART ...');
Smart_Server := 155;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;
Wait(1000);
SetTargetDC(SmartGetDC);
end;
procedure SetupScript;
begin
Fail:= 0;
Sig;
Debug('Setting up Script ...');
SetupSRL;
SetUpSmart;
DeclarePlayers;
Wait(500 + random(100));
end;
{******************************************************************************)
Main Loop
*******************************************************************************}
begin
SetupScript;
Debug('Running Script :)');
repeat
if not LoggedIn then
begin
LoginPlayer;
Wait(500);
SetupRS;
MarkTime(BadMark);
end;
if FindMonster(Players[CurrentPlayer].Strings[0], Colours, 20) then
InTheFray;
if InFight then
InTheFray;
if (Fail > 30) then
NextPlayerEx(False);
if (TimeFromMark(BadMark) > 360000) then
NextPlayerEx(False);
HPCheck(Players[CurrentPlayer].Integers[1]);
WaitEx(5000);
FindNormalRandoms;
until(False);
Debug('Script Finished');
Report;
end.