SRL Archive - First Scripts

(FirstScript)Goblin Decimator!


Joepetey

2012-04-21 16:04:38

My first script :garfield:

Please test and review version 0.1!







program GoblinDecimator;

{$DEFINE SMART}
{$i SRL/srl.simba}


Const

//SRL Stats
SRLStats_Username = '';
SRLStats_Password = '';

//Break settings
BreakIn = 180; //How long before we take a break? (minutes)
BreakFor = 13; //How long will we break for? (minutes)
Bir = 7; //Random minutes to add/subtract from how long until we break
Bfr = 3; //Random minutes to add/subtract from break duration

Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := '';
Pass := '';
Pin := '';
BoxRewards := ['XP','xp','lamp'];
LampSkill := Skill_Runecrafting;
Active := True;
end;
end;

procedure StatsGuise(wat:String);
Begin
Status(wat);
Disguise(wat);
End;


Procedure Antiban;
Begin
Case Random(192) Of
0: HoverSkill('Attack', False);
1: Begin PickUpMouse; SleepAndMoveMouse(3000 + Random(500)); End;
2: RandomAngle(1);
3: Begin GameTab(Tab_Stats); Wait(3000 + Random(500)); GameTab(Tab_Inv); End;
4: HoverSkill('random', False);
5: HoverSkill('Defense', False);
6: HoverSkill('Constitution', False);
7: HoverSkill('Strength', False);
End;
End;

Procedure FailSafe(Reason:String);
begin
Players[CurrentPlayer].Loc:=Reason;
Logout;
TerminateScript;
end;


function InFight: Boolean;
begin
Result := srl_InFight;
end;

Function AttackGoblins:Boolean;
Var
x,y:Integer;
begin
SetAngle(SRL_ANGLE_HIGH);
if InFight then
begin
repeat
FindNormalRandoms;
until ((not LoggedIn) or (not InFight))
end;
If FindObjEx(x,y, ['Attack'], [4430477, 4033671, 1858905, 3253129], 10, 50, 1, 5, 690, 400) then
Begin
StatsGuise('Attacking Goblin');
GetMousePos(x,y);

Case Random(1) of
1:begin
Mouse(x,y,5,5,True);
ChooseOption('Attack')
end;
End;
End;
end;



begin
SetupSRL;
DeclarePlayers;
SetAngle(SRL_ANGLE_HIGH)
if not (LoggedIn) then
LoginPlayer;
Wait(4000+random(400))

repeat
Antiban;
AttackGoblins;
until(false);

end.



Credit to Gucci for goblin finding method.

NKN

2012-04-22 11:39:09

Nice script, you considered adding banking for the low levels, it could be a great way to train new leveled accounts?

Joepetey

2012-04-22 19:13:41

Thank you for testing, were there any bugs?
Im gonna add banking as soon as I learn how to, but its harder than it looks.

Gucci

2012-04-22 19:31:12

Banking isn't really needed and here they do the same thing:

    Case Random(2) of
0:Mouse(x,y,5,5,True); // This left clicks
1:begin
Mouse(x,y,5,5,True); // This left clicks
ChooseOption('Attack')

Also this is straight out of my script

If FindObjEx(x,y, ['Attack'], [4430477, 4033671, 1858905, 3253129], 10, 50, 1, 5, 690, 400) then

You only changed the tolerance…. same colors and other parameters etc, some credits maybe?

Joepetey

2012-04-22 19:37:01

Sorry forgot to credit you just have been really busy. Will do right now and thanks for the tip.

Gucci

2012-04-22 19:41:41

From: Joepetey
Sorry forgot to credit you just have been really busy. Will do right now and thanks for the tip.


Yeah no problem and thanks for the credit also you have breaking constants at the top of your script that aren't used might as well delete those

tehq

2012-04-22 19:53:51

Here's a version with fixed up standards to make it easier to read. Also, the result is not used from your AttackGoblins: boolean;


program GoblinDecimator;

{$DEFINE SMART}
{$i SRL/srl.simba}


Const

//SRL Stats
SRLStats_Username = '';
SRLStats_Password = '';

{Break settings
BreakIn = 180; //How long before we take a break? (minutes)
BreakFor = 13; //How long will we break for? (minutes) //not used
Bir = 7; //Random minutes to add/subtract from how long until we break
Bfr = 3; //Random minutes to add/subtract from break duration }

Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := '';
Pass := '';
Pin := '';
BoxRewards := ['XP','xp','lamp'];
LampSkill := Skill_RUNECRAFTING;
Active := True;
end;
end;

Procedure StatsGuise(wat:String);
Begin
Status(wat);
Disguise(wat);
End;

Procedure Antiban;
Begin
Case Random(192) Of
0: HoverSkill('Attack', False);
1: Begin PickUpMouse; SleepAndMoveMouse(3000 + Random(500)); End;
2: RandomAngle(1);
3: Begin GameTab(Tab_Stats); Wait(3000 + Random(500)); GameTab(Tab_Inv); End;
4: HoverSkill('random', False);
5: HoverSkill('Defense', False);
6: HoverSkill('Constitution', False);
7: HoverSkill('Strength', False);
End;
End;

Procedure FailSafe(Reason:String);
begin
Players[CurrentPlayer].Loc := Reason;
Logout;
TerminateScript;
end;

Function InFight: Boolean;
begin
Result := srl_InFight;
end;

Function AttackGoblins:Boolean;
Var
x, y:Integer;
begin
SetAngle(SRL_ANGLE_HIGH);
if InFight then
begin
repeat
FindNormalRandoms;
until (not LoggedIn) or (not InFight);
end;
If FindObjEx(x,y, ['Attack'], [4430477, 4033671, 1858905, 3253129], 10, 50, 1, 5, 690, 400) then
Begin
StatsGuise('Attacking Goblin');
GetMousePos(x,y);
Case Random(1) of
1 :
begin
Mouse(x, y, 5, 5, mouse_right);
ChooseOption('Attack');
end;
End;
End;
end;


begin
SetupSRL;
DeclarePlayers;
SetAngle(SRL_ANGLE_HIGH)
if not (LoggedIn) then
LoginPlayer;
Wait(4000 + Random(400));
repeat
Antiban;
AttackGoblins;
until(false);
end.

P.S. Great job on your first script!

Joepetey

2012-04-22 19:57:46

Thank you for testing, and thanks for fixing it up for me:D