SRL Archive - RS3 Script Requests

I need help with an anti dragon shield collector got most of it done


oreokilla

2012-02-13 16:42:11

This script will collect the shields at lumbridge castle from the duke then will bank and go back and repeat… ive got alot of it done just need help now… any help would be appreciated, and this is a very hard script…
program OreosShieldCollectorKilla;
{$DEFINE SMART}
{$i srl/srl.simba}
{$i sps/sps.simba}
{$i ObjectDTM\ObjDTMInclude.simba}

const
{SMART Setup Constants}
WORLD = 0; // Set a world, if you'd like. Leave 0 to choose a random world.
MEMBERS = False; // Are you Members or Free-To-Play? False for F2P, True for P2P.
SIGNED = True;
loadcount = 50;
var
count: integer;
X, Y, T, W, Mat, Mat2, Breaks, ItemColor, MatCount, Loads, Levels, Exp, ItemIndex: Integer;
WalkDown, ToSpin, WalkUp, WalkUpB, ToBank, ToBankB, StatVar: String;
ObjectDTM: ObjDTM;
Climb: Boolean;

{---------------------------}
{--------Script Info--------}
//Author = 'Oreokilla';
//Name = 'OreosShieldKilla';
//Version = '1.0';
{---------------------------}
procedure DeclarePlayers; //This declares the players to be used in the script.
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name := ''; //Your Runescape username
Players[0].Pass := ''; //Your Runescape password
Players[0].Nick := ''; //3 or 4 lowercase letters from your Runescape username. Used as a Nickname.
Players[0].Active := True; //Set to true if you want to use this player. Set to False to disable this player.
Players[0].Pin := ''; //Leave blank if the player doesn't have a Bank PIN.
end;
procedure SetupScript;
begin;

WriteLn('|-------| |-------| |-----/ |\ |');
WriteLn('| | |-------| |----- | \ |');
WriteLn('| | | \ |-----/ | \ |');
WriteLn('| | | \ |----- | \ |');
WriteLn('|-------| | \ |-----/ | \|');
end;
procedure AntiBan;
begin
case random(50) of
0: RandomRClick;
1: PickUpMouse;
2: RandomRClick;
3: SetAngle(SRL_ANGLE_HIGH);
end;
end;
procedure FreeDTMS;
begin
FreeDTM(Mat);
FreeDTM(Mat2);
end;
function Walking(Color, Tolerance: Integer; SortFrom: tpoint): Boolean;// credit to Camaro' for the tutorial and function!
var
i, x, y, rx, ry: Integer;
TPA: TPointArray;
begin
if not LoggedIn then Exit;
FindNormalRandoms;
FindColorsSpiralTolerance(MMCX, MMCY, TPA, Color, MMX1, MMY1, MMX2, MMY2, Tolerance);
SortTPAFrom(TPA, SortFrom);

for i := 0 to High(TPA) do
begin
x := TPA[i].x;
y := TPA[i].y;

rx := RandomRange(-6, 6);
ry := RandomRange(-6, 6);
if (not rs_OnMinimap(x + rx, y + ry)) then
Continue;

Mouse(x + rx, y + ry, 0, 0, mouse_left);
FFlag(0);
Wait(200 + Random(500));
Result := True;
Break;
end;
end;
function FindAndClickDuke: Boolean;
var
x, y : Integer;
begin
if not LoggedIn then Exit;//This is a simple failsafe that will prevent your script from running if your character is not logged in. It should be included in ALL your procedures/functions.
x := MSCX;
y := MSCY;
if FindColorSpiralTolerance(x, y, 6768430, MSX1, MSY1, MSX2, MSY2, 10) then
begin
Writeln('Found Duke!');
MMouse(x, y, 0, 0);
end;
end;


