SRL Archive - First Scripts

Sharing my potion maker with you guys :p


l6bustank

2012-11-10 15:33:12

So here it is.
I use it to make unfs from vial+herb and also for adding secondaries. If you want to add secondaries then just tweak the timers in the end of Mix and also the failsafe's uptext in Bank.
Bank setup:
1st row: 1. varrock tele tab, 2. vial of water/unf, 3. and on: herbs/secondaries
The script is set for unfs atm (making my way to h'ween set :p ).
knock yourselves out :)

E: I added teleing to edgeville+walking to sw bank, now all you have to do is buy the stuff, set up your bank and run the script anywhere on runescape! Comfortable, isnt it.

program TankHerblore; //Used an old 170-line version of Jeffrey's herblore as a skeleton.
{$DEFINE SMART}
{$I SRL/SRL.Simba}
{$i sps/sps.simba}

const
Loads = 1000; // Nothing to do with that atm, kept it in case someone wants to revert to fixed nr. of loads.
BankOption = 1; // 0 for bankers and 1 for soulwars.

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := ''; //Character Name
Pass := ''; //Character Pass
Pin := ''; //Pin for bank
Active := true;
end;
end;

//Credits to Flight+RISK+BenLand
procedure WindMouse2(xs, ys, xe, ye, gravity, wind, minWait, maxWait, maxStep, targetArea: extended);
var
veloX, veloY, windX, windY, veloMag, dist, randomDist, lastDist, step: extended;
lastX, lastY: integer;
sqrt2, sqrt3, sqrt5: extended;
begin
sqrt2:= sqrt(2);
sqrt3:= sqrt(3);
sqrt5:= sqrt(5);
while hypot(xs - xe, ys - ye) > 1 do
begin
dist:= hypot(xs - xe, ys - ye);
wind:= minE(wind, dist);
if dist >= targetArea then
begin
windX:= windX / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
windY:= windY / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
end else
begin
windX:= windX / sqrt2;
windY:= windY / sqrt2;
if (maxStep < 3) then
begin
maxStep:= random(3) + 3.0;
end else
begin
maxStep:= maxStep / sqrt5;
end;
end;
veloX:= veloX + windX;
veloY:= veloY + windY;
veloX:= veloX + gravity * (xe - xs) / dist;
veloY:= veloY + gravity * (ye - ys) / dist;
if hypot(veloX, veloY) > maxStep then
begin
randomDist:= maxStep / 2.0 + random(round(maxStep) div 2);
veloMag:= sqrt(veloX * veloX + veloY * veloY);
veloX:= (veloX / veloMag) * randomDist;
veloY:= (veloY / veloMag) * randomDist;
end;
lastX:= Round(xs);
lastY:= Round(ys);
xs:= xs + veloX;
ys:= ys + veloY;
if (lastX <> Round(xs)) or (lastY <> Round(ys)) then
MoveMouse(Round(xs), Round(ys));
step:= hypot(xs - lastX, ys - lastY);
wait(round((maxWait - minWait) * (step / maxStep) + minWait));
lastdist:= dist;

{$IFDEF SMART}
//if (ENABLE_MOUSE_PAINT) then
//SMART_DrawDotsEx(False, [Point(lastX, lastY)], clWhite);
{$ENDIF}

end;
if (Round(xe) <> Round(xs)) or (Round(ye) <> Round(ys)) then
MoveMouse(Round(xe), Round(ye));

end;

//Credits to Flight
procedure HumanMMouse(eX, eY, ranX, ranY: Integer);
var
randSpeed: extended;
X,Y,X2,Y2,A,Dist,MP: integer;
begin
A := MouseSpeed;
GetMousePos(X, Y);
Dist := Distance(X, Y, eX, eY);
MP := Round(Dist/150);
if MP < 0 then
MP := 1;

