SRL Archive - First Scripts

Reflection MonsterHunter


Danizho

2010-06-10 00:48:18

My first Simba Script

[PHP]
program new;
{$DEFINE SMART}
{$i srl\srl.scar}
{$i reflection\reflection.simba}
{$i srl\srl\Skill\Fighting.scar}

const //smart setup
SmartWorld = 15; // Which World/Server do you want to use?
SmartMembers = False; // Is it a Members World?
SmartSigned = True; // Signed/UnSigned Client?
SmartSuperDetail = False;

TheSkill = 0 ;

Procedure DeclarePlayers;
begin
HowManyPlayers := 1 ;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with players[0] do
begin
Name := '';
Pass := '';
Active := True;
Pin := '';
Strings[TheSkill] := 'Fishing'; //The skill you want to level up with a lamp
BoxRewards := ['Lamp'];
end;
end;

Procedure DoSomethingElse;
begin
MMouse(800, 800, 0, 0);
Wait(RandomRange(1000, 5000));
end;



//426 range animation

Procedure AntiBan;
begin
Case Random(50) of

0..19 : DoSomethingElse;
20..25 : DoSomethingElse;
26..30 : BoredHuman;
31..40 : Wait (RandomRange(1000, 5000));
41..50 : HoverSkill('random', False);

end;
if FindNormalRandoms then
begin
UseRewardBox;
FindLamp(Players[CurrentPlayer].Strings[TheSkill]);
end;
end;

procedure FindTheNPC;
var
NPCC: TNPC;
OurPoint: TPoint;
begin
If(FindNPC('Zombie',NPCC))then //Zombies…
begin
writeln('Found the monster');
OurPoint := TileToMS(NPCC.Tile, Random(5));
writeln('Attackin…!');
mouse(OurPoint.x,OurPoint.y,2,2,true);
Wait(RandomRange(1000, 5000));
Antiban;

end;
end;


//Something Fighter Procedure //
procedure HpCheck;
var
c, T, i, x, y:Integer;
RunDir: String;
begin
if (HPPercent < 50) and LoggedIn then
begin
Writeln('HP low doing HP checks…');
if not InvEmpty then
for c := 0 to 2 do
begin
for i := 1 to 28 do
if ExistsItem(i) then
begin
MMouseItem(i);
GetMousePos(x, y);
if WaitUptext('Eat', 400) then
begin
Mouse(x,y,0,0,false);
if WaitOption('Eat', 400) then
if (HPPercent > 50) then
Exit;
end;
end;
if (not LoggedIn) or (HPPercent > 50) then
Exit;
end;

if (HPPercent < 50) then
begin
if (HPPercent < 25) then
if (InFight) then
begin
RunDir := 'nsewns';
Writeln('Running away HP% < 25…');
RunAway(RunDir[random(6)+1], true, 1, 10000 + random(2000));
end;
T := GetSystemTime;
repeat
Wait(200+random(200));
FindNormalRandoms;
If ((GetSystemTime - T) > (50000+random(30000)) ) then
begin
case random(2) of
0: BoredHuman;
1: DoSomethingElse;
end;
T := GetSystemTime;
end;
if not LoggedIn then
Exit;
until (HPPercent > 50);
SetAngle(true);
end;
end;
end;

Procedure SetupPlayer;
begin
SetAngle(True);
end;

begin
Smart_Server := SmartWorld;
Smart_Members := SmartMembers;
Smart_Signed := SmartSigned;
Smart_SuperDetail := SmartSuperDetail;
SetupSRL;
SetupReflectionEx(True);
DeclarePlayers;
LoginPlayer;
FindTheNPC;
repeat FindTheNPC
until(False);
end.[/PHP]

any opinions. critics, etc … and, a help with failsafe (its hard to understand) the ranging animation is 426 … but i cant make a good failsafe if the click fails

This is my first step on the long SRL/SImba road
=) :garfield:

Nava2

2010-06-10 00:55:01

It looks good, make it more advanced!

Great job on the standards! :) Thats usually very hard for people to grasp.

Danizho

2010-06-10 01:00:13

Epic Fail… edited. (and account updated :/ )

:facepalm:

DeSnob

2010-06-11 07:09:39

Nice! Looks much better than my first script .. horrible standards.. repeated statements etc. I want to see more from you :p

Danizho

