SRL Archive - General Botting Help

Is there a way to script log out breaks then logging back in to continue botting?


Synikk

2015-03-14 21:30:08

Hey guys,

first post in a while. If the title wasn't clear, i'm asking if there is a way where you can code a bot to stop after around 3-4 hours, log out between 1-3 hours, and then log back in and resume the (e.g.) combat section of the script.

Also are there any scripts that i can read that currently have this implemented?

Asking because i'm going away for the week and want to edit a script to run for the whole week haha :D

Thanks!

Lipcot

2015-03-14 21:52:25

This is kind of a template i had made long ago to help a few new people to start out and understand, why dont you give it a deep look? it has breaks, sleep breaks, antiban, long antiban and "custom" login.

program new;

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

var
{Break vars}
Sbreaks, Breaks, Sleeptime, TimeOnBreak, BreakTime: integer;
breakTimer, TimeOnBreakTimer, SleepTimer: TTimeMarker;
{Proggy vars}
ItemAcquired, Profit, ProfitPerHour, LoadsDone, PriceInteger: Integer;
ItemPrice, CurrentStatus: string;

const
Debug = true;
DrawOnSmart = false;

procedure declarePlayers();
begin
setLength(players, 1);
with players[0] do
begin
loginName := 'Acc username goes here';
password := 'Acc password goes here';
isActive := true;
isMember := true;
World := 6;
end;
currentPlayer := 0;
end;
{------------------------------------------------------------------------------}
procedure progressReport();
begin
profit := (ItemAcquired * (PriceInteger));
profitPerHour := round((profit * 60) / (getTimeRunning() / 60000));
TimeOnBreak := round(TimeOnBreakTimer.getTime() / 60000);
if not debug then
clearDebug();
{This will appear on the Debug each time we call it}
{--------------Report----------------------------------------------------------}
writeLn('========================================================');
writeLn('Progress Report');
writeLn('Time Run: ' + timeRunning);
writeLn('Items Acquired: ' + intToStr(ItemAcquired) + ' Profit Made: ' + intToStr(profit));
writeLn('Money P/H: ' + intToStr(profitPerHour));
writeLn('Time on Break: ' + intToStr(TimeOnBreak) + ' minutes ');
writeLn('Normal Breaks Taken: ' + intToStr(breaks) + ' Long Breaks Taken:' + intToStr(sbreaks));
writeLn('========================================================');
{------------------------------------------------------------------------------}
end;
{------------------------------------------------------------------------------}
procedure paintOnSmart();
var
doingString, moneyphString, timeString, progressString: string;
begin