function ContinueThroughGreetings1: Boolean;
var
x, y : Integer;
begin
if not LoggedIn then Exit;//This is a simple failsafe that will prevent your script from running if your character is not logged in. It should be included in ALL your procedures/functions.
x := MSCX;
y := MSCY;
if FindColorSpiralTolerance(x, y, 1121816, MSX1, MSY1, MSX2, MSY2, 10) then
begin
Writeln('Found Arrow!');
MMouse(x, y, 0, 0);
end;
end;
function ContinueThroughGreetings2: Boolean;
var
x, y : Integer;
begin
if not LoggedIn then Exit;//This is a simple failsafe that will prevent your script from running if your character is not logged in. It should be included in ALL your procedures/functions.
x := MSCX;
y := MSCY;
if FindColorSpiralTolerance(x, y, 13158600, MSX1, MSY1, MSX2, MSY2, 10) then
begin
Writeln('Found 1!');
MMouse(x, y, 0, 0);
end;
end;
function ContinueThroughGreetings3: Boolean;
var
x, y : Integer;
begin
if not LoggedIn then Exit;//This is a simple failsafe that will prevent your script from running if your character is not logged in. It should be included in ALL your procedures/functions.
x := MSCX;
y := MSCY;
if FindColorSpiralTolerance(x, y, 536603, MSX1, MSY1, MSX2, MSY2, 10) then
begin
Writeln('Found arrow2!');
MMouse(x, y, 0, 0);
end;
end;
function ContinueThroughGreetings4: Boolean;
var
x, y : Integer;
begin
if not LoggedIn then Exit;//This is a simple failsafe that will prevent your script from running if your character is not logged in. It should be included in ALL your procedures/functions.
x := MSCX;
y := MSCY;
if FindColorSpiralTolerance(x, y, 536603, MSX1, MSY1, MSX2, MSY2, 10) then
begin
Writeln('Found arrow3!');
MMouse(x, y, 0, 0);
end;
end;
Procedure WalkToStairs;
begin
if not (LoggedIn) then
Exit;
if not (FindNormalRandoms) then
begin
if not (RunEnergy(25)) then
MakeCompass('n');
Wait(RandomRange(600, 900));
if (ObjDTM_find(WalkUp, x, y, false)) then
begin
ObjDTM_Walk(WalkUp, 1, 1000, 30, false);
Wait(RandomRange(2000, 2500));
end else
if (RadialWalkTolerance(602202, 100, 200, 50, -1, 0, 7)) then
begin
Writeln('Walking to stairs');
end else
begin
Wait(RandomRange(600, 900));
if not (ObjDTM_Walk(WalkUp, 1, 400, 15, false)) then
begin
Writeln('First ObjDTM failed, trying the second.2');
if not (ObjDTM_Walk(WalkUpB, 1, 500, 15, false)) then
if not (Walking(6580336, 23, Point(612, 106))) then
begin
Writeln('Failed to walk to stairs from Spinner');
Logout;
Exit;
end;
end;
end;
end;
end;


function ClimbStairs(GoingUp: Boolean): Boolean;
var
CTS, I, Len, StairColor, Tol, X, Y: Integer;
Hue, Sat: Extended;
StairOptions, UpTextOptions: TStringArray;
StairCenters, StairTPA: TPointArray;
StairATPA: T2DPointArray;
begin
if not (LoggedIn) then
Exit;
if (FindNormalRandoms) then
Exit;
While (IsMoving) do
Wait(RandomRange(700, 900));

Result := False;
StairColor := 5398378;

Hue := 0.18; Sat := 0.26; Tol := 4;
UpTextOptions := ['limb', 'air', 'case', 'stair'];

if GoingUp then
StairOptions := ['Climb-up', 'up', 'b-u']
else
StairOptions := ['Climb-down', 'down', 'b-d', 'ow'];

CTS := GetColorToleranceSpeed;
SetColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Hue, Sat);

while Tol < 30 do
begin

if not FindColorsTolerance(StairTPA, StairColor, MSX1, MSY1, MSX2, MSY2, Tol)
then
IncEx(Tol, 5)
else
Break;
end;

if Length(StairTPA) = 0 then
Exit;

SetColorSpeed2Modifiers(0.2, 0.2);
SetColorToleranceSpeed(CTS);

SplitTPAExWrap(StairTPA, 26, 26, StairATPA);
SortATPASize(StairATPA, True);

Len := Length(StairATPA);
SetLength(StairCenters, Len);

for I := 0 to (Len - 1) do
StairCenters[i] := MiddleTPA(StairATPA[i]);

for I := 0 to (Len - 1) do
begin

MouseBox(StairCenters[i].x - 8, StairCenters[i].y - 8,
StairCenters[i].x + 10, StairCenters[i].y + 10, 3);

if not WaitUpTextMulti(UpTextOptions, 500) then
Continue;

GetMousePos(X, Y);
Mouse(X, Y, 0, 0, mouse_right);

if WaitOptionMulti(StairOptions, 500) then
begin

Wait(200);
Wait(300 + Random(300));
Flag;
Result := True;
Break;
end;
end;
end;

procedure StairsToBank;
begin
if not (LoggedIn) then
Exit;
if not (FindNormalRandoms) then
begin
if not (RunEnergy(25)) then
Wait(RandomRange(800, 1000));
if (ObjDTM_find(ToBank, x, y, false)) then
begin
Writeln('Walking to the bank');
ObjDTM_Walk(ToBank, 1, 1000, 30, false);
end else
begin
Writeln('Didn'+#39+'t find the DTM the first try, trying once last time.1');
if not ObjDTM_Walk(ToBank, 1, 1000, 30, false) then
begin
if not ObjDTM_Walk(ToBank, 1, 100, 80, false) then
begin
Writeln('Failed to walk to bank from stairs');
Logout;
Exit;
end;
end;
end;
end;
end;
function Bank: Boolean;
Var
x, y: integer;
begin
if (InvFull) then
begin
Wait (300 + random(160));
OpenBankQuiet('db');
if(FindColorSpiral(x, y, 3745323, 547, 206, 734, 464))then
begin
Mouse(x, y, 4, 3, false);
ChooseOption('All');
end;
CloseBank;
Wait(150 + random (278));
end;
end;

procedure BankToStairs;
var
x, y: Integer;
begin
if not (LoggedIn) then
Exit;
if not (FindNormalRandoms) then
begin
Wait(RandomRange(100, 400));
Writeln('Walking to the stairs');
MakeCompass('n');
Wait(RandomRange(100, 400));
if (ObjDTM_Find(WalkDown, x, y, false)) then
begin
ObjDTM_Walk(WalkDown, 1, 1000, 30, false);
end else
begin
if not ObjDTM_Walk(WalkDown, 1, 1000, 30, false) then
if not (Walking(7041903, 20, Point(616, 134))) then
begin
Writeln('Failed to walk to stairs from bank');
LogOut;
Exit;
end
end;
end;
end;

function ClimbStairs2(GoingUp: Boolean): Boolean;
var
CTS, I, Len, StairColor, Tol, X, Y: Integer;
Hue, Sat: Extended;
StairOptions, UpTextOptions: TStringArray;
StairCenters, StairTPA: TPointArray;
StairATPA: T2DPointArray;
begin
if not (LoggedIn) then
Exit;
if (FindNormalRandoms) then
Exit;
While (IsMoving) do
Wait(RandomRange(700, 900));

Result := False;
StairColor := 5398378;

Hue := 0.18; Sat := 0.26; Tol := 4;
UpTextOptions := ['limb', 'air', 'case', 'stair'];

if GoingUp then
StairOptions := ['Climb-up', 'up', 'b-u']
else
StairOptions := ['Climb-down', 'down', 'b-d', 'ow'];

CTS := GetColorToleranceSpeed;
SetColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Hue, Sat);

while Tol < 30 do
begin

if not FindColorsTolerance(StairTPA, StairColor, MSX1, MSY1, MSX2, MSY2, Tol)
then
IncEx(Tol, 5)
else
Break;
end;

if Length(StairTPA) = 0 then
Exit;

SetColorSpeed2Modifiers(0.2, 0.2);
SetColorToleranceSpeed(CTS);

SplitTPAExWrap(StairTPA, 26, 26, StairATPA);
SortATPASize(StairATPA, True);

