han941306
2009-05-02 19:44:12
How Long have You Played Runescape?
6 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
ASP, PHP, C++
Are you a member of any other communities?
Sythe
Tell us about yourself…
Please show us one (or multiple) of your scripts.
6 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
ASP, PHP, C++
Are you a member of any other communities?
Sythe
Tell us about yourself…
From: han941306
A student who likes exciting things.
Please show us one (or multiple) of your scripts.
//Test Miner 0.1 Update by Han
//Read Before Using :
//Setup DeclarePlayers; and the Const.
//Updated :
//1. Location and Walking System
//2. Banking Options
//3. Exp Counting
//4. Little change in loop
Program Miner;
{.include SRL\SRL\Misc\Smart.scar}
{.include SRL\SRL.scar}
{.include SRL\SRL\Skill\Mining.scar}
var
Loads, FailAtt, HaltNo, PreExp, PostExp, i, j, k, x, y: integer;
Gem, CurrentGems, Gases: integer;
WalkDTM, VRC: Integer;
PickPresents: Boolean;
WhichPick: String;
////////////////////////////Setup///////////////////////////////////
const
CFailAtt = 10; //Fail Attempt Before Switching Characters
WaitTime = 15; //WaitTime * 0.1 seconds waiting before mining another ore, depends on your mining level.
PreferredWorld = 73; //The server you want to access.
MemberServer = False; //Member Server?
RunBool = true; //Run or Walk ?
Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active := true;
Players[0].Strings[0] := 'Iron'; //'Copper', 'Tin' or 'Iron'.
Players[0].Strings[1] := 'true'; //Pickaxe Equipped?
Players[0].Strings[2] := 'Bank'; //'Bank', 'Drop' or bank 'Gems' only.
Players[0].Loc := 'Bank'; //Location. 'Bank' or 'Mine'.
Players[0].Integers[0] := 50; //Loads to do
end;
/////////////////Script Underneath, Don't Modify////////////////////
Procedure RandomCompass;
begin
case Random(4) of
0:MakeCompass('N');
1:MakeCompass('E');
2:MakeCompass('W');
3:MakeCompass('S');
end;
end;
Procedure AntiBan(RanNum : integer);
begin
case RanNum of
0: GameTab(Random(7) + 1);
1: PostExp := GetXP('mining');
2: PickUpMouse;
3: MMouse(Random(MSX2), Random(MSY2), 2, 2);
4: BoredHuman;
5: RandomCompass;
end;
end;
function LoadAllDTMWalks(Node : Integer): Integer;
var
dtmMainPoint: TDTMPointDef;
dtmSubPoints: Array [0..3] of TDTMPointDef;
TempTDTM: TDTM;
begin
case Node of
1: begin
dtmMainPoint.x := 677;
dtmMainPoint.y := 109;
dtmMainPoint.AreaSize := 0;
dtmMainPoint.AreaShape := 0;
dtmMainPoint.Color := VRC;
dtmMainPoint.Tolerance := 0;
dtmSubPoints[0].x := 677;
dtmSubPoints[0].y := 109;
dtmSubPoints[0].AreaSize := 0;
dtmSubPoints[0].AreaShape := 0;
dtmSubPoints[0].Color := VRC;
dtmSubPoints[0].Tolerance := 0;
dtmSubPoints[1].x := 680;
dtmSubPoints[1].y := 62;
dtmSubPoints[1].AreaSize := 0;
dtmSubPoints[1].AreaShape := 0;
dtmSubPoints[1].Color := VRC;
dtmSubPoints[1].Tolerance := 0;
dtmSubPoints[2].x := 700;
dtmSubPoints[2].y := 72;
dtmSubPoints[2].AreaSize := 0;
dtmSubPoints[2].AreaShape := 0;
dtmSubPoints[2].Color := VRC;
dtmSubPoints[2].Tolerance := 0;
dtmSubPoints[3].x := 685;
dtmSubPoints[3].y := 136;
dtmSubPoints[3].AreaSize := 0;
dtmSubPoints[3].AreaShape := 0;
dtmSubPoints[3].Color := VRC;
dtmSubPoints[3].Tolerance := 0;
end;
2: begin
dtmMainPoint.x := 638;
dtmMainPoint.y := 71;
dtmMainPoint.AreaSize := 0;
dtmMainPoint.AreaShape := 0;
dtmMainPoint.Color := VRC;
dtmMainPoint.Tolerance := 0;
dtmSubPoints[0].x := 638;
dtmSubPoints[0].y := 71;
dtmSubPoints[0].AreaSize := 0;
dtmSubPoints[0].AreaShape := 0;
dtmSubPoints[0].Color := VRC;
dtmSubPoints[0].Tolerance := 0;
dtmSubPoints[1].x := 629;
dtmSubPoints[1].y := 45;
dtmSubPoints[1].AreaSize := 0;
dtmSubPoints[1].AreaShape := 0;
dtmSubPoints[1].Color := VRC;
dtmSubPoints[1].Tolerance := 0;
dtmSubPoints[2].x := 655;
dtmSubPoints[2].y := 77;
dtmSubPoints[2].AreaSize := 0;
dtmSubPoints[2].AreaShape := 0;
dtmSubPoints[2].Color := VRC;
dtmSubPoints[2].Tolerance := 0;
dtmSubPoints[3].x := 661;
dtmSubPoints[3].y := 103;
dtmSubPoints[3].AreaSize := 0;
dtmSubPoints[3].AreaShape := 0;
dtmSubPoints[3].Color := VRC;
dtmSubPoints[3].Tolerance := 0;
end;
3: begin
dtmMainPoint.x := 627;
dtmMainPoint.y := 72;
dtmMainPoint.AreaSize := 0;
dtmMainPoint.AreaShape := 0;
dtmMainPoint.Color := VRC;
dtmMainPoint.Tolerance := 0;
dtmSubPoints[0].x := 627;
dtmSubPoints[0].y := 72;
dtmSubPoints[0].AreaSize := 0;
dtmSubPoints[0].AreaShape := 0;
dtmSubPoints[0].Color := VRC;
dtmSubPoints[0].Tolerance := 0;
dtmSubPoints[1].x := 640;
dtmSubPoints[1].y := 48;
dtmSubPoints[1].AreaSize := 0;
dtmSubPoints[1].AreaShape := 0;
dtmSubPoints[1].Color := VRC;
dtmSubPoints[1].Tolerance := 0;
dtmSubPoints[2].x := 605;
dtmSubPoints[2].y := 73;
dtmSubPoints[2].AreaSize := 0;
dtmSubPoints[2].AreaShape := 0;
dtmSubPoints[2].Color := VRC;
dtmSubPoints[2].Tolerance := 0;
dtmSubPoints[3].x := 642;
dtmSubPoints[3].y := 102;
dtmSubPoints[3].AreaSize := 0;
dtmSubPoints[3].AreaShape := 0;
dtmSubPoints[3].Color := VRC;
dtmSubPoints[3].Tolerance := 0;
end;
end;
TempTDTM.MainPoint := dtmMainPoint;
TempTDTM.SubPoints := dtmSubPoints;
Result := AddDTM(TempTDTM);
end;
Procedure CheckPick;
var
PC : TPoint;
PickSlot : integer;
begin
PickPresents := false;
srl_LoadBitmaps([61, 62, 63, 64, 65, 66]);
case LowerCase(Players[CurrentPlayer].Strings[1]) of
'false':
begin
GameTab(4);
for i := 0 to 5 do
begin
if(FindBitmapToleranceIn(srl_GetBitmap(61 + i), PC.x, PC.y, MIX1, MIY1, MIX2, MIY2, 10)) then
begin
PickSlot := CoordsToItem(PC.x, PC.y);
if (PickSlot = 1) then Break;
DragItem(PickSlot, 1);
PickPresents := true;
Break;
end;
end;
end;
'true':
begin
GameTab(5);
for i := 0 to 5 do
begin
if(FindBitmapToleranceIn(srl_GetBitmap(61 + i), PC.x, PC.y, 569, 287, 604, 322, 10)) then
begin
PickPresents := true;
Exit;
end;
end;
if (PickPresents = false) then
begin
WriteLn('Pick Not Found..Change Player.');
HaltNo := 2;
end;
end;
end;
case i of
0: WhichPick := 'Bronze ';
1: WhichPick := 'Iron ';
2: WhichPick := 'Steel ';
3: WhichPick := 'Mithril ';
4: WhichPick := 'Adamant ';
5: WhichPick := 'Rune ';
end;
end;
Procedure CheckGems; //That's just an anti-ban or something(Makes the Inv pretty :P)
var
GCArr : TPointArray;
GemSlot : TIntegerArray;
begin
srl_LoadBitmaps([100, 101, 102, 103]);
GameTab(4);
for i := 0 to 3 do
begin
if(FindBitmapsTolerance(srl_GetBitmap(100 + i), GCArr, MIX1, MIY1, MIX2, MIY2, 10)) then
begin
if(Length(GCArr) = 1) then
begin
SetLength(GemSlot, 1);
CurrentGems := CurrentGems + Length(GCArr);
Gem := Gem + Length(GCArr);
GemSlot[0] := CoordsToItem(GCArr[0].x, GCArr[0].y);
end else
begin
SetLength(GemSlot, Length(GCArr));
CurrentGems := CurrentGems + Length(GCArr);
Gem := Gem + Length(GCArr);
for j := 0 to Length(GCArr) do
GemSlot[j] := CoordsToItem(GCArr[j].x, GCArr[j].y);
end;
if(LowerCase(Players[CurrentPlayer].Strings[1]) = 'true') then
begin
for k := 0 to High(GemSlot) do
DragItem(GemSlot[k], k + 1);
end;
if(LowerCase(Players[CurrentPlayer].Strings[1]) = 'false') then
begin
for k := 0 to High(GemSlot) do
DragItem(GemSlot[k], k + 2);
end;
end;
end;
end;
Procedure CWait(Times : integer);
begin
wait(Times * (100 + Random(50)));
end;
Procedure ProgressReport;
var
HaltState : String;
begin
case HaltNo of
0:HaltState := 'Done all loads successfully.';
1:HaltState := 'Lost / Ore Not Found.';
2:HaltState := 'Pickaxe Not Found';
end;
WriteLn('...........Progress Report...........');
WriteLn('-------------------------------------');
WriteLn('Player : ' + Players[CurrentPlayer].Nick);
WriteLn('Location : ' + Players[CurrentPlayer].Loc);
WriteLn('Using Pick : ' + WhichPick + 'Pickaxe');
WriteLn('Loads done : ' + IntToStr(Loads));
WriteLn('Experience Gained : ' + IntToStr(PostExp - PreExp));
WriteLn('Gems Found : ' + IntToStr(Gem));
WriteLn('Gas Avoided : ' + IntToStr(Gases));
WriteLn('State : ' + HaltState);
WriteLn('Time Elapsed : ' + TimeRunning);
WriteLn('-------------------------------------');
end;
Procedure ToBank;
begin
MakeCompass('N');
SetAngle(true);
SetRun(RunBool);
WalkDTM := LoadAllDTMWalks(1);
if(DTMRotated(WalkDTM, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
Mouse(x, y, 2, 2, true);
FFlag(15);
WalkDTM := LoadAllDTMWalks(2);
if (DTMRotated(WalkDTM, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
Mouse(x, y, 2, 2, true);
FFlag(10);
for i := 0 to 3 do
if(not RadialWalk(VRC, 450, 270, 65, -1, 1)) then VRC := FindVarrockRoadColor;
WalkDTM := LoadAllDTMWalks(3);
while (not DTMRotated(WalkDTM, x, y, MMX1, MMY1, MMX2, MMY2)) do
begin
if(not RadialWalk(VRC, 450, 270, 65, -1, 1)) then VRC := FindVarrockRoadColor;
if(DTMRotated(WalkDTM, x, y, MMX1, MMY1, MMX2, MMY2)) then
Mouse(x, y, 2, 2, true);
for i:= 0 to 1 do
if(not RadialWalk(VRC, 225, 315, 50, -1, 1)) then VRC := FindVarrockRoadColor;
while (not FindBank('veb')) do
begin
RadialWalk(VRC, 225, 315, 50, -1, 1);
if(BankScreen) then
begin
DepositAll;
CloseBank;
Players[CurrentPlayer].Loc := 'bank';
Exit;
end;
end;
end;
end;
end;
end;
procedure ToMine;
begin
for i := 0 to 2 do
begin
if(not RadialWalk(VRC, 135, 45, 70, -1, 1)) then VRC := FindVarrockRoadColor;
WalkDTM := LoadAllDTMWalks(3);
while(not DTMRotated(WalkDTM, x, y, MMX1, MMY1, MMX2, MMY2)) do
begin
if(not RadialWalk(VRC, 135, 45, 70, -1, 1)) then VRC := FindVarrockRoadColor;
if(DTMRotated(WalkDTM, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
Mouse(x, y, 2, 2, true);
for i:= 0 to 2 do
if(not RadialWalk(VRC, 90, 270, 70, -1, 1)) then VRC:= FindVarrockRoadColor;
WalkDTM := LoadAllDTMWalks(2);
while(not DTMRotated(WalkDTM, x, y, MMX1, MMY1, MMX2, MMY2)) do
begin
if(not RadialWalk(VRC, 135, 45, 70, -1, 1)) then VRC := FindVarrockRoadColor;
if(DTMRotated(WalkDTM, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
Mouse(x, y, 2, 2, true);
WalkDTM := LoadAllDTMWalks(1);
while(not FindSymbol(x, y, 'mining site')) do
begin
if(not RadialWalk(VRC, 135, 45, 70, -1, 1)) then VRC := FindVarrockRoadColor;
if(FindSymbol(x, y, 'mining site')) then
begin
Mouse(x, y, 2, 2, true);
Players[CurrentPlayer].Loc := 'mine';
Exit;
end;
end;
end;
end;
end;
end;
end;
end;
Procedure FullLoadProcess;
begin
case LowerCase(Players[CurrentPlayer].Strings[2]) of
'bank':
begin
ToBank;
CWait(50);
ToMine;
end;
'drop':
begin
if (LowerCase(Players[CurrentPlayer].Strings[1]) = 'true') then DropAll;
if (LowerCase(Players[CurrentPlayer].Strings[1]) = 'false') then
for i := 2 to 28 do
DropItem(i);
end;
'gems':
begin
CheckGems;
if (CurrentGems = 0) then DropAll; Exit;
if (LowerCase(Players[CurrentPlayer].Strings[1]) = 'true') then
for i := (CurrentGems + 1) to 28 do
Dropitem(i);
if (LowerCase(Players[CurrentPlayer].Strings[1]) = 'false') then
for i := (CurrentGems + 2) to 28 do
Dropitem(i);
CurrentGems := 0;
ToBank;
CWait(50);
ToMine;
end;
end;
end;
Procedure MineOre;
var
OreColor : TIntegerArray;
x, y: integer;
begin
case LowerCase(Players[CurrentPlayer].Strings[0]) of
'copper': OreColor := [4945047, 5011107];
'tin': OreColor := [7566204, 6908273];
'iron': OreColor := [2569042, 1976386];
end;
repeat
if (InvFull) then
begin
CWait(50);
FullLoadProcess;
Loads := Loads + 1;
end;
if (FindObjTPA(x, y, OreColor[0], 15, 2, 15, 25, 10, ['Roc', 'ock', 'cks'])) then
begin
if (FindObjTPA(x, y, OreColor[1], 15, 2, 15, 25, 10, ['Roc', 'ock', 'cks'])) then
begin
if (not FindGas(x, y)) then
begin
Mouse(x, y, 2, 2, false);
ChooseOption('Mine');
FailAtt := 0;
CWait(WaitTime);
AntiBan(Random(6));
FindNormalRandoms;
end else Inc(Gases);
end;
end else
begin
FailAtt := FailAtt + 1;
if (FailAtt >= 5) then WriteLn('Ore Not Found, tried ' + IntToStr(FailAtt) + ' Times..'); //Don't let this msg spam the Debug.
CWait(50);
RandomCompass;
SetAngle(True);
end;
until (FailAtt = CFailAtt);
WriteLn('Ore Not Found, Probably Got Lost.');
HaltNo := 1;
end;
Procedure Init;
begin
Loads := 0;
LampSkill := 'mining';
SymbolAccuracy := 0.5;
ClearDebug;
ClearReport;
SmartSetupEx(PreferredWorld, MemberServer, True, False);
SetTargetDC(SmartGetDC);
SetupSRL;
DeclarePlayers;
SetAudioOff;
LoginPlayer;
end;
Procedure MainLoop;
begin
repeat
PreExp := GetXP('mining');
VRC := FindVarrockRoadColor;
Gases := 0;
repeat
if (not loggedIn) then Exit;
CheckPick;
if (PickPresents = false) then Break;
ChatsOff;
SetAngle(True);
SetRun(RunBool);
case (LowerCase(Players[CurrentPlayer].Loc)) of
'bank': begin
ToMine;
MineOre;
end;
'mine': begin
MineOre;
end;
end;
until ((Loads = Players[CurrentPlayer].Integers[0]) or (FailAtt = CFailAtt));
ProgressReport;
Logout;
Cwait(5);
Players[CurrentPlayer].Active := false;
repeat
if(CurrentPlayer = HowManyPlayers - 1) then exit;
Inc(CurrentPlayer);
until(Players[CurrentPlayer].Active = true);
NextPlayer(Players[CurrentPlayer].Active);
Loads := 0;
until(AllPlayersInactive);
srl_FreeBitmaps;
FreeDTM(WalkDTM);
SRLRandomsReport;
writeLn('All Players Finished.');
end;
begin
Init;
MainLoop;
end.