2010-06-12 17:01:08

[PHP]
program new;
{$DEFINE SMART}
{$i srl\srl.scar}
{$i reflection\reflection.simba}
{$i srl\srl\Skill\Fighting.scar}

const //smart setup
SmartWorld = 47; // Which World/Server do you want to use?
SmartMembers = False; // Is it a Members World?
SmartSigned = True; // Signed/UnSigned Client?
SmartSuperDetail = False;

TheSkill = 0 ;

Procedure DeclarePlayers;
begin
HowManyPlayers := 1 ;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with players[0] do
begin
Name := '';
Pass := '';
Active := True;
Pin := '';
Strings[TheSkill] := 'Prayer'; //The skill you want to level up with a lamp
BoxRewards := ['Lamp'];
end;
end;

Procedure DoSomethingElse; // I didnt make this …
begin
MMouse(800, 800, 0, 0);
Wait(RandomRange(1000, 5000));
end;

//Something Fighter Procedure // I didnt make this too
procedure HpCheck;
var
c, T, i, x, y:Integer;
RunDir: String;
begin
if (HPPercent < 50) and LoggedIn then
begin
Writeln('HP low doing HP checks…');
if not InvEmpty then
for c := 0 to 2 do
begin
for i := 1 to 28 do
if ExistsItem(i) then
begin
MMouseItem(i);
GetMousePos(x, y);
if WaitUptext('Eat', 400) then
begin
Mouse(x,y,0,0,false);
if WaitOption('Eat', 400) then
if (HPPercent > 50) then
Exit;
end;
end;
if (not LoggedIn) or (HPPercent > 50) then
Exit;
end;

if (HPPercent < 50) then
begin
if (HPPercent < 25) then
if (InFight) then
begin
RunDir := 'nsewns';
Writeln('Running away HP% < 25…');
RunAway(RunDir[random(6)+1], true, 1, 10000 + random(2000));
end;
T := GetSystemTime;
repeat
Wait(200+random(200));
FindNormalRandoms;
If ((GetSystemTime - T) > (50000+random(30000)) ) then
begin
case random(2) of
0: BoredHuman;
1: DoSomethingElse;
end;
T := GetSystemTime;
end;
if not LoggedIn then
Exit;
until (HPPercent > 50);
SetAngle(true);
end;
end;
end;

Procedure AntiBan;
begin
Case Random(100) of
0..20 : HpCheck;
21..89 : Wait(RandomRange(1000,3000));
90..95 : DoSomethingElse;
96..97 : BoredHuman;
98..100 : HoverSkill('random', False);
end;
if FindNormalRandoms then
begin
UseRewardBox;
FindLamp(Players[CurrentPlayer].Strings[TheSkill]);
end;
end;

//426 animation
function IsRangin:boolean; // trying a failsafe
var
Me : tme;
begin
me := GetMe;
if(Me.Animation=426)then
result := true;
if not (Me.Animation=426) then
result := false;
end;


procedure FindTheNPC;
var
NPCC: TNPC;
OurPoint: TPoint;
begin
If(FindNPC('Zombie',NPCC))then //Zombies…
begin
writeln('Found the monster');
OurPoint := TileToMS(NPCC.Tile, Random(5));
writeln('Attackin… Time : ' + TimeRunning);
mouse(OurPoint.x,OurPoint.y,2,2,true);
end;
end;

Procedure RangeIt;
begin
repeat FindTheNPC;
until (IsRangin = false); // trying a failsafe
end;

Procedure SetupPlayer;
begin
SetAngle(True);
end;

begin
Smart_Server := SmartWorld;
Smart_Members := SmartMembers;
Smart_Signed := SmartSigned;
Smart_SuperDetail := SmartSuperDetail;
SetupSRL;
SetupReflectionEx(True);
DeclarePlayers;
LoginPlayer;
RangeIt;
repeat RangeIt // :S confused u.u
until(false);
end. [/PHP]

Trying a failsafe but… fail

masterBB

2010-06-13 14:43:04

[PHP]function IsRangin:boolean; // trying a failsafe
var
fails:Integer;
begin
repeat
wait(200);
if(GetAnimation = -1) then
fails := fails +1;
if(GetAnimation > 0) then
break;
until(fails > 4);
Result := not(fails > 4);
end;
[/PHP]

Between every animation there is a small period of -1.