SRL Archive - First Scripts

[First Script] Shantay Bonfire


TomTop

2014-09-11 12:31:44

Hey, This is my very first script, so please do not hate on me.

A little history.
I left runescape a little while ago, when EOC came out because I hated it, then, about 2-3 months ago I decided to join again to give it another try.
I started leveling up my stats legit, but about a week ago I decided to try get my first 99 on this account, so I went for firemaking, I got it to 75 legit but I was just about to kill myself of bordem. I started searching for working bots that do not get you banned in 24h, and found Simba.

I decided to try make a little program to get my firemaking up instead of being a leecher and 'stealing' other people's work.

It's a very simple script, It just opens the chest at Shantay, withdraws the 10th item in your bank (top-right), closes the bank, and adds them to a near bonfire.

How could I improve my script? What anti-ban features can I add?

I've already made it a bit less obvious that I'm botting by making random delays.

The logs variable is only so I can loop it.



procedure ShantayFiremake();
var
logs: integer;
begin

repeat

if bankScreen.open(BANK_CHEST_SHANTAY) then
if bankScreen.withdraw(10, WITHDRAW_AMOUNT_ALL, ['']) then
wait(RandomRange(500, 1000));
bankScreen.close();
wait(RandomRange(5000, 1000));

tabBackPack.mouseSlot(1, MOUSE_MOVE);
fastClick(MOUSE_LEFT);
wait(RandomRange(1000, 2000));
SendKeys('3', 15+RandomRange(15,100), 20+RandomRange(10,30));
wait(RandomRange(100000, 120000));

until logs=1000;

Thank you.

Lucidity

2014-09-11 15:04:42

This is great for a first script, but it does need improvement.

For example, how about when you run out of logs? Does it continue? Try adding failsafes and more locations:)

Looks great, and I can't wait to see more from you.

- DMC ;)

sipfer3

2014-09-11 18:42:20

short and good.
like Blytez said, some antifails would be good. just let the script run a few hours and see if it stucks at any point.
also some antiban would be good. Since you have a "long" waiting time when the bot is burning the logs i would do some antibans like mouse out of screen etc, to simulate you are looking at another webiste or smth.
but nice first script :)

TomTop

2014-09-12 02:11:54

Thanks for your replies guys, they mean a lot.

How would I go about checking when I run out of logs? Every time it takes out logs from the bank, check if the inventory is full, and if not, stop the script?

Yeah, I'm trying to implement The Grand Exchange for some F2P players.

How do I add antibans while it's waiting? Because if I add wait(), and then under that line of code the antiban procedure, will it not do it after waiting(?).

Edit: When trying to implement the GREY banker at the grand exchange, it has troubles finding him, the camera is zoomed out fully and facing north. Any ideas?

Thanks.

Ashaman88

2014-09-12 09:46:09

Instead of sendkeys - why not try the toolscreen.open function?

sipfer3

2014-09-12 10:40:15

for checking if logs are lef tin bank u could just create a DTM of the logs and then end the script if dtm is not found :)

TomTop

2014-09-12 10:52:20

From: Ashaman88
Instead of sendkeys - why not try the toolscreen.open function?

I didn't know that function existed, I'm still very, very new to writing my own scripts.

From: sipfer3
for checking if logs are left in bank u could just create a DTM of the logs and then end the script if dtm is not found :)

What is a DTM?

sf411

2014-09-12 12:31:16

Go to Mayors scripting tut and go down a bit to Sub-tutorial 2. A good explanation of DTMs.

Lipcot

2014-09-12 14:45:04

I made an easy Shantay Burner some time ago to get to 50 FM heheh. so here, have a look into it and see if you can use anything! i didnt know about the toolscreen function at that moment either, so i made it work with sendkeys and a mousebox. Look for the instructions inside the code after the //. It has some kind of failsafe, but if the bonfire is not withing adding range and you get the message "no bonfires near" it will move behind the chest and stop working (this happens only when you run out of logs). It also has some functions that i ended up not using, so just take a look and see if something is useful to you.

program FireMaker;

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

