SRL Archive - First Scripts

1 script submission - Mud Rune Grinder


digitalninja

2012-08-28 22:22:39

I would like to officially release my very 1st script. I have been working on herbalore recently and needed to make 2500+ extreme magic potions … which, of course, required 2500+ ground mud runes. Insanely boring, repetitive, and time consuming, which struck me as a fantastic 1st script. I watched a TON of tutorials and although the script is probably super easy for a pro I learned a ton writing it and trouble shooting it. Props to Griff, YoHoJo, Getdropped, and Footy for their tutorials, scripts, and help!

What it does - Grind Mud Runes :spot:
Improvements - I need to somehow add a "Loads" function so it logs out after its done grinding all the runes …

Please enjoy and let me know what I can do to improve this!


//by Digital Ninja
//This script is simply meant to grind mud runes for making extreme
//magic potions. Its rather boring so I thought a script would be perfect!
//This is my 1st script attempt and complete credit goes to Griff and
//YoHoJo for their tutorials as well as Getdropped whos Herbalore script
//helped me understand banking and invmouse functions and provided the
//backbone for this script! (And Kudos to Footy as well!)

program Grind;
{$DEFINE SMART}
{$I SRL/SRL.Simba}


var
x, SuperFailSafe : Integer;

const
BankOption = 1; // 0 for bankers and 1 for soulwars chest!
WaitTimer = 150;

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;


procedure AntiBan;
begin
case Random(500) of
0..2:
HoverSkill('Herblore', false);
3:
GameTab(26);
12..15:
PickUpMouse;
16..20:
RandomMovement;
26..27:
RandomRClick;
28..30:
BoredHuman;
33:
ExamineInv;
34:
RandomAngle(SRL_ANGLE_HIGH);
35..40:
GameTab(25);

end;
SetAngle(SRL_ANGLE_HIGH);
Wait(RandomRange(100, 200));
end;

function Bank: Boolean;
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 or not(LoggedIn);
end;

if PinScreen then
begin
repeat
InPin(Players[0].Pin);
until BankScreen or not(LoggedIn);
end;

if BankScreen then
begin
Wait(RandomRange(200, 300));
InvMouse(2, mouse_Right);
WaitOption('All', 2000);
CloseBank;
Wait(RandomRange(500, 600));
end;

end;


procedure Rind;
var
FailSafe : Integer;
begin
FailSafe := 0;
InvMouse(1, 1);
ClickMouse2(True);
Wait(RandomRange(800, 900));
MMouse((MCX1+MCX2)/2 ,(MCY1+MCY2)/2 , 5, 5);
while not(IsUpText('All')) do
begin
Wait(RandomRange(20, 40));
Inc(FailSafe);
if (FailSafe > 50) then
begin
Writeln('Couldn''t find the make all button!');
FindNormalRandoms;
Inc(SuperFailSafe);
if (SuperFailSafe > 2) then
Rind;
Exit;
end;
end;
Writeln(inttostr(failsafe));
ClickMouse2(True);
repeat
wait(100);
Inc(x);
until(x > WaitTimer);
AntiBan;
x :=0;
FindNormalRandoms;
SuperFailSafe := 0;
end;

begin
Cleardebug;
{$IFDEF SMART}
{$IFDEF SIMBAMAJOR980}
Smart_Server := 40;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
{$ELSE}
SRL_SixHourFix := True;
Smart_FixSpeed := True;
{$ENDIF}
{$ENDIF}
SetupSRL;
DeclarePlayers;
LoginPlayer;
Writeln('Welcome to Digital Ninjas Mud Rune Grind!');
Wait(800);
SetAngle(SRL_ANGLE_HIGH);

repeat //main loop
Bank;
Rind;
until(not(loggedin))
Logout;
end.

Footy

2012-08-28 23:02:05

I can't really view it well on my phone, but to make it only do so many loads, do this:
1. Add a global variable called loads, make it an integer.

2. Add a global constant called loads_to_do. Make it equal to a random number that will be changed by the user depending on his/her needs.

3. Every time you bank, increase loads by how many tunes you've grinded. Assuming its 28, add this to your banking function
Loads := Loads + 28;

4. In your main loop, do this
repeat
Rind;
Bank;
Until(not(loggedin) or (Loads > Loads_to_do));

If you have any questions, feel free to ask!

Rezozo

2012-08-28 23:30:46

Dam, if I still had members, I could try out this script… Miss testing first scripts!

GL, hope this works well!

P1ng

2012-08-29 00:03:56

Looks pretty good, I'm just flicking through your script now.
Congratulations on the release! :)
Here are a few things I have noticed in your banking function.

1. You have made it a function "function Bank: Boolean;" that returns a boolean, but you never have a result for it, and this would function perfectly well just as a procedure the way it is in theory.

2. You have an infinite loop, this is a massive no-no. This allows the possibility for your character to just sit there making bot-like movements forever or until you come and stop it. You need to add some sort of failsafe to this to make sure that you don't sit at the pinscreen trying to enter incorrect numbers because something has failed. Also, I've noticed lately that if a player lags a bit this can often mess up InPin because of some glitch in RS (probably there to screw us up).

3. The method you have for opening the bank is perfectly acceptable and will work, but you should check out using a case statement, much more readable and efficient :)

That's just about it for now, I have an edited version of the procedure here just with comments on bits I'd like you to touch up and an example of a case statement for this scenario :)

function Bank: Boolean;    //why is it a function, you never call result?
begin
SetAngle(SRL_ANGLE_HIGH); //put here instead of in the loops

case BankOption of
0:
begin
repeat
//SetAngle(SRL_ANGLE_HIGH); at the beginning
MakeCompass('N');
OpenBankNPC;
until BankScreen or PinScreen or not (LoggedIn);
end;
1:
begin
repeat
//SetAngle(SRL_ANGLE_HIGH); at the beginning
OpenBankChest(SRL_BANK_SW);
until BankScreen or PinScreen;
end;
end;

if PinScreen then
//begin un-necessary begin
repeat //poential infinite loop
InPin(Players[0].Pin);
until BankScreen or not (LoggedIn);
//end; un-necessary end

if BankScreen then
begin
Wait(RandomRange(200, 300));
InvMouse(2, mouse_Right); //Check out the 'deposit' function
WaitOption('All', 2000);
CloseBank;
Wait(RandomRange(500, 600));
end;
end;

Best of luck with scripting and I hope this helps you out.

digitalninja

2012-08-29 14:01:37

Whoa! Thanks Footy and P1ing for all the feedback … apparently I have a lot more learning to do since I didnt really understand 1/2 the feedback but I can absolutely continue to tweak and update the script!