SRL Archive - First Scripts

HerbCleaner!


shstiger2009

2011-11-16 13:01:03

I am so proud that I was able to learn this and make this script! I've only been here a few weeks and have learned so much, and want to learn more. I borrowed and followed other players scripts to do some of my functions, and it's working quite well for me, but a shout out to the SRL developers as I've learned a lot and this script is based off of seeing others and learning from that. So how's this script?

Also, a lot of players were requesting an Herb Cleaner, and while neeger made one, I've seen reports of bugs. For me, this script has worked flawlessly until it runs out of herbs. Then it doesn't know how to Logout, lol, but I'll put it in soon.


program HerbCleaner;
{$DEFINE SMART}
{$i SRL/SRL.scar}

var
AntiBanCounter, MainAntiBanCounter: integer;
RandomLevel: string;
{
Setup:
-Have herbs in 1st bank slot
-Have character in the bank
-Fill in setup below and you're done!
}
Const
HowManyCleaned = 1000; //How many herbs do you have to clean?
WhichBank = ''; // Which bank are you in? vwb, veb, feb, fwb, etc. (All SRL banks supported)
Member = true; // Are you a member? True (only member skill)
LampSkillxp = 'Herblore'; // Where you want lamp experience?(from random)
FrequencyOfAntiBan = 3; // How often do you want to perform antiban? after 1, 2, or 3 loads?

procedure DeclarePlayers;
begin
HowManyPlayers := 1; // Total amount, multiple players not supported
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name := ''; // Username
Players[0].Pass := ''; // Password
Players[0].Nick := ''; // 3-4 lowercase letters from username
Players[0].Active := True; // Set to true if you want to use Player 0
Players[0].Pin := ''; // Leave blank if the player doesn't have a bank pin
Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];

end;

{ Setup complete. Click run and enjoy!

}

Procedure FreeAllDTMs;
begin
Writeln('Freed all DTMs');
end;

procedure StartSmart;
begin
Smart_Server := (155); // Smart Server
Smart_Members := (Member);
Smart_Signed := True;
Smart_SuperDetail := False;
end;

Procedure CheckLevel;
begin
writeln('Checking herblore level');
Mouse(599, 189, 4, 4, true);
MMouse(591, 337, 8, 8)
wait(2000 + random (1000));
GameTab(25); //inv
end;

Procedure MoveCompassRandom;
begin
writeln('moving compass');
Case Random(4) of
0: MakeCompass('N');
1: MakeCompass('E');
2: MakeCompass('S');
3: MakeCompass('W');
end;
end;

Procedure RandomLevelPicker;
begin
Case Random(15) of
0: RandomLevel := 'mining';
1: RandomLevel := 'attack';
2: RandomLevel := 'defense';
3: RandomLevel := 'strength';
4: RandomLevel := 'range';
5: RandomLevel := 'herblore';
6: RandomLevel := 'magic';
7: RandomLevel := 'runecrafting';
8: RandomLevel := 'smithing';
9: RandomLevel := 'fishing';
10: RandomLevel := 'cooking';
11: RandomLevel := 'crafting';
12: RandomLevel := 'woodcutting';
13: RandomLevel := 'firemaking';
end;
end;

Procedure AntiBan;
begin
Writeln('Performing Anti-ban..');
Case Random(7) of
0: CheckLevel;
1: MMouse(268, 172, 200, 200);
2: MoveCompassRandom;
end;
Writeln('AntiBan Complete');
AntiBanCounter := 0;
MainAntiBanCounter := MainAntiBanCounter + 1;
end;

procedure AntiRandoms; // ---Calls Anti-randoms---
begin
if not LoggedIn then exit;
FindNonInventoryRandoms;
FindNormalRandoms;
LampSkill := (LampSkillxp);
LevelUp;
end;

procedure Clean;
var
Slots: TIntegerArray;
i: integer;
begin
if not LoggedIn then Exit;
Slots := [1, 2, 3, 4, 8, 7, 6, 5, 9, 10, 11, 12, 16, 15, 14, 13, 17, 18, 19,
20, 24, 23, 22, 21, 25, 26, 27, 28];
for i := 0 to 27 do
begin
if not ExistsItem(Slots[i]) then Continue;
MouseItem(Slots[i], True);
Inc(Players[CurrentPlayer].Integers[0]);
Wait(450 + random(80));
FindNormalRandoms;
end;
end;

procedure WithdrawHerbs;// ---Withdraws Herbs from open bank---
var
x, y: integer;
begin
if OpenBank(Players[CurrentPlayer].Loc, False, False) then
begin
MouseBox(45, 100, 60, 113, 3);
if WaitUptext('rimy', 4000) then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, false);
Wait(380 + random(50));
ChooseOption('raw-All');
end;
end;
CloseBank;
Wait(750 + random(200));
end;