// Go To shantay. Set preset 2 with logs you want to burn (any type)
// Put the logs you want to burn on slot "0". Start.
// This Script uses DIRECTX

var
loadsdone: integer;

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

function FindFire(): boolean;
var
x, y, i, r: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin

if findColorsSpiralTolerance(x, y, TPA, 3125185, mainScreen.getBounds(), 13, colorSetting(2, 0.19, 0.88)) then
begin
writeLn('We Found a Bonfire!');
result := true;
writeLn('We Found a Bonfire!');
end else
begin
result := false;
writeLn('We Didnt Find a Bonfire, Making One');
end;

end;

function notMoving(): boolean;
begin
result := not minimap.isPlayerMoving();
print('Function notMoving() result: ' + boolToStr(result));
end;

function AddingToBonfire(): boolean;
var
count1, count2, count3: integer;
begin

count1 := tabBackpack.count();
wait(randomRange(5500, 6000));
count2 := tabBackpack.count();
count3 := (count1 - count2);

if count3 >= 1 then
result := true;

if count3 <1 then
result := false;

print('Function AddingToBonfire() result: ' + booltostr(result));
end;

procedure LightFire();

var
mybox: tbox;
mybox2: tbox;

begin

myBox := intToBox(162, 187, 206, 224);
myBox2 := intToBox(265, 106, 300, 124);
repeat
begin
mouseBox(mybox2, MOUSE_LEFT);
if notmoving() then
begin
SendKeys('0', 50, 30);
wait(randomRange(3000, 4000));
mouseBox(mybox, MOUSE_LEFT);
tabBackpack.waitForShift(1000);
wait(randomRange(7000, 10000));
end;
end;

until findfire();
end;

procedure clickchest();
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;

begin
if not isLoggedIn() then
exit;
repeat
findColorsSpiralTolerance(x, y, TPA, 6587300, mainScreen.getBounds(), 3, colorSetting(2, 0.25, 0.84));

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

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

for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['hest'], 500) then
begin
fastClick(MOUSE_LEFT);
wait(randomrange(3000, 4000));
smartImage.clear();
break;
end;
end;
until bankscreen.isopen;
end;


procedure preset2();
begin

sleepAndMoveMouse(1000 + random(500));
bankScreen.clickButton(BANK_BUTTON_PRESET_1);
wait(randomrange(655, 1000));

end;

procedure antiban();
begin

case randomRange(1,102) of
1..30: begin
writeLn('Simulating Checking Social Networks');
mouseOffClient(OFF_CLIENT_RANDOM);
wait(randomRange(40000, 50000));
end;
31..41: begin
writeLn('Simulating Bored Human');
boredHuman();
wait(randomRange(5000, 10000));
end;
42..102: begin
writeLn('Simulating Small afk');
sleepAndMoveMouse(500 + random(1000));
wait(randomRange(8000, 12000));
pickUpMouse();
end;
end;
end;

procedure AddTobonfire();
var
mybox: tbox;
begin
myBox := intToBox(362, 187, 407, 224);

repeat

if not AddingToBonfire() then
begin
if tabBackpack.isEmpty then
begin
break;
exit;
end;
SendKeys('0', 50, 30);
wait(randomRange(3000, 4000));
mouseBox(mybox, MOUSE_LEFT);
mouseOffClient(OFF_CLIENT_RANDOM);
wait(randomRange(9000, 15000));
antiban();
end;

until AddingToBonfire();

end;



// main loop
begin
smartPlugins := ['d3d9.dll'];
clearDebug();
smartEnableDrawing := true;
smartShowConsole := false;
setupSRL();
declarePlayers();
disableSrlDebug := false;

repeat
if not isLoggedIn() then
begin
players[currentPlayer].login();
exitSquealOfFortune();
mainScreen.setAngle(MS_ANGLE_HIGH);
minimap.setAngle(MM_DIRECTION_NORTH);
end;

if tabBackpack.isEmpty then
begin
clickchest();
Preset2();
end;

addtobonfire();


until (false)
end.

Undorak7 :norris: