SRL Archive - First Scripts

[First two scripts] [finished] Clay miner + Clay softer


sipfer3

2014-08-30 16:32:25

Hello guys,
i recently came back to simba since i started to play RS again.

I made this script with the help of TheMayor's tutorials (https://villavu.com/forum/showthread.php?t=107757 + https://villavu.com/forum/showthread.php?t=109161).
It runs rellay smooth ( get to the 6 hour mark when game session ends).
If u guys want to use it, go on. It gives a solid 200-250k/h which is good for f2p i gues.


program clayMining;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}
{$I SPS/lib/SPS-RS3.Simba}

const
loops = 2;
loop = 1;
clayPrice = 406; // put the actual clay price here

var
mineTimer: TTimeMarker;
failedToMine, failSafeCounter, fails, LoadsDone: integer;

procedure declarePlayers();
begin
setLength(players, 1);
with players[currentPlayer] do
begin
loginName := 'ID';
password := 'PW';
isActive := true;
isMember := false;
end
currentPlayer := 0;
end;

procedure afterLogin();
begin
minimap.setAngle(MM_DIRECTION_NORTH);
mainScreen.setAngle(MS_ANGLE_HIGH);
end;

procedure failSafe();
var
pathForFailSafe: TPointArray;
begin
writeln('Failsafe startet!');
failSafeCounter = +1;
if not isLoggedIn then
players[currentPlayer].login;
begin
if (players.getActive > 0) then
begin
afterLogin();
end;
begin
Inc(fails);
lodestoneScreen.teleportTo(LOCATION_PORT_SARIM);
WriteLn('found lodestone');
writeLn('waiting for teleporting...');
wait(randomRange(17000,23000));
writeLN('...waited long enough.. now RUN!');
begin
pathForFailSafe := [Point(495, 303), Point(508, 300), Point(521, 301), Point(535, 300), Point(549, 298), Point(559, 297), Point(559, 284), Point(563, 266), Point(561, 254), Point(559, 240), Point(561, 230), Point(564, 229), Point(574, 229), Point(586, 228), Point(602, 228), Point(621, 229), Point(629, 228)];
if SPS.walkPath(pathForFailSafe) Then
begin
minimap.waitPlayerMoving();
writeLN('fail safe was succesfull');
exit;
end else
writeLn('FailSafe failed!');
failSafe;
end;
end;
end;
end;

procedure toMine();
var
pathToBank: TPointArray;
begin
if not isLoggedIn then
players[currentPlayer].login;
begin
afterLogin();
end;
if (players.getActive > 0) then
begin
pathToBank := [Point(634, 227), Point(619, 227), Point(600, 228), Point(581, 228), Point(563, 229), Point(562, 219), Point(561, 205), Point(545, 206), Point(530, 205), Point(506, 206), Point(488, 205), Point(469, 201), Point(435, 200), Point(411, 201), Point(379, 197), Point(370, 197), Point(368, 217)];
if SPS.walkPath(pathToBank) Then
begin
minimap.waitPlayerMoving();
writeln('walked to mine!');
mineTimer.reset();
exit;
end else
writeLn('failed to walk to mine, activating fail safe!');
mineTimer.reset();
failsafe;
exit;
end;
end;

procedure toBank();
var
pathToBank: TPointArray;
begin
if not isLoggedIn then
players[currentPlayer].login;
begin
afterLogin();
end;
if (players.getActive > 0) then
begin
pathToBank := [Point(368, 217), Point(370, 197), Point(379, 197), Point(411, 201), Point(435, 200), Point(469, 201), Point(488, 205), Point(506, 206), Point(530, 205), Point(545, 206), Point(561, 205), Point(562, 219), Point(563, 229), Point(581, 228), Point(600, 228), Point(619, 227), Point(634, 227)];
if SPS.walkPath(pathToBank) Then
begin
minimap.waitPlayerMoving();
writeLn('walked to bank!');
wait(randomRange(700,1700));
exit;
end else
writeLn('failed to walk to bank, activating fail safe!');
failsafe;
exit;
end;
end;

