SRL Archive - First Scripts

[First Script] Iron Power Miner


Battousai

2015-02-12 16:05:16


Credits:
The Mayor - Looked at his script for his detection method


Program Iron_Power_Miner;
{$Define SMART}
{$I SRL-6/SRL.Simba}
const
MIN_PIXEL_SHIFT = 100;// Minimum player pixel shift while mining (only adjust if necessary)
MINE_TIMER = 5000; // Max time to wait for rocks (only adjust if necessary)
var
oreDTM := DTMFromString('mlwAAAHicY2dgYOhhYmCoAeIOIJ4CxDOBuB+I24A4n5GBoQCI64C4AojzgDgZiFOB2FhODKibCSvmYsANGPFgKAAAg/AHfg==');

Procedure declarePlayers();
Begin
setLength(players, 1);
With players[0] Do
Begin
loginName := ''; //UserName
password := ''; //Password
isActive := True; //Leave true
isMember := False; //Is user a Member?
End;
currentPlayer := 0;
End;

Function isPlayerMining(minimumShift: Integer): Boolean;
var
playerShift: Integer;
Begin
playerShift := getPixelShiftAverage(mainscreen.playerBox, 150, 700);
result := playerShift > minimumShift;
ClearDebug;
writeLn('Status: Mining Iron');
End;

Function waitWhileMining(minimumShift, maximumTime: Integer): Boolean;
var
invCount: Integer;
oreTimer: TTimeMarker;
Begin
invCount := tabBackpack.count();
oreTimer.start();
wait(randomRange(500, 1500));
mouseOffClient(OFF_CLIENT_RANDOM);

Repeat
If tabBackpack.count() <> invCount Then
Begin
exit(true);
End;
Until (Not isPlayerMining(minimumShift)) Or (oreTimer.getTime() > maximumTime);
End;

Procedure mineRock();
var
X, Y: Integer;
Begin
If mainScreen.findObject(X, Y, 2242428, 13, ['ron ore rocks']) Then
Begin
ClearDebug;
writeLn('Status: Clicking Iron');
if waitWhileMining(MIN_PIXEL_SHIFT, MINE_TIMER + random(1000)) then
Begin

End;
End;
End;

Procedure dropOre();
var
x, y, i, dtmCount: Integer;
Begin
If findDTM(oreDTM, x, y, tabBackPack.getBounds()) Then
Begin
ClearDebug;
dtmCount := tabBackpack.countDTM(oreDTM);
writeLn('Status: Dropping ' + toStr(dtmCount));
For i := 1 To dtmCount Do
Repeat
sendKeys('1', randomRange(60, 120), randomRange(60, 120));
wait(randomRange(100, 200));
Until (tabBackPack.countDTM(oreDTM) = 0); // Spam 1 until there is no more ore?
End;
End;

Procedure setupPlayer();
Begin
exitTreasure();
mainScreen.setAngle(MS_ANGLE_HIGH);
minimap.setAngle(MM_DIRECTION_NORTH);
dropOre();
End;

Begin
disableSRLDebug := True;
setupSRL();
declarePlayers();
Repeat
If Not isLoggedIn() Then
Begin
players[currentPlayer].login();
setupPlayer();
End;
setupPlayer();
Repeat
mineRock();
Until(tabBackPack.isfull);
dropOre();
Until(false);
FreeDTM(oreDTM);
End.

Upcoming Plans:
More advanced antiban

Solar

2015-02-12 16:38:55

PM'ed you.

Myke

2015-02-12 16:53:25

you have some sensitive information in your script edit it


edit1: make sure to free DTM at end of script



it's clear by the includes this is for RS3 but some might not recognize so you should specify that


You may add the script as an attachment in advanced posting as well

Floor66

2015-02-12 17:01:48

Quick tip: in loops such as

For i := 1 To (tabBackpack.countDTM(oreDTM)) Do

You're better off doing this:

h := tabBackpack.countDTM(oreDTM); //declare this variable of course
For i := 1 To h do

Else, every iteration, that countDTM function is called, which is quite ineffecient. Same goes for that Repeat…Until
Otherwise, Antiban is indeed a great idea! :) Keep at it, try and build in failsafes so you don't get stuck in any part of your code which might get you caught.

Battousai

2015-02-12 17:18:44

From: Solar
PM'ed you.


From: Myke
you have some sensitive information in your script edit it
edit1: make sure to free DTM at end of script
it's clear by the includes this is for RS3 but some might not recognize so you should specify that
You may add the script as an attachment in advanced posting as well


Yeah i failed hard by leaving that in there, Went back to test some other stuff and completely forgot to remove it this time :P But its corrected now.