if not isLoggedIn() then
exit;
{These will be printed always we call this procedure. It will only change when the Var's change.}
TimeString:= ('Time Run: ' + timeRunning);
DoingString := 'Activity we are doing';
progressString:= ('Items Picked/Made/Acquired: ' + intToStr(ItemAcquired));
MoneyphString:= ('Gp Per Hour: ' + intToStr(profitPerHour));

smartImage.clear;
//smartImage.drawBitmap({BMP name goes here}, point(0, 327)); //if we loaded a ProggyBMP erase "//" at the beggining of line
smartImage.drawText(DoingString, point(2, 0), upChars, false, 16777215); //Top left corner, white letters
smartImage.drawText(TimeString, point(2, 13), upChars, false, 16777215);
smartImage.drawText(progressString, point(2, 26), upChars, false, 16777215);
smartImage.drawText(MoneyphString, point(2, 39), upChars, false, 16777215);
smartImage.drawText(CurrentStatus, point(2, 52), upChars, false, 16777215);
//'Current Status' is to be changed at each procedure so we know what we are doing
end;
{------------------------------------------------------------------------------}
// To be called as: antiban(400); that means 10% chance
procedure antiban(rand: integer);
begin
mousespeed := 20 + random(5);
case random(rand) of
0..12: smallRandomMouse(500 + random(150));
13..25: sleepAndMoveMouse(randomRange(600, 5500));
26..28: wait(randomRange(5000, 7000));
29..40: pickUpMouse();
end;
end;
{------------------------------------------------------------------------------}
// To be called as: longAntiban(1000); that means 10% chance.
procedure longAntiban(rand: integer);
begin
case random(rand) of
1..40: begin
writeLn('Simulating Checking Social Networks');
mouseOffClient(OFF_CLIENT_RANDOM);
wait(randomRange(30000, 40000));
pickUpMouse();
end;
41..61: begin
writeLn('Simulating Bored Human');
mouseOffClient(OFF_CLIENT_RANDOM);
wait(randomRange(6000, 8000));
pickUpMouse();
mousespeed:= 19 + random(3);
smallRandomMouse(1000 + random(500));
end;
62..100: begin
writeLn('Simulating Small afk');
sleepAndMoveMouse(750 + random(500));
wait(randomRange(5000, 8000));
pickUpMouse();
end;
end;
end;
{------------------------------------------------------------------------------}
procedure doBreak();
begin

TimeOnBreakTimer.start();

if not isLoggedIn() then
exit;

CurrentStatus := ('Status: Breaking'); //Draws on smart
progressreport;
paintonsmart;

case randomRange(1,50) of
1..50: begin
clearDebug();
writeLn('Taking 10-12 minutes break');
progressreport;
paintonsmart;
players[currentPlayer].exitToLobby();
mouseOffClient(OFF_CLIENT_RANDOM);
wait(randomRange(600000, 720000));
end;
51..100: begin
clearDebug();
writeLn('Taking (12-18 minutes break');
progressreport;
paintonsmart;
players[currentPlayer].exitToLobby();
mouseOffClient(OFF_CLIENT_RANDOM);
wait(randomRange(480000, 1080000));
end;
end;

inc(breaks);
TimeOnBreakTimer.pause();
end;
{------------------------------------------------------------------------------}
procedure SleepBreak();
begin
CurrentStatus := ('Status: Sleeping Break');
progressreport;
paintonsmart;
TimeOnBreakTimer.start();
writeLn('Taking 7-8 hours "sleep" break');
players[currentPlayer].logout;
wait(randomRange(25200000, 28800000)); //7-8 hours
inc(Sbreaks);
TimeOnBreakTimer.pause();
end;
{------------------------------------------------------------------------------}
procedure GetPrice();
var
p : string;
begin
writeln('Recieving GE Prices');
p := getPage('Web Page where Price is goes here (GE page preferably)');
ItemPrice := between('Current Guide Price <span>', '</span>', p); //Place were Price is.
writeln('[ITEM NAME HERE]: ' +toStr(ItemPrice));
ItemPrice := replace(ItemPrice, ',', '', [rfReplaceAll]);
PriceInteger := strToInt(ItemPrice);
end;
{------------------------------------------------------------------------------}
procedure Setup();
begin
smartPlugins := ['d3d9.dll'];
clearDebug();
if drawonsmart then
smartEnableDrawing := true;
smartShowConsole := false;
setupSRL();
declarePlayers();
If Not Debug Then
DisableSRLDebug := True;
//SPS.setup('MAP NAME HERE', RUNESCAPE_OTHER); // If Using SPS MAP erase "//" at the beggining of the line
breaktime := randomrange(4600000, 5800000); //Time to break
sleeptime := randomrange(46800000, 54000000); // Time to do sleep break
//scriptPaintBMP := loadBitmap(appPath + '/Scripts/ImageName.png'); // If Using PAINT erase "//" at the beggining of the line
//Getprice(); //If We need to get the price of the GE erase "//" at the beggining of the line
breakTimer.start();
sleeptimer.start();
{------------Colors---------------} // if using global vars for colors load them here.
{------------End-Colors-----------}
end;
{------------------------------------------------------------------------------}
procedure customLogIn();
begin
players[currentPlayer].login();
writeln('Waiting for lag to go away');
wait(randomrange(4000, 5000));
exitTreasure();
minimap.clickCompass();
mainScreen.setAngle(MS_ANGLE_HIGH);
mainscreen.setZoom(true);
end;
{------------------------------------------------------------------------------}
procedure mainLoop();
begin

if breakTimer.getTime() >= breaktime then
begin
doBreak();
breakTimer.reset();
breakTimer.start();
if not isLoggedIn() then
customlogin;
end;

if sleeptimer.getTime() >= sleeptime then
begin
SleepBreak;
sleeptimer.reset();
sleeptimer.start();
if not isLoggedIn() then
customlogin;
end;

if not isLoggedIn() then
customlogin;

{Here we should call all the procedures that will carry out the actions of the script}

end;
{------MainLoop-------}
begin

Setup;
MainLoop;

end.
{-------The End-------}

Synikk

2015-03-14 23:50:35

From: Lipcot
This is kind of a template i had made long ago to help a few new people to start out and understand, why dont you give it a deep look? it has breaks, sleep breaks, antiban, long antiban and "custom" login.

program new;

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

var
{Break vars}
Sbreaks, Breaks, Sleeptime, TimeOnBreak, BreakTime: integer;
breakTimer, TimeOnBreakTimer, SleepTimer: TTimeMarker;
{Proggy vars}
ItemAcquired, Profit, ProfitPerHour, LoadsDone, PriceInteger: Integer;
ItemPrice, CurrentStatus: string;

const
Debug = true;
DrawOnSmart = false;

procedure declarePlayers();
begin
setLength(players, 1);
with players[0] do
begin
loginName := 'Acc username goes here';
password := 'Acc password goes here';
isActive := true;
isMember := true;
World := 6;
end;
currentPlayer := 0;
end;
{------------------------------------------------------------------------------}
procedure progressReport();
begin
profit := (ItemAcquired * (PriceInteger));
profitPerHour := round((profit * 60) / (getTimeRunning() / 60000));
TimeOnBreak := round(TimeOnBreakTimer.getTime() / 60000);
if not debug then
clearDebug();
{This will appear on the Debug each time we call it}
{--------------Report----------------------------------------------------------}
writeLn('========================================================');
writeLn('Progress Report');
writeLn('Time Run: ' + timeRunning);
writeLn('Items Acquired: ' + intToStr(ItemAcquired) + ' Profit Made: ' + intToStr(profit));
writeLn('Money P/H: ' + intToStr(profitPerHour));
writeLn('Time on Break: ' + intToStr(TimeOnBreak) + ' minutes ');
writeLn('Normal Breaks Taken: ' + intToStr(breaks) + ' Long Breaks Taken:' + intToStr(sbreaks));
writeLn('========================================================');
{------------------------------------------------------------------------------}
end;
{------------------------------------------------------------------------------}
procedure paintOnSmart();
var
doingString, moneyphString, timeString, progressString: string;
begin

if not isLoggedIn() then
exit;
{These will be printed always we call this procedure. It will only change when the Var's change.}
TimeString:= ('Time Run: ' + timeRunning);
DoingString := 'Activity we are doing';
progressString:= ('Items Picked/Made/Acquired: ' + intToStr(ItemAcquired));
MoneyphString:= ('Gp Per Hour: ' + intToStr(profitPerHour));

smartImage.clear;
//smartImage.drawBitmap({BMP name goes here}, point(0, 327)); //if we loaded a ProggyBMP erase "//" at the beggining of line
smartImage.drawText(DoingString, point(2, 0), upChars, false, 16777215); //Top left corner, white letters
smartImage.drawText(TimeString, point(2, 13), upChars, false, 16777215);
smartImage.drawText(progressString, point(2, 26), upChars, false, 16777215);
smartImage.drawText(MoneyphString, point(2, 39), upChars, false, 16777215);
smartImage.drawText(CurrentStatus, point(2, 52), upChars, false, 16777215);
//'Current Status' is to be changed at each procedure so we know what we are doing
end;
{------------------------------------------------------------------------------}
// To be called as: antiban(400); that means 10% chance
procedure antiban(rand: integer);
begin
mousespeed := 20 + random(5);
case random(rand) of
0..12: smallRandomMouse(500 + random(150));
13..25: sleepAndMoveMouse(randomRange(600, 5500));
26..28: wait(randomRange(5000, 7000));
29..40: pickUpMouse();
end;
end;
{------------------------------------------------------------------------------}
// To be called as: longAntiban(1000); that means 10% chance.
procedure longAntiban(rand: integer);
begin
case random(rand) of
1..40: begin
writeLn('Simulating Checking Social Networks');
mouseOffClient(OFF_CLIENT_RANDOM);
wait(randomRange(30000, 40000));
pickUpMouse();
end;
41..61: begin
writeLn('Simulating Bored Human');
mouseOffClient(OFF_CLIENT_RANDOM);
wait(randomRange(6000, 8000));
pickUpMouse();
mousespeed:= 19 + random(3);
smallRandomMouse(1000 + random(500));
end;
62..100: begin
writeLn('Simulating Small afk');
sleepAndMoveMouse(750 + random(500));
wait(randomRange(5000, 8000));
pickUpMouse();
end;
end;
end;
{------------------------------------------------------------------------------}
procedure doBreak();
begin

TimeOnBreakTimer.start();

if not isLoggedIn() then
exit;

CurrentStatus := ('Status: Breaking'); //Draws on smart
progressreport;
paintonsmart;

case randomRange(1,50) of
1..50: begin
clearDebug();
writeLn('Taking 10-12 minutes break');
progressreport;
paintonsmart;
players[currentPlayer].exitToLobby();
mouseOffClient(OFF_CLIENT_RANDOM);
wait(randomRange(600000, 720000));
end;
51..100: begin
clearDebug();
writeLn('Taking (12-18 minutes break');
progressreport;
paintonsmart;
players[currentPlayer].exitToLobby();
mouseOffClient(OFF_CLIENT_RANDOM);
wait(randomRange(480000, 1080000));
end;
end;

inc(breaks);
TimeOnBreakTimer.pause();
end;
{------------------------------------------------------------------------------}
procedure SleepBreak();
begin
CurrentStatus := ('Status: Sleeping Break');
progressreport;
paintonsmart;
TimeOnBreakTimer.start();
writeLn('Taking 7-8 hours "sleep" break');
players[currentPlayer].logout;
wait(randomRange(25200000, 28800000)); //7-8 hours
inc(Sbreaks);
TimeOnBreakTimer.pause();
end;
{------------------------------------------------------------------------------}
procedure GetPrice();
var
p : string;
begin
writeln('Recieving GE Prices');
p := getPage('Web Page where Price is goes here (GE page preferably)');
ItemPrice := between('Current Guide Price <span>', '</span>', p); //Place were Price is.
writeln('[ITEM NAME HERE]: ' +toStr(ItemPrice));
ItemPrice := replace(ItemPrice, ',', '', [rfReplaceAll]);
PriceInteger := strToInt(ItemPrice);
end;
{------------------------------------------------------------------------------}
procedure Setup();
begin
smartPlugins := ['d3d9.dll'];
clearDebug();
if drawonsmart then
smartEnableDrawing := true;
smartShowConsole := false;
setupSRL();
declarePlayers();
If Not Debug Then
DisableSRLDebug := True;
//SPS.setup('MAP NAME HERE', RUNESCAPE_OTHER); // If Using SPS MAP erase "//" at the beggining of the line
breaktime := randomrange(4600000, 5800000); //Time to break
sleeptime := randomrange(46800000, 54000000); // Time to do sleep break
//scriptPaintBMP := loadBitmap(appPath + '/Scripts/ImageName.png'); // If Using PAINT erase "//" at the beggining of the line
//Getprice(); //If We need to get the price of the GE erase "//" at the beggining of the line
breakTimer.start();
sleeptimer.start();
{------------Colors---------------} // if using global vars for colors load them here.
{------------End-Colors-----------}
end;
{------------------------------------------------------------------------------}
procedure customLogIn();
begin
players[currentPlayer].login();
writeln('Waiting for lag to go away');
wait(randomrange(4000, 5000));
exitTreasure();
minimap.clickCompass();
mainScreen.setAngle(MS_ANGLE_HIGH);
mainscreen.setZoom(true);
end;
{------------------------------------------------------------------------------}
procedure mainLoop();
begin

if breakTimer.getTime() >= breaktime then
begin
doBreak();
breakTimer.reset();
breakTimer.start();
if not isLoggedIn() then
customlogin;
end;

if sleeptimer.getTime() >= sleeptime then
begin
SleepBreak;
sleeptimer.reset();
sleeptimer.start();
if not isLoggedIn() then
customlogin;
end;

if not isLoggedIn() then
customlogin;

{Here we should call all the procedures that will carry out the actions of the script}

end;
{------MainLoop-------}
begin

Setup;
MainLoop;

end.
{-------The End-------}


Thanks, i'll take a look :)

Myke

2015-03-15 00:12:28

From: Synikk
Hey guys,

first post in a while. If the title wasn't clear, i'm asking if there is a way where you can code a bot to stop after around 3-4 hours, log out between 1-3 hours, and then log back in and resume the (e.g.) combat section of the script.

Also are there any scripts that i can read that currently have this implemented?

Asking because i'm going away for the week and want to edit a script to run for the whole week haha :D

Thanks!


aerolib has the feature

The Mayor

2015-03-15 00:23:58

Most of the scripts on the forums take breaks.

Synikk

2015-03-16 00:38:02

From: The Mayor
Most of the scripts on the forums take breaks.


As in breaks where they logout or breaks where they just afk for a bit?

The Mayor

2015-03-16 00:59:08

From: Synikk
As in breaks where they logout or breaks where they just afk for a bit?


Logout:


program Example;
{$DEFINE SMART}
{$i srl-6/srl.simba}

procedure loginPlayer();
begin
players[currentPlayer].login();
wait(randomRange(4000, 6000));
minimap.clickCompass();
mainscreen.setAngle(MS_ANGLE_HIGH);
exitTreasure();
closePopup();
mainScreen.setZoom(true);
end;

procedure takeBreak();
begin
if players[currentPlayer].worked.getTime() > 3600000 then
begin // If we've been working > 1 hour then
writeLn('Taking a 5 minute break');
players[currentPlayer].exitToLobby();
mouseOffClient(OFF_CLIENT_RANDOM);
wait(random(280000, 390000));
loginPlayer(); // Login + setup etc.
players[currentPlayer].worked.start(); // Reset the worked timer
end;
end;


procedure mainLoop();
begin
// the procedures/func in the correct order etc.

takeBreak(); // Check if it's time for break
end;

begin
clearDebug();
declarePlayers();
setupSRL();
players[currentPlayer].worked.start();

repeat
if not isLoggedIn() then loginPlayer();
mainLoop();
until (players.getActive() < 1);
end.