randSpeed := (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
X2 := RandomRange(eX-(A*MP), eX+(A*MP));
Y2 := RandomRange(eY-(A*MP), eY+(A*MP));
WindMouse2(X, Y, X2, Y2, 11, 8, 10.0 / randSpeed, 12.0 / randSpeed, 10.0 * randSpeed, 10.0 * randSpeed);
GetMousePos(X, Y);
MMouse(eX, eY, ranX, ranY);
MouseSpeed := A;
end;

Procedure WalkToExchange;
var
RoadToGe: TPointArray;
begin
SPS_Setup(RUNESCAPE_SURFACE, ['11_7','11_6','10_6','12_7','12_6']);
RoadToGe := [Point(4677, 2951), Point(4663, 2941),
Point(4627, 2925), Point(4624, 2869),
Point(4569, 2832), Point(4514, 2810),
Point(4502, 2789), Point(4541, 2748),
Point(4548, 2735)];
SPS_WalkPath(RoadToGe);
end;

Procedure Bankversion1;
begin
Withdraw(1, 0, 14);
Wait(RandomRange(77, 189));
Withdraw(2, 0, 14);
Wait(RandomRange(64, 156));
CloseBank;
Wait(RandomRange(93, 141));
end;

Procedure Bankversion2;
begin
Withdraw(2, 0, 14);
Wait(RandomRange(77, 189));
Withdraw(1, 0, 14);
Wait(RandomRange(64, 156));
CloseBank;
Wait(RandomRange(93, 141));
end;

Procedure Bankversion3;
begin
Withdraw(1, 0, 14);
Wait(RandomRange(77, 189));
Withdraw(2, 0, 10);
Wait(RandomRange(64, 156));
DepositAll;
Withdraw(1, 0, 14);
Wait(RandomRange(121, 227));
Withdraw(2, 0, 14);
Wait(RandomRange(104, 209));
CloseBank;
Wait(RandomRange(93, 141));
end;
//The next three are from ughh... somewhere, idk :/ . Credits to initial authors for all 3.
Procedure Minibreaker;
var
fails:integer;
begin
if not(loggedin) then
exit;
case random(2) of
1: begin
writeln('Taking a quick break! Be right back!');
repeat
wait(randomrange(100, 200));
inc(fails);
until (fails >= 10);
wait(randomrange(21765, 49310));
writeln('Were back!');
end;
end;
end;

Procedure Changecamera;
begin
case random(2) of
0: begin
Clicknorth(SRL_ANGLE_NONE);
keydown(VK_RIGHT);
wait(randomrange(1650, 1750));
keyup(VK_RIGHT);
end;
1: begin
keydown(VK_RIGHT);
wait(randomrange(1650, 1750));
keyup(VK_RIGHT);
end;
end;
end;

Function MouseOffscreen:boolean;
var
w, h:integer;
begin
getclientdimensions(w, h);
case random(12) of
0..5: mmouse(randomrange(0, w), randomrange(-54, -60), 1, 1); //North
4..6: mmouse(w + randomrange(30, 50), randomrange(0, h), 2, 2); //East
7..10: mmouse(randomrange(0, w), h + randomrange(30, 50), 2, 2);//South
11..12: mmouse(0 - randomrange(10, 30), randomrange(0, h), 2, 2); //West
end;
Wait(RandomRange(1021, 2154));
Result := true;
end;

procedure AntiBan;
var
x: Integer;
begin
x := Random(300) case x of 0..2: HoverSkill('Herblore', false);
3:
GameTab(26);
12..15:
PickUpMouse;
16..20:
RandomMovement;
26..27:
RandomRClick;
28..32:
BoredHuman;
33:
ExamineInv;
34:
RandomAngle(SRL_ANGLE_HIGH);
35..40:
GameTab(25);
41..44:
Wait(RandomRange(7689, 12456));
45..48:
MouseOffscreen;
49..54:
Changecamera;
55..56:
Minibreaker;
57..58:
SleepAndMoveMouse(1314);

end;
SetAngle(SRL_ANGLE_HIGH);
Wait(RandomRange(107, 223));
end;

Procedure TeleToEdge;
var
x, y, HomeTele, EdgeTele: Integer;
begin
EdgeTele := DTMFromString('mrAAAAHic42BgYFBhZGBQBWJdINYAYgUglgJieSCWBuLzQDW3gPgsEB+A4qNAfAGIrwLx4o07GTi9PRiCxaUYdBISGRyL8hkSs4vAfHtzYwZWoBp8mJEAhgEAfYQPWg==');
HomeTele := DTMFromString('mrAAAAHic42BgYLBjYmBwAWJ3KA3imwGxORDbA7E4IwODICOElgVieSCWgorxA/G+I58Y2ubcgOMY06Ng2t3emGFu1XYGVqAd+DAjAQwDAKqCETY=');
GameTab(Tab_Magic);
Wait(500);
If FindDTM(HomeTele, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
HumanMMouse(x, y, 2, 2);
Wait(200);
ClickMouse2(True);
Wait(3000);
If FindDTM(EdgeTele, x, y, MSX1, MSY1, MSX2, MSY2) then
begin
HumanMMouse(x, y, 2, 2);
Wait(500);
ClickMouse2(True);
Wait(24000);
end;
end;
FreeDTM(HomeTele);
FreeDTM(EdgeTele);
end;

Procedure WalkToBank;
var
x, y: Integer;
RoadToPortal: TPointArray;
begin
ClickNorth(SRL_ANGLE_HIGH);
Wait(500);
SPS_Setup(RUNESCAPE_SURFACE, ['10_6']);
RoadToPortal := [Point(4114, 2650), Point(4118, 2670),
Point(4129, 2683), Point(4150, 2706), Point(4149, 2723),
Point(4156, 2740), Point(4155, 2751)];
SPS_WalkPath(RoadToPortal);
Wait(3000);
FindObjCustom(x, y, ['nter', 'oul'], [9358075, 8040153], 5);
Wait(500);
HumanMMouse(x, y, 0, 0);
Wait(200);
ClickMouse2(True);
Wait(5000);
HumanMMouse(654, 87, 0, 0);
Wait(200);
ClickMouse2(True);
Wait(5000);
end;

Procedure Bank;
var
NoOfHerbs, NextHerb, x: Integer;
begin
If BankOption = 1 then
begin
repeat
SetAngle(SRL_ANGLE_HIGH);
OpenBankChest(SRL_BANK_SW);
until BankScreen or PinScreen;
end;
If BankOption = 0 then
begin
repeat
SetAngle(SRL_ANGLE_HIGH);
MakeCompass('N');
OpenBankNPC;
until BankScreen or PinScreen;
end;
if PinScreen then
begin
repeat
InPin(Players[0].Pin);
until BankScreen or not (LoggedIn);
end;
if BankScreen then
begin
Wait(RandomRange(132, 198));
DepositAll;
Wait(Randomrange(67, 101));
NoOfHerbs := GetBankItemAmount(2, 0);
Writeln(IntToStr(NoOfHerbs));
If (NoOfHerbs<15) then
begin
Wait(6000); //This part is something of a failsafe. Lag spikes seem to cause the script to terminate before the time is right.
Writeln('Doing failsafe in case we got Jagex-d :p');
NoOfHerbs := GetBankItemAmount(2, 0); //that is the same thing all over again, but since the possible lag spike passed, we're good now :)
Writeln(IntToStr(NoOfHerbs));
If (NoOfHerbs<15) then
begin
NextHerb := GetBankItemAmount(3, 0); //If i had 3000+3000 herbs then the script will continue with the other 3000 now.
Writeln((IntToStr(NextHerb))+' herbs in next slot');
If NextHerb<15 then
begin
Writeln('Out of Herbs!');
Wait(200);
Withdraw(0, 0, 1); //got my teletab here
Wait(500);
CloseBank;
Wait(500);
InvMouse(1, mouse_left); //varrock tele
Wait(4000);
WalkToExchange;
Wait(3000);
Writeln('Walked to GE');
TerminateScript;
end;
If NextHerb>14 then //checking if there is a herb in next slot or sth else.
begin
MouseBankSlot(4, mouse_left); //Not too fond of coord-clicking so I just used this
Wait(500);
If not IsUpText('Clean') then
begin
Writeln('Next slot not herb');
Wait(200);
Withdraw(0, 0, 1);
Wait(500);
CloseBank;
Wait(500);
InvMouse(1, mouse_left);
Wait(4000);
WalkToExchange;
Wait(3000);
Writeln('Walked to GE');
TerminateScript;
end;
end;
end;
end;
x := Random(27) case x of //bit of Antiban here
0..17:
BankVersion1;
18..25:
BankVersion2;
26..27:
BankVersion3;
end;
end;
end;

procedure Mix;
var
Count, Fail, x: Integer;
begin
FindNormalRandoms;
x := Random(7) case x of //more antiban
0..2:
InvMouse(14, 3);
3..5:
InvMouse(13, 3);
6..7:
InvMouse(12, 3);
end;
ClickMouse2(True);
Wait(RandomRange(134, 242));
x := Random(8) case x of //and some more antiban
0..2:
InvMouse(15, 3);
3..5:
InvMouse(16, 3);
6..7:
InvMouse(17, 3);
8:
InvMouse(18, 3);
end;
ClickMouse2(True);
Wait(RandomRange(907, 998));
HumanMMouse((MCX1+MCX2)/2 ,(MCY1+MCY2)/2 , 21, 13); //and more antiban
while not(IsUpText('All')) do
begin
repeat
Wait(RandomRange(20, 40));
Inc(Fail);
if (Fail > 50) then Exit;
until (IsUpText('All'));
end;
ClickMouse2(True);
AntiBan;
Wait(RandomRange(896, 4576)); //should look like checking my facebook or w/e and coming back a bit late sometimes.
repeat
Wait(RandomRange(87, 111)); //used this because somewhy the script takes a loooong time to realise theres nothing in an inv slot (???)
Inc(Count);
If (Count > 30) then Exit;
until not (ExistsItem(24)); //In case of heavy lagg, adjust this to slot 25 or 26 (or more if its really so bad...).
end;

begin
Cleardebug;
{$IFDEF SMART}
{$IFDEF SIMBAMAJOR980}
Smart_Server := 72;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
{$ELSE}
SRL_SixHourFix := True;
Smart_FixSpeed := True;
{$ENDIF}
{$ENDIF}
SetupSRL;
MouseSpeed := RandomRange(16, 20); //new mouse speed every time you run the script
DeclarePlayers;
LoginPlayer;
ActivateClient;
Writeln('l6bustanks Bot-any-day special with all-you-can-eat Antiban, start botting!');
Wait(800);
SmartSetRefresh(70);
SetAngle(SRL_ANGLE_HIGH);
Wait(200);
TeleToEdge;
WalkToBank;
Wait(2000);
SmartSetRefresh(9); //My CPU is rubbish so I set this really low so i can play another game. Feel free to adjust.
repeat
Bank;
Mix;
until false;
end.


Just found this from my debug, lag spikes do happen alot. The numbers mean the amount of herbs the script has detected in the target bank slot. Lag makes it detect for 0 for some reason, but as you see, the failsafe will save the day.
1185
1173
1159
0
Doing failsafe in case we got Jagex-d :p
1148
1134
1125

Rezozo

2012-11-10 17:52:39

Damn, not a member! When, if, I do become, Ill be sure to test this out!
GL bro, and Nice to see a script from you. Is it your first?
~Rez

l6bustank

2012-11-10 18:09:06

From: Rezozo
Damn, not a member! When, if, I do become, Ill be sure to test this out!
GL bro, and Nice to see a script from you. Is it your first?
~Rez


I think I can call it my first, yeah.
I downloaded a very basic 170-line potion maker some months ago from here, but it wasnt as good as i wanted it to be, so last month I started to learn about scripting and slowly improving the script (btw, thx to yohojo, coh3n and other tutorial writers!) .
First I added loads of antiban, then failsafes, next up was walking and then another failsafe with a few more tweaks+antiban-ish features. Still need to add walking from ge to SW and go over some timers maybe, then i can call it ready.

I have done sth similar to a few other scripts too and they are working way better for me than right after downloading :D

Rezozo

2012-11-10 21:48:01

Ooh nice! GL with this BTW.

l6bustank

2012-11-11 02:40:55

From: Rezozo
Ooh nice! GL with this BTW.


thx :)

l6bustank

2012-11-16 15:17:40

Updated the script, added teleing to edgeville+walking to sw bank, now all you have to do is buy the stuff, set up your bank and run the script anywhere on runescape! Comfortable, isnt it.
The script should now be completed.
Bot away!