procedure findBankz();
var
slot1Box: TBox;
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;

begin
if not isLoggedIn then
players[currentPlayer].login;
begin
if (players.getActive > 0) then
begin
afterLogin();
end;
findColorsSpiralTolerance(x, y, TPA, 4413545, mainScreen.getBounds(), 10, colorSetting(2, 0.05, 0.09));
if (Length(TPA) < 1) then
exit;

ATPA := TPA.toATPA(30, 30);
ATPA.filterBetween(0, 60);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);

for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['ank'], 500) then
begin
fastClick(MOUSE_LEFT);
break;
end;
end;
end;
end;

Function antiBan: Boolean;
var
I: integer;
begin
I:= random(500);
Case I of
1..10:
begin
wait(100 + random(500));
end;
20..60:
begin
pickUpMouse;
end;
80..100:
begin
wait(2000+random(1500));
end;
130..150:
begin
mouseMovingObject();
end;
end;
end;

procedure progressReport();
var
clayMined, profit, profitPerHour, clayPerHour: integer;
begin
clayMined := (LoadsDone * 28);
clayPerHour := round((clayMined * 60) / (getTimeRunning() /60000));
profit := (clayMined * clayPrice);
profitPerHour := round((profit * 60) / (getTimeRunning() /60000));

writeLn('Time Running: ' + timeRunning);
writeLn('Clay mined: ' + intToStr(clayMined));
writeLn('Clay/h: ' + intToStr(clayPerHour));
writeLn('Profit made: ' + intToStr(profit));
writeLn('Profit/h: ' + intToStr(profitPerHour));
writeLn('Times failed: ' + intToStr(fails));
end;

procedure findOrez();
var
slot1Box: TBox;
x, y, i, invCount, count: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
failCounter: TTimeMarker;

begin
if not isLoggedIn then
players[currentPlayer].login;
begin
if (players.getActive > 0) then
begin
afterLogin();
end;
count := tabBackPack.count();
if not isLoggedIn() then
exit;
if (tabBackPack.count() = 28) then
exit;
invCount = tabBackPack.count();
count := 0;
repeat
if (count = 5) then
exit;
findColorsSpiralTolerance(x, y, TPA, 9420488, mainScreen.getBounds(), 9, colorSetting(2, 0.39, 1.07))
if (Length(TPA) < 1) then
exit;

ATPA := TPA.toATPA(20, 20);
ATPA.filterBetween(0, 10);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);

for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['ine'], 500) then
begin
fastClick(MOUSE_LEFT);
tabBackPack.waitForShift(5000);
break;
end;
end else
begin
failSafe();
findBankz();
bank();
toMine();
exit;
end;
until(tabBackPack.count() = 28) or (not isLoggedIn());
if (count = 5) then
failSafe();
end;
end;

begin
clearDebug();
disableSRLDebug := true;
smartEnableDrawing := true;
setupSRL;
writeLN('SRL setup!');
declarePlayers();
writeLn('Player loaded!');
failSafeCounter := 0;
writeLn('set fail counter to 0');

SPS.setup('clayPorttest', RUNESCAPE_OTHER);
if not isLoggedIn() then
begin
players[currentPlayer].login();
exitSquealOfFortune();
minimap.setAngle(MM_DIRECTION_NORTH);
mainScreen.setAngle(MS_ANGLE_HIGH);
end;
mainScreen.setAngle(MS_ANGLE_HIGH);
writeLn('Starting the script. Have fun');
wait(randomRange(500,1500));
repeat
repeat
findOrez();
until (tabBackPack.isFull()) or (failSafeCounter = 5);
writeln('Inventory is full!');
mineTimer.reset();
toBank();
begin
repeat
wait(randomRange(1000,1500));
findBankz();
until depositBox.isOpen();
Bank();
clearDebug();
progressReport();
toMine();
end;
Antiban();
toMine();
until(loop >= loops);
end.

And here is my 2nd script. it soften clay in falador left bank :)
also this one runs solid 6 hours and is open for use.

program scriptTemplate;

{$DEFINE SMART}
{$I SRL-6/SRL.simba}
{$I SPS/lib/SPS-RS3.Simba}

const
clayPrice = 408;
softClayPrice = 505;

var
LoadsDone, clayLeft: integer;


procedure declarePlayers();
begin
setLength(players, 1);
with players[0] do
begin
loginName := 'IS';
password := 'PW';
isActive := true;
isMember := false;
end
currentPlayer := 0;
end;

procedure findColorz();
var
slot1Box: TBox;
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;

begin
if not isLoggedIn() then
exit;
if (tabbackPack.isOpen()) then
begin
slot1Box := tabBackPack.getSlotBox(28);
mouseBox(slot1Box, MOUSE_LEFT);
end else
tabbackPack.open();

findColorsSpiralTolerance(x, y, TPA, 9022644, mainScreen.getBounds(), 7, colorSetting(2, 0.07, 0.77));

if (Length(TPA) < 1) then
exit;

ATPA := TPA.toATPA(30, 30);
ATPA.filterBetween(0, 60);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);

for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['aterpump'], 500) then
begin
fastClick(MOUSE_LEFT);
break;
end;
end;

end;

procedure toWell();
var
pathToWell: TPointArray;
begin
if not isLoggedIn() Then
exit;

pathToWell := [Point(122, 172), Point(123, 159), Point(124, 146), Point(135, 137), Point(139, 125), Point(130, 114)];

if SPS.walkPath(pathToWell) Then
minimap.waitPlayerMoving()
else
writeLn('Filaed warking');
end;

procedure toBank();
var
pathToBank: TPointArray;
begin
if not isLoggedIn() Then
exit;
pathToBank := [Point(137, 113), Point(139, 125), Point(135, 137), Point(124, 146), Point(123, 159), Point(122, 172)];
if SPS.walkPath(pathToBank) Then
begin
minimap.waitPlayerMoving();
writeln('walked to well!');
exit;
end;
end;

procedure findBank();
var
x, y: integer;
begin
if not isLoggedIn then
players[0].login;
begin
if (players.getActive > 0) then
begin
if (mainscreen.findObject(x, y, 2315624 , 9, colorSetting(2, 0.06, 2.04), mainscreen.getCenterPoint(), 20, 20, 5, ['Bank'])) then
wait(randomRange(500,1500));
writeln('Bank found!');
end;
end;
end;

procedure bank();
var
depositBox, withdrawBox: TBox;
done: integer;
begin

if (bankScreen.isOpen(5000)) then
begin

writeLn('Bank screen found!');
bankscreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
wait(randomRange(1000,2000));
bankscreen.withdraw(1, WITHDRAW_AMOUNT_ALL, ['Clay','Withdra']);
clayleft := bankscreen.getPackCount();
wait(randomRange(1000,2000));
bankscreen.close();
end;

end;

procedure atWell();
var
x,x1,y,y1, softedCount: integer;
softenBox: TBox;
begin
// repeat
wait(randomRange(2500,3000));
softenBox := intToBox(289, 328, 509, 350);
mouseBox(softenBox, MOUSE_LEFT);
wait(randomRange(33000, 35000));
end;

procedure progressReport();
var
claySofted, profit, profitPerHour, clayPerHour: integer;
begin
Inc(LoadsDone);
claySofted := (LoadsDone * 28);
clayPerHour := round((claySofted * 60) / (getTimeRunning() / 60000));
profit := (claySofted * (softClayPrice - ClayPrice));
profitPerHour := round((profit * 60) / (getTimeRunning() / 60000));


writeLn('Time Running: ' + timeRunning);
writeLn('Clay softed: ' + intToStr(claySofted));
writeLn('Clay left: ' + intToStr(clayLeft));
writeLn('Clay/h: ' + intToStr(clayPerHour));
writeLn('Profit made: ' + intToStr(profit));
writeLn('Profit/h: ' + intToStr(profitPerHour));
end;

begin
clearDebug();
disableSRLDebug := true;
smartEnableDrawing := true;
setupSRL();
declarePlayers();

SPS.setup('wellFala', RUNESCAPE_OTHER);

if not isLoggedIn() then
begin
players[currentPlayer].login();
exitSquealOfFortune();
mainScreen.setAngle(MS_ANGLE_HIGH);
minimap.setAngle(MM_DIRECTION_NORTH);
end;
LoadsDone = 0;
repeat
findBank();
bank();
toWell();
findColorz();
atWell();
clearDebug();
progressReport();
toBank();
until(false);
end.
I hope some of u guys can give me feedback and tell me what to do bether.
I just started a fighter today, but struggling with the test if the enemy is dead.
I tried to use the player healthbar on the main screen and the little box with the monster info,
but i cant get a good procedure. When i get it to run ill post it here for u guys to suggest some
changes if u want :) have a nice evening

sipfer

The Mayor

2014-08-30 17:43:42

Nicely done :) There has been a few clay scripts coming out as of late :p Next step: join them together!

sipfer3

2014-08-30 18:22:21

yea, teh script was not really for using ( i mean iam using it, becouse its a cool feeling xD ) but for learning the first steps :)
i am thinking of change the spot to edville, since there is a water source pretty close, so i wont need 2 bots.
And i gave up my fighter for now. seems to be too difficult for beginnin, maybe in a few days :)

Spaceblow

2014-08-30 19:37:08

I recommend you to put the script between
 tags so it would be easier to read. This looks really good, this forum needs guys like you, definitely keep up the good work! :)

Lipcot

2014-08-31 01:03:22

From: sipfer3
yea, teh script was not really for using ( i mean iam using it, becouse its a cool feeling xD ) but for learning the first steps :)
i am thinking of change the spot to edville, since there is a water source pretty close, so i wont need 2 bots.
And i gave up my fighter for now. seems to be too difficult for beginnin, maybe in a few days :)


Are you the guy mining at the north draynor clay spot????? i mean, i used to be alone mining there but now its full of other ppl hehe, i think you made the same script i did :bart:

sipfer3

2014-08-31 07:32:23

@spaceblow i think i did put it in breaks? at least it looks like i did for me :P

@undorak7 i am using several spots to avoid getting all chars banned at the same time :D

The Mayor

2014-08-31 08:21:13

From: undorak7
Are you the guy mining at the north draynor clay spot????? i mean, i used to be alone mining there but now its full of other ppl hehe, i think you made the same script i did :bart:


Oh is it you that is ruining my profits :p


Spaceblow

2014-08-31 08:32:34

From: sipfer3
@spaceblow i think i did put it in breaks? at least it looks like i did for me :P
I meant between
 tags, I was probably a bit distracted when I wrote my previous reply. :p

sipfer3

2014-08-31 09:08:58

oh hehe, didnt know there was something like that :P
i changed it, thank you :)

Lipcot

2014-08-31 14:38:06

From: The Mayor
Oh is it you that is ruining my profits :p



hehehehh yeaaah, its me :redface:

Hayhurst

2014-09-01 00:09:30

Congrats bro, they are looking good.

sipfer3

2014-09-01 18:19:19

@Hayhurst thanks :)

yourule97

2014-09-11 16:42:53

I'm trying to read these scripts in order to learn the language, so please correct me if I am wrong, but are you missing a bank procedure in the clay mining script?

sipfer3

2014-09-11 18:38:12

@yourule97 yup you are right.

here it is:


procedure Bank();
var
bankTimer: TTimeMarker;
begin
if not isLoggedIn then
players[currentPlayer].login;
begin
if (players.getActive > 0) then
begin
afterLogin();
end;
if depositBox.isOpen(5000)then
begin
bankTimer.start();
repeat
if (depositBox.count > 0) then
begin
depositBox.quickDeposit(QUICK_DEPOSITBOX_INVENTORY);
wait(gaussRangeInt(500, 750));
end;
until(depositBox.isEmpty()) or (not isLoggedIn()) or (bankTimer.getTime() > 10000);
Inc(LoadsDone);
end;
depositBox.close();
WriteLn('Finished banking!');
end;
end;