procedure WithdrawBank; // ---Opens the bank to withdraw---
var
Tr, Bo: integer;

begin
if BankScreen = false then
begin
AntiRandoms;
writeln('Trying to open bank..');
MakeCompass('N');
SetAngle(true);
OpenBankFast(WhichBank);
end;
repeat
wait(10);
Tr := Tr +1;
until (Tr = 1000) or (BankScreen = true);
if BankScreen = True then
begin
Writeln('opened bank successfully');
wait(1000 + random(1000));
if BankScreen then
begin
Wait(200 + Random(300));
FixBank;
if (not(InvEmpty)) then
DepositAll;
end;
ActivateClient;
WithdrawHerbs;
end else
if BankScreen = False then
begin
Bo := Bo +1;
writeln('Tried opening bank ' + IntToStr(Bo) + ' Times');
if (Bo >= 5) then
begin
writeln('Opening bank failed, logging out.');
//Logout;
NextPlayer(false);
FreeAllDTMs;
TerminateScript;
end;
end;
CloseBank;
end;

procedure SetupScript;
begin
SetupSRL;
DeclarePlayers;
StartSmart;
ActivateClient;
LoginPlayer;
end;

begin;
SetupScript;
repeat
ActivateClient;
WithdrawBank;
Clean;
until AllPlayersInactive;
FreeAllDTMs;
end.

PremiumBotter

2011-11-16 16:53:35

Ill give it a test now and return with a progress report

shstiger2009

2011-11-16 17:03:38

Err-I don't have a Progress Report in there as of now. But it works, and does what it says if you set it up right. It'll just withdraw the herbs from that first bank slot and clean away. :p

Flight

2011-11-16 21:14:13

Hey, congratulations on your first script there bud! Looking good for sure. :) If I might throw some suggestions your way.

First of which, SRL already has some really awesome anti-bans within the include, you just need to explore them. :p For example:

You have this as an anti-ban: (From the looks of it, it hovers your Herblore skill and then back to the inventory)

Procedure CheckLevel;
begin
writeln('Checking herblore level');
Mouse(599, 189, 4, 4, true);
MMouse(591, 337, 8, 8)
wait(2000 + random (1000));
GameTab(25); //inv
end;

Actually you don't need this at all, because luckily SRL has a procedure for hovering over a skill. Conveniently enough it's called "HoverSkill(SKILL STRING):" and it does the same thing, neat huh? So you can just delete your CheckLevel procedure completely and inside your Antiban procedure where you have "0: CheckLevel;" just replace that line with "HoverSkill('Herblore');". Easy peasy. :D

Also, in your Clean procedure, I believe this:

Slots := [1, 2, 3, 4, 8, 7, 6, 5, 9, 10, 11, 12, 16, 15, 14, 13, 17, 18, 19,
20, 24, 23, 22, 21, 25, 26, 27, 28];
Can be shortened to this:

Slots := [1..28];

The ".." indicates to include every number in between those to, so 2-27 are included via "..".

One last thing I'd like to point out quick. For your herb withdrawing you have the script set to move the mouse to what looks like the first row/column, check the uptext, and withdraw all. Well believe it or not there's a procedure for this inside of "bank.scar". Check this out:

function WithdrawEx(Col, Row, Amount: Integer; Uptexts: TStringArray): Boolean;

So… to withdraw your herbs at the first row & column you'd simple do this:

WithdrawEx(1, 1, 0, ['rimy']); //Setting 0 as the amount indicates to withdraw 'all'


Apart from that your script is looking good! It really is great to see newcomers taking an interest and learning, as this is what the community is all about. Continue to explore the SRL include, look at all of the features that are already available, there's so much there you'd be surprised. Rep+

Borland

2011-12-06 14:36:32

Was using this earlier as I couldn't get any of the other herb scripts to clean properly.

All started well till it got to the bank screen where it would hover over the first slot (where I placed my grimy herbs) for a few seconds, then it would close the bank and then repeat the process.

Took a little look at the script and only thing I could see that might have been messing it up was:

if WaitUptext('rimy', 4000) then

So I took it out and it worked. But now it doesn't know when to stop withdrawing as it doesn't check if "rimy" is present. Which leads me to ask what's the point of declaring how many herbs I want to clean as a const?
"HowManyCleaned" Makes no appearance after the initial declare.

Sorry if it sounds like I'm trying to put you down, I'm actually just trying to learn so these are honest questions.

Thanks for the script though, I was going to babysit it anyways, although I might try and fix it, I'll make that my first task. ;)