Len := Length(StairATPA);
SetLength(StairCenters, Len);

for I := 0 to (Len - 1) do
StairCenters[i] := MiddleTPA(StairATPA[i]);

for I := 0 to (Len - 1) do
begin

MouseBox(StairCenters[i].x - 8, StairCenters[i].y - 8,
StairCenters[i].x + 10, StairCenters[i].y + 10, 3);

if not WaitUpTextMulti(UpTextOptions, 500) then
Continue;

GetMousePos(X, Y);
Mouse(X, Y, 0, 0, mouse_right);

if WaitOptionMulti(StairOptions, 500) then
begin

SMART_DrawDotsEx(True, StairATPA[i], clWhite);
Wait(200);
SMART_ClearCanvas;
Wait(300 + Random(300));
Flag;
Result := True;
Climb := True;
Break;
end;
end;
end;
Procedure StairsToDuke;
var
x, y : Integer;
begin
if not LoggedIn then Exit;//This is a simple failsafe that will prevent your script from running if your character is not logged in. It should be included in ALL your procedures/functions.
x := MSCX;
y := MSCY;
if FindColorSpiralTolerance(x, y, 14203802, MSX1, MSY1, MSX2, MSY2, 10) then
begin
Writeln('Going To Duke!');
MMouse(x, y, 0, 0);
end;
end;


function StairAutoColor(var TheColor: Integer): Boolean;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.18, 0.14);

FindColorsSpiralTolerance(MMCX, MMCY, arP, 5332585, MMX1, MMY1, MMX2, MMY2, 4);
if (Length(arP) = 0) then
begin
Result := False;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 9.37) and (X <= 13.60) and (Y >= 9.62) and (Y <= 13.87) and (Z >= 7.82) and (Z <= 11.21) then
begin
TheColor := arC[i];
Result := True;
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Result := False;
end;


Begin
Smart_Server := WORLD;
Smart_Members := MEMBERS;
Smart_Signed := SIGNED;
Smart_SuperDetail := False;
SetupSRL;
SetupScript;
declarePlayers;
LoginPlayer;

begin
AntiBan;
FindAndClickDuke;
ContinueThroughGreetings1;
ContinueThroughGreetings2;
ContinueThroughGreetings3;
ContinueThroughGreetings4;
WalkToStairs;
StairsToBank;
Bank;
BankToStairs;
StairsToDuke;
repeat
AntiBan;
FindAndClickDuke;
ContinueThroughGreetings1;
ContinueThroughGreetings2;
ContinueThroughGreetings3;
ContinueThroughGreetings4;
WalkToStairs;
StairsToBank;
Bank;
BankToStairs;
StairsToDuke;
FreeDtmS;
until (count=loadcount)
end;
end.

laakerules

2012-02-13 19:22:40

Whats wrong with it? :P

oreokilla

2012-02-13 21:07:56

ok for 1 it says could not free dtm wen running script

laakerules

2012-02-13 21:52:09

Which dtm, if its lamp and mod dtm dont worry.

oreokilla

2012-02-14 08:10:25

no bc it doesnt do anything lol

Grihmm

2012-02-14 08:38:55

DTM's not being freed isn't a big deal. It happens a lot. Make a procedure called FreeDTMs and make the procedure free all the DTMs in your script. Then call the procedure every once in a while.

The Killer

2012-02-14 15:13:24

…

The Killer

2012-02-14 15:15:52

now u have a new proplem :s - Error: Exception: "" is an invalid integer at line 810
The following DTMs were not freed: [SRL - Lamp bitmap, 1]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap]

oreokilla

2012-02-14 17:15:43

So what should i do???

Gl3nn IV

2012-02-18 21:31:55

Compiles alright for me, just alot of varibles not used.
Want me to test?

Edit: My bad, it complies, then it loads you in-game, then the error comes up…

tehq

2012-02-21 12:48:45

I made something that does a lot of these functions (but using all DTMs). It's working fine. I can send it to you in a pm if you want. I'm not using mine for a shield script ;)