SRL Archive - First Scripts

My first script


Zeal

2014-06-24 13:03:30

So here it is, a maple cutter to be used at shantay chest.

The only thing I can think of adding now is breaking options and an antiban to move mouse off screen while waiting for the logs to cut.

If any improvements can be made please let and know or if the script world be safe enough to use.


program scriptTemplate;

{$DEFINE SMART} // Always have this to load smart
{$I SRL-6/SRL.simba} // To load the SRL include files
{$I SPS/lib/SPS-RS3.Simba} // To load the SPS include files

//////////////////////////////////////////////////////////////////
// Setup //
//////////////////////////////////////////////////////////////////

const
BANK_PIN = '0000'; //Your bank pin
KEY_BIND = '1'; //Keybind for logs on action bar

procedure declarePlayers();
begin
setLength(players, 1);
with players[0] do
begin
loginName := 'loginname';
password := 'password';
isActive := true;
isMember := true;
world := 100
end
currentPlayer := 0;
end;
//////////////////////////////////////////////////////////////////
// End of Setup //
//////////////////////////////////////////////////////////////////

var
maplelogsDTM, x, y: integer;


procedure withdrawLogs();
begin
if not isLoggedIn() then
exit;

maplelogsDTM := DTMFromString('mbQAAAHicY2VgYOAGYikgZmSAABEg5gNiISAWA2JWqLivEUglEwqWZMAEjFgwGAAAVC8BKw==');

if findDTM(maplelogsDTM, x, y, tabBackpack.getBounds()) then
exit;

if not bankScreen.isOpen then
begin
bankScreen.open(BANK_CHEST_SHANTAY);
wait(randomRange(800, 1800));
if pinScreen.isOpen() then
begin
pinScreen.enter(BANK_PIN);
wait(randomRange(800, 1800));
end;
bankScreen.clickButton(BANK_BUTTON_PRESET_1);
wait(randomRange(1000, 2000));
end;
end;

procedure fletchLogs();
//var
// maplelogsDTM, x, y: integer;

begin
if not isLoggedIn() then //Exits procedure is logged out
exit;

if not tabBackpack.isOpen() then //Opens backpack if not already
begin
tabBackpack.open();
wait(randomRange(500, 1200));
end;

maplelogsDTM := DTMFromString('mbQAAAHicY2VgYOAGYikgZmSAABEg5gNiISAWA2JWqLivEUglEwqWZMAEjFgwGAAAVC8BKw==');

if not findDTM(maplelogsDTM, x, y, tabBackpack.getBounds()) then //Exits procedure if no logs in backpack
exit;

if findDTM(maplelogsDTM, x, y, tabBackpack.getBounds()) then //Finds maple logs
begin
typesend(KEY_BIND,false); //Types '1' for logs in action bar
wait(randomRange(2000,4000));
if toolScreen.isOpen() then
begin
typesend('2',false); //Types '2' for knife on tool screen
wait(randomRange(1200, 2400));
end;
if productionScreen.isOpen() then
begin
productionScreen.clickStart(); //Gets past the production screen
wait(randomRange(600, 1200));
end
else TPlayer.logout()
end;

repeat
wait(randomRange(2000, 8000));
until (not findDTM(maplelogsDTM, x, y, tabBackpack.getBounds()) or not isLoggedIn())

end;




// main loop
begin
clearDebug(); // Clear the debug box
smartEnableDrawing := true; // So we can draw on SMART
setupSRL(); // Load the SRL include files
declarePlayers(); // Set up your username/pass

repeat
if not isLoggedIn() then // If player isn't logged in then
begin
players[currentPlayer].login(); // Log them in
exitSquealOfFortune(); // Exit squeal if found
minimap.setAngle(MM_DIRECTION_EAST); // Make compass north and angle high
mainScreen.setAngle(MS_ANGLE_HIGH);
end;

withdrawLogs();
fletchLogs();

until(false);
end.

KeepBotting

2014-06-24 14:27:46

Your post says this is a maple cutter, but I see no code that would click on a tree :P I think this is a maple burner!

It's pretty good for a first script, but it's very simple in the sense that it has no antiban and very few failsafes.

You might want to look into that :P try burning maples for a couple hours legit, really get to know the method, inside-out. Then try and identify places where a script might mess up that a human wouldn't, and add failsafes :) that's how I do mine.

All in all this is a solid first script, and you should be pleased with yourself!

Remember you can add my Skype or PM me here if you've got any questions

Zeal

2014-06-24 15:28:29

I should have called it a maple fletcher, but technically it does cut maple logs (with a knife).

I'll try adding some antiban while giving it a test run.

Thanks for the feedback.

KeepBotting

2014-06-24 15:54:08

From: Zeal
I should have called it a maple fletcher, but technically it does cut maple logs (with a knife).

I'll try adding some antiban while giving it a test run.

Thanks for the feedback.
Oh, haha! I saw you hitting keybinds and immediately thought a burner, when the comments right in the script said 'knife on tool screen'

yeah silly me, it is a cutter :D

The Mayor

2014-06-24 18:08:03

Nicely done.

Awkwardsaw

2014-06-24 19:13:46

Well, one thing that I noticed was that you never free your DTMs after you're done with them. This can add some serious memory build up if you aren't careful :)

Last Legend

2014-07-13 22:47:18

Very nice :) A little bit of an antiban in there could be useful, although with the way you can fletch these days it may not even be neccessary