SRL Archive - First Scripts

Test AutoCurser


zertunami

2008-08-15 22:38:02

I put together this little script for some much needed practice in SCAR scripting. Obviously not a very great script, but whatever:) Tell me anything that should/could be included within the script. All constructive criticism and help is appreciated.

program Auotcurser;
{.include srl/srl.scar}
{.include srl/srl/skill/magic.scar}

Const
Spells = 3;// how many times you want it cast?

Var
Ax, Ay, i : Integer;

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


Players[0].Name := ''; // Username.
Players[0].Pass := ''; // Password.
Players[0].Nick := ''; // 2-4 letters of Username (that are not capital letters or numbers).
Players[0].Active := True;
end;

Procedure OnceloggedIn;

Begin
makecompass('w');
setAngle(true);
end;

Procedure CastCurse;

Begin
Begin
i:=0
GameTab(7);
Wait(500+Random(600))
Cast('curse');
wait(1000+random(500))
;FindObjCustom(Ax, Ay, ['onk, orak'], [3752096], 10)
Mouse(Ax, Ay, 4, 4, true);
i:=i+1
wait(1000+random(3000))
If i = Spells Then
Logout;
end;
end;


Procedure Logsout;
Begin
If (i=Spells) Then WriteLn('Finished casting spells... logging out...');
Logout;
end;

Procedure Randoms;
Begin
FindNormalRandoms;
end;

Procedure AntiBan;
begin
case random(100) of
0: RandomRClick;
1: BoredHuman;
2: HoverSkill('Magic', False);
3:
Begin
Logout;
Writeln('Status : Sleeping for a few minutes')
Wait(60000+random(300000))
LoginPlayer;
End;
4: PickUpMouse;
end;
end;


Procedure Proggy;
Begin
WriteLn('[-------------------------------------]')
WriteLn('[-----Zertunami"s Test AutoCurser-----]')
WriteLn('[-------------------------------------]')
WriteLn('[ Ran for ' + TimeRunning + ' ]')
WriteLn('[ Cast ' + IntToStr(i) + ' Curses ]')
WriteLn('[-------------------------------------]')
End;

Begin
SetupSRL;
DeclarePlayers;
ActivateClient;
LoginPlayer;
OnceloggedIn;
repeat
CastCurse;
until(i=Spells)
Randoms;
AntiBan;
Logsout;
Proggy;
end.

Procedure FeedBack;
Begin
WriteLn(' Please send me a message about any advice, bugs, suggestions,etc... about the script. Thanks!');
end;

0wn 4 skill

2008-08-18 19:38:16

Your procedure FeedBack needs to go before the mainloop before you can call it. Otherwise, a very good start. Needs some standards however!

Rune Hacker

2008-08-19 20:36:19

Yeah, good start but look up some tutorials on correct standards, maybe work on a more elaborate anti-randoms and anti-ban functions, see if there are any spots failsafes can be put into place, and add multiplayer support since it looks like it only supports one player.

One big problem though!! You want to put Randoms, AntiBan, and probabaly Proggy inside your main loop.

Goobs

2008-08-24 02:41:42

you have it repeat, casting, then do anti randoms after you're done working the script O.o

Let me explain…

You have:

 repeat
CastCurse;
until(i=Spells)
Randoms;
AntiBan;

When you should have…

  repeat
CastCurse;
Randoms;
AntiBan;
until(i = Spells)

I hope it helps =\

ShowerThoughts

2008-08-24 05:25:54

If (i=Spells) Then WriteLn('Finished casting spells… logging out…');

The best is >= because you could also do more ;) >= or => not sure?
But if you do = it could be running for ever without runes ;)

Goobs

2008-08-24 16:16:27

True, because if it miscounts even once and goes over, you've got some problems.

With the one I made, I make it look for the Cast spell with a DTM, and would log off when it couldn't cast anymore (hence no more runes)

But yeah, using >= would ensure that when it is more than or equal to Spells, then it would stop.

<3 Hermpie

Enchanted

2008-08-28 06:00:07

Hey, I've modified your script a tiny bit just to what other peoples recommendations were and I've also added SMART for you. :rolleyes:.

program Auotcurser;
{.include SRL/SRL/Misc/Smart.scar}
{.include srl/srl.scar}
{.include srl/srl/skill/magic.scar}

const
Spells = 3; // how many times you want it cast?
World = 'world29'; //World that SMART enters .
Signed = true; //Client signed or unsigned . I prefer signed .

var
Ax, Ay, i: Integer;

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


Players[0].Name := ''; // Username.
Players[0].Pass := ''; // Password.
Players[0].Nick := ''; // 2-4 letters of Username (that are not capital letters or numbers).
Players[0].Active := true;
end;

procedure OnceloggedIn;
begin
makecompass('w');
setAngle(true);
end;

procedure CastCurse;
begin
begin
i := 0 GameTab(7);
Wait(500 + Random(600))
Cast('curse');
wait(1000 + Random(500));
FindObjCustom(Ax, Ay, ['onk, orak'], [3752096], 10)
Mouse(Ax, Ay, 4, 4, true);
i := i + 1 wait(1000 + Random(3000)) if i = Spells then Logout;
end;
end;


procedure Logsout;
begin
if (i = Spells) then
Writeln('Finished casting spells... logging out...');
Logout;
end;

procedure Randoms;
begin
FindNormalRandoms;
end;

procedure AntiBan;
begin
case Random(100) of
0:
RandomRClick;
1:
BoredHuman;
2:
HoverSkill('Magic', false);
3:
begin
Logout;
Writeln('Status : Sleeping for a few minutes')
Wait(60000 + Random(300000))
LoginPlayer;
end;
4:
PickUpMouse;
end;
end;


procedure Proggy;
begin
Writeln('[-------------------------------------]')
Writeln('[-----Zertunami"s Test AutoCurser-----]')
Writeln('[-------------------------------------]')
Writeln('[ Ran for ' + TimeRunning + ' ]')
Writeln('[ Cast ' + IntToStr(i) + ' Curses ]')
Writeln('[-------------------------------------]')
end;

begin
SmartSetup(World, false, Signed, false);
SetTargetDC(SmartGetDC);
SetupSRL;
DeclarePlayers;
ActivateClient;
LoginPlayer;
OnceloggedIn;
repeat
CastCurse;
Randoms;
AntiBan;
until (i = Spells)
Logsout;
Proggy;
end.procedure FeedBack;
begin
Writeln(' Please send me a message about any advice, bugs, suggestions,etc... about the script. Thanks!');
end;

bloodyhell321

2008-09-24 07:49:29

Pretty nice, but needs standards :o