Ogre
2009-07-30 15:30:51
How Long have You Played Runescape?
4 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
Pascal/SCAR
Are you a member of any other communities?
RSBot, Freddy1990, Zaszmedia. I believe that's all.
Tell us about yourself…
Please show us one (or multiple) of your scripts.
4 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
Pascal/SCAR
Are you a member of any other communities?
RSBot, Freddy1990, Zaszmedia. I believe that's all.
Tell us about yourself…
From: Ogre
I live in Arizona. I like to play Ultimate Frisbee and Halo 3, run, script, #srl, and more. :D
I've been at SRL for 4 months, and have made some person scripts (very simple things, not even bankers), and started scripts with which I wanted to apply to SRL Members, but never finishe them. This is the first one that I have actually completed.
Please show us one (or multiple) of your scripts.
//Mines and banks iron ore in the varrock east mine
//Start players in the bank
program New;
{.include srl/srl/misc/smart.scar}
{.include SRL/SRL.scar}
{.include srl/srl/misc/Reports.scar}
var
OreDTM, PickDTM: Integer;
CopperDTM, IronDTM, TinDTM: Integer;
Walk1, Walk2, Walk3, Walk4, MineDTM, MineDTM2: Integer;
BankDTM, Inv, S, Mining: Integer;
const
Members = False; //P2P?
PowerMine = False; //Powermine (drop ores), instead of banking?
MiningTime = 4; //Will wait a max of x seconds to mine ore
TakeBreaks = True; //Takes breaks
BreakLength = 20; //Length of break, randomized
HowOften = 40; //How many minutes until you take a break?
Procedure DeclarePlayers;
begin
NumberOfPlayers(2);
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Active := True;
Players[0].Nick := '';
Players[1].Name := '';
Players[1].Pass := '';
Players[1].Active := True;
Players[1].Nick := '';
end;
procedure Sleeep;
var
i, N: Integer;
begin
if not TakeBreaks then Exit;
if not TimeFromMark(S) < ((HowOften * 60000)+RandomRange(120000, 240000)) then
Exit;
Status('Sleeping..');
if LoggedIn then Logout;
N:= RandomRange(60000,80000) * BreakLength;
for i:= 0 to N do
begin
Wait(1);
Status('Sleeping for '+MsToTime(N - i, 0));
end;
Wait(RandomRange(60000,80000) * BreakLength);
Status('Done Sleeping');
LoginPlayer;
MarkTime(S);
end;
procedure Proggy;
begin
ClearReport;
ChangeReportWidth(600);
SRLPlayerReport(ResultReportBox, GetSkillLevel('mining'), False,
[True, False, False, True, True, False],
['Ores', 'Banked'],[], [Players[CurrentPlayer].Integers[0], Players[CurrentPlayer].Integers[0]],[],[])
end;
procedure DTMs;
begin
Walk1 := DTMFromString('78DA639CC3C6C0C0CAC8800C7ABA9B18E4803' +
'448F43F1030CE05AAF981A28461CA8414B81A1060049923CC8857' +
'0D00F8D00BFF');
Walk2 := DTMFromString('78DA63EC61636050666440063DDD4D0C72401' +
'A24FA1F08182700D5C8E25603028C13816AF4F0AB0100C7620B58' +
'');
Walk3 := DTMFromString('78DA636C6063608863640001660608E8E96E6' +
'29003D220D1FF40C0580354E38FAAC64E810BAE0604182702D524' +
'A1AAB19065405103009AA6096D');
Walk4 := DTMFromString('78DA632C63636048666440065D1D0D0C22401' +
'A24FA1F081853806AC2216A58B0A80101C6394035F1A86A1C4204' +
'50D40000CC0F0AB3');
MineDTM := DTMFromString('78DA63B4626260B06240017E9AA20C22409A1' +
'188FF0301A33EA69A245369B81A1060F404AA3121A0C600A8C60B' +
'554D9183328A1A001FCC08F6');
MineDTM2 := DTMFromString('78DA63CC626260706500032608C5A0EFCACE2' +
'002A41981F83F1030460365AC50D5D82970C1D58000633EA69ABE' +
'EE1614350016D508B8');
BankDTM := DTMFromString('78DA632C626260C86100031608C5F0F52B038' +
'306906604E2FF40C0580B54938BAAE6CF1F26B81A1060CC24AC06' +
'00277C0D09');
PickDTM := DTMFromString('78DA6334666360A862644006FA0AAC0CFF813' +
'448F43F1030EA01D5E4A1AA81C8C24820ED02545346408D3E504D' +
'1B01353A40352DF8D500008A0208E9');
OreDTM := DTMFromString('78DA6334636560A8646440065EBA4A0CFF813' +
'448F43F10301A02D5E4A0AA81C8C24820ED00545340408D3D504D' +
'2D0135464035ED04D4A862BA195D0D0013D609D9');
CopperDTM := DTMFromString('78DA6394676360C861644006E7CB4C18F8803' +
'448F43F1030AA02D5C4A3AA81C8C24820AD0E54534C408D30116A' +
'F8816A72F1AB010068070860');
IronDTM := DTMFromString('78DA63F4666360C8656440060186AA0CFC401' +
'A24FA1F0818FD816AE251D540646124900E06AA2926A0C609A8A6' +
'94801A4BA09A1CFC6A0041A1086B');
TinDTM := DTMFromString('78DA632C616360C861644006DD8D0D0CFC401' +
'A24FA1F08180B816AE250D540646124906E02AA4927A0A618A8A6' +
'9C809A64A09A3CFC6A0021C30A1C');
end;
procedure FreeEm;
begin
FreeDTM(Walk1);
FreeDTM(Walk2);
FreeDTM(Walk3);
FreeDTM(Walk4);
FreeDTM(MineDTM);
FreeDTM(OreDTM);
FreeDTM(IronDTM);
FreeDTM(CopperDTM);
FreeDTM(TinDTM);
end;
function CountOre(Write: Boolean): TIntegerArray;
var
Count, I, x, y: Integer;
B : TBox;
begin
if not LoggedIn then Exit;
SetLength(Result, 3);
for I:= 1 to 28 do
begin
B:= InvBox(I);
if FindDTM(ironDTM, x, y, B.X1, B.Y1, B.X2, B.Y2) or FindDTM(ironDTM, x, y, B.X1, B.Y1, B.X2, B.Y2) then
Inc(Count);
end;
Result[0]:= Count;
Players[CurrentPlayer].Integers[0]:= Players[CurrentPlayer].Integers[0] + Count;
Inc(Players[CurrentPlayer].Integers[1]);
if Write then WriteLn('Found '+IntToStr(Count)+' Iron Ores');
Count:= 0;
for I:= 1 to 28 do
begin
B:= InvBox(I);
if FindDTM(tinDTM, x, y, B.X1, B.Y1, B.X2, B.Y2) or FindDTM(tinDTM, x, y, B.X1, B.Y1, B.X2, B.Y2) then
Inc(Count);
end;
Result[1]:= Count;
if Write then WriteLn('Found '+IntToStr(Count)+' Tin Ores');
Count:= 0;
for I:= 1 to 28 do
begin
B:= InvBox(I);
if FindDTM(copperDTM, x, y, B.X1, B.Y1, B.X2, B.Y2) or FindDTM(copperDTM, x, y, B.X1, B.Y1, B.X2, B.Y2) then
Inc(Count);
end;
Result[2]:= Count;
if Write then WriteLn('Found '+IntToStr(Count)+' Tin Ores');
end;
function StringIn(part, whole: String): Boolean;
begin
if (pos(part, whole) > 0) then Result := True;
end;
procedure UpTextPick;
var
UT: String;
begin
UT:= GetUpText;
if StringIn('rune', UT) then Players[CurrentPlayer].Strings[0]:= 'Rune';
if StringIn('dam', UT) then Players[CurrentPlayer].Strings[0]:= 'Adamant';
if StringIn('thri', UT) then Players[CurrentPlayer].Strings[0]:= 'Mithril';
if StringIn('tee', UT) then Players[CurrentPlayer].Strings[0]:= 'Steel';
if StringIn('ron', UT) and (not(StringIn('ronz', UT))) then Players[CurrentPlayer].Strings[0]:= 'Iron';
if StringIn('ronz', UT) then Players[CurrentPlayer].Strings[0]:= 'Bronze';
end;
function Bank: Boolean;
var
Time, T: Integer;
begin
Result:= False;
if not LoggedIn then Exit;
Status('Banking..');
OpenBankQuiet('veb');
MarkTime(Time);
while not BankScreen do
begin
Wait(300 + Random(100));
if TimeFromMark(Time) > 5000 then
begin
OpenBank('veb', True, True);
MarkTime(T);
while not BankScreen do
begin
Wait(300 + Random(100));
if TimeFrommark(T) > 5000 then
begin
WriteLn('Couldn''t open the bank');
Players[CurrentPlayer].Active:= False;
LogOut;
Exit;
end;
end;
end;
end;
Result:= True;
end;
function FindPick: Boolean;
var
x, y: Integer;
begin
Result:= False;
if not LoggedIn then Exit;
Status('Looking for pickaxe..');
GameTab(tab_Equip);
if FindDTM(PickDTM, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
MMouse(x, y, 9, 9);
UpTextPick;
Players[CurrentPlayer].Booleans[0]:= True;
WriteLn('Wielding a '+Players[CurrentPlayer].Strings[0]+' Pickaxe');
Result:= True;
Exit;
end else
begin
GameTab(tab_Inv);
if FindDTM(PickDTM, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
MMouse(x, y, 9, 9);
UpTextPick;
GetMousePos(x, y);
Mouse(x, y, 0, 0, True);
Wait(300 + Random(100));
if FindDTM(PickDTM, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
WriteLn('Found a '+Players[CurrentPlayer].Strings[0]+' Pickaxe.');
Players[CurrentPlayer].Booleans[0]:= False;
Result:= True;
end else
begin
WriteLn('Weilding a '+Players[CurrentPlayer].Strings[0]+' Pickaxe.');
Players[CurrentPlayer].Booleans[0]:= True;
Result:= True;
end;
end;
end;
end;
function DepositOres: Boolean;
var
x, y, T: Integer;
begin
Result:= False;
if not LoggedIn then Exit;
if not BankScreen then Result:= Bank;
CountOre(True);
if Players[CurrentPlayer].Booleans[0] then
begin
DepositAll;
Result:= True;
end else
begin
MouseSpeed:= 18;
repeat
Inc(T);
if FindDTM(OreDTM, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
Mouse(x, y, 9, 9, False);
ChooseOption('ll');
end else
begin
WriteLn('Ores not found with DTM, trying a bitmap');
if FindDTM(ironDTM,x, y, MIX1, MIY1, MIX2, MIY2) then
begin
Mouse(x, y, 9, 9, False);
ChooseOption('ll');
end;
if FindDTM(copperDTM,x, y, MIX1, MIY1, MIX2, MIY2) then
begin
Mouse(x, y, 9, 9, False);
ChooseOption('ll');
end;
if FindDTM(tinDTM,x, y, MIX1, MIY1, MIX2, MIY2) then
begin
Mouse(x, y, 9, 9, False);
ChooseOption('ll');
end;
end;
Wait(400 + Random(200));
until not FindDTM(OreDTM, x, y, MIX1, MIY1, MIX2, MIY2) or (T > 2)
end;
CloseBank;
Status('Banked Ores');
Proggy;
end;
function ClickOre(Iron: Boolean): Boolean;
var
x, y, i, H, T, cts : Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
Result:= False;
if not LoggedIn then Exit;
cts:= GetColorToleranceSpeed;
ColorToleranceSpeed(2);
repeat
Inc(T);
FindColorsSpiralTolerance(513, 184, TPA, 2700886, MSX1, MSY1, MSX2, MSY2, 10);
if Length(TPA) <= 0 then Exit;
ATPA:= TPAToATPA(TPA, 1)
SortATPAFrom(ATPA, Point(MSCX, MSCY));
H := High(aTPA);
for i := 0 to H do
begin
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 0, 0);
if IsUpText('ine') then
begin
Mouse(x, y, 0, 0, True);
Result:= True;
Exit;
end;
end;
until (T = 10) or (Result = True)
end;
function IsMining: Boolean;
var
i: Integer;
begin
Result:= True;
for i:= 0 to 20 do
begin
Wait(50);
if InvCount > Inv then
begin
Result:= False;
Break;
end;
end;
end;
procedure FNR(R: Integer);
begin
FindNormalRandoms;
//AutoResponder;
if Random(R) = 1 then
begin
case Random(6) of
1: RandomRClick;
2: PickupMouse;
3: RandomMovement;
4: BoredHuman;
5: ExamineInv;
6: HoverSkill('mining', False);
end;
end;
end;
function OgreWalk(TheColor: Integer; StartRadial, EndRadial: Integer; Radius: Integer; Xmod, YMod: Integer; DTM: Integer): Boolean;
var
x, y: Integer;
Angle: Extended;
begin
Result:= False;
if not LoggedIn then Exit;
if not RadialRoadWalk(TheColor, StartRadial, EndRadial, Radius, Xmod, Ymod) then
begin
if not RadialRoadWalk(FindVarrockRoadColor, StartRadial, EndRadial, Radius, Xmod, Ymod) then
begin
if FindColorTolerance(TheColor, x, y, 673, 24, MMX2, MMY2, 25) then
if not MFNF(x, y, Xmod, Ymod) then
begin
if DTM = -9001 then
begin
WriteLn('Walking failed');
Players[CurrentPlayer].Loc:= 'Lost';
end;
if FindDTMRotated(DTM, x, y, MIX1, MIY1, MIX2, MIY2, StartRadial, EndRadial, 1, Angle) then
begin
if MFNF(x + Random(2), y + Random(2), Xmod, Ymod) then Result:= True
end else
begin
WriteLn('Walking failed');
Players[CurrentPlayer].Loc:= 'Lost';
end;
end;
end;
end;
if (Players[CurrentPlayer].Loc = 'Lost') then
begin
Players[CurrentPlayer].Active:= False;
Logout;
Exit;
end;
Result:= True;
FNR(7);
FFlag(0);
end;
function ToMine: Boolean;
var
x, y, i, T, VRC, MineDTM, DTM: Integer;
B: Boolean;
Angle: Extended;
begin
Result:= False;
B:= True;
if not LoggedIn then Exit;
FNR(0);
Sleeep;
Status('Walking to mine..');
SetRun(True);
GameTab(tab_Inv);
if FindDTM(OreDTM, x, y, MIX1, MIY1, MIX2, MIY2) then DepositOres;
FreeEM;
DTMs;
VRC:= FindVarrockRoadColor;
if not OgreWalk(VRC, 30, 90, 65, -2, 2, Walk1) then
begin
Players[CurrentPlayer].Active:= False;
Logout;
Exit;
end else
begin
if not OgreWalk(VRC, 70, 110, 60, 2, 1, Walk2) then
begin
Players[CurrentPlayer].Active:= False;
Logout;
Exit;
end else
begin
repeat
Inc(T);
if (T = 1) then DTM:= Walk3 else DTM:= Walk4;
if not OgreWalk(VRC, 190, 160, 75, 1, -3, DTM) then
begin
for i:= 1 to 7 do
if OgreWalk(VRC, 190 + (10 * i), 160 - (10 * i), 75, 1, -3, DTM) then
Break;
end;
if (i = 7) then
begin
Players[CurrentPlayer].Active:= False;
Logout;
Exit;
end;
if FindSymbol(x, y, 'mining spot') then
begin
WriteLn('Found mining spot');
Break;
end;
until (T > 3);
if not FindDTMRotated(MineDTM, x, y, MMX1, MMY1, MMX2, MMY2, 270, 0, 1, Angle) then
begin
B:= False;
if not FindSymbol(x, y, 'mining spot') then
begin
WriteLn('Didn''t find mining symbol nor the first DTM')
Players[CurrentPlayer].Active:= False;
Logout;
Exit;
end else MFNF(x - RandomRange(7,11), y - RandomRange(4,8), 4, -4);
end else MFNF(x + Random(3), y - Random(4), 3, -3);
Status('At Mine');
if not B then
if FindDTMRotated(MineDTM, x, y, MMX1, MMY1, MMX2, MMY2, 270, 0, 1, Angle) then
MFNF(x + Random(2), y - Random(4), 3, -3);
FFlag(0);
Players[CurrentPlayer].Loc:= 'Mine'
Result:= True;
end;
end;
end;
function ToBank: Boolean;
var
x, y, i, T, VRC: Integer;
Angle: Extended;
B: Boolean;
begin
Result:= False;
if not LoggedIn then Exit;
FNR(3);
Sleeep;
Status('Walking to Bank..');
SetRun(False);
GameTab(tab_Inv);
FreeEm;
DTMs;
MakeCompass(0);
VRC:= FindVarrockRoadColor;
if OgreWalk(VRC, 10, 45, 70, 2, 2, MineDTM2) then
begin
repeat
Inc(T);
if not OgreWalk(VRC, -10, 10, 70, 2, -2, -9001) then
for i:= 0 to 10 do
if OgreWalk(VRC, -10 - (5 * i), 10 + (5 * i), 70, 2, 2, -9001) then
Break;
until FindDTMRotated(Walk2, x, y, MMX1, MMY1, MMX2, MMY2, -30, 30, 1, Angle) or (T > 3);
end else
begin
Players[CurrentPlayer].Active:= False;
Logout;
Exit;
end;
if OgreWalk(VRC, 270, 359, 78, 2, 2, -9001) then
if OgreWalk(VRC, 270, 359, 78, 2, 2, Walk1) then
if OgreWalk(VRC, 260, 270, 78, 2, 2, Walk1) then
for i:= 1 to 12 do
begin
if OgreWalk(VRC, 180, 240, 20 + (5 * i), 2, -2, -9001) then
begin
B:= True;
Break;
end;
if (i = 12) then
begin
Players[CurrentPlayer].Active:= False;
Logout;
Exit;
end;
end;
if B then
begin
Result:= True;
Players[CurrentPlayer].Loc:= 'Bank';
end else
if FindSymbol(x, y, 'bank') then Mouse(x, y, 3, 3, True);
if not DepositOres then Players[CurrentPlayer].Loc:= 'Lost';
end;
procedure DropFromTo(First, Last: Integer);
var
i: Integer;
begin
for i:= First to Last do
DropItem(i);
end;
procedure MineEm;
var
T, Mined, uh: Integer;
begin
SetRun(True);
if not LoggedIn then Exit;
SetAngle(False);
if Players[CurrentPlayer].Booleans[0] then uh := 1 else uh:= 2;
Status('Mining..');
FreeEm;
DTMs;
repeat
Inv:= InvCount;
Status(IntToStr(InvCount)+'/28');
Inc(Mined);
if InvFull then
begin
if PowerMine then DropFromTo(uh, 28) else
if not ToBank then Players[CurrentPlayer].Loc:= 'Lost';
Exit;
end;
T:= 0;
if ClickOre(True) then
repeat
Inc(T);
if not IsMining then
Break;
FNR(0);
until T > MiningTime;
FNR(20);
until not LoggedIn;
if InvFull then
if PowerMine then DropFromTo(uh, 28) else
if not ToBank then Players[CurrentPlayer].Loc:= 'Lost';
end;
procedure LoginEx;
begin
if not LoggedIn then LoginScreenMusic(1);
LoginPlayer;
Mining:= GetSkillLevel('Mining');
WriteLn('Mining level is '+IntToStr(Mining));
GameTab(tab_Equip);
SetAllChats('all', 'all', '', '', '', '');
FindPick;
end;
procedure Setup;
var
i: Integer;
begin
DeclarePlayers;
ClearDebug;
Disguise('Ogre''s Varrock East Miner - Version .1');
ClearDebug;
for i:= 0 to HowManyPlayers do
Players[0].Active := True;
for i:= 0 to HowManyPlayers do
Players[0].Loc := 'Bank';
CurrentPlayer:= 0;
DTMs;
LoginEx;
MarkTime(S);
end;
begin
SetupSRL;
Smart_Members:= Members;
Setup;
repeat
LoginEx;
repeat
if Players[CurrentPlayer].Loc = 'Bank' then
if not ToMine then Players[CurrentPlayer].Loc:= 'Lost' ;
if Players[CurrentPlayer].Loc = 'Mine' then
MineEm;
until not LoggedIn;
NextPlayer(Players[CurrentPlayer].Active);
until AllPlayersInactive;
WriteLn('All Players are Inactive, terminating script.');
Proggy;
TerminateScript;
end.
:)