SRL Archive - First Scripts

Ivy Chopper


farmer jack

2012-01-20 01:26:28

Hey guys, this is my first script, its an extremely basic ivy chopper, just thought i'd get some practice and would appreciate any feedback.

Whilst it is basic it still does a decent job and contains sufficient(to my knowledge) antiban, Progress reports are appreciated so if you could swing one my way would be good. This was only my first practice script so i don't plan on changing much to it unless someone requests.. e.g. perhaps an option to avoid the 6 hour logout.

Instructions for running
- place your character right next to an ivy spot, preferably one north of your character, though other ones may also work though they are untested, I used the Ivy on the south castle wars wall, so duel rung to castle wars and run south a little.
- in the code replace username and password
- in the code replace nickname with 4 consecutive letters out of your runescape characters name
- press run and wait for smart to start up and it should
Cheers

program New;
{$i srl/srl/misc/smart.simba}
{$i srl/srl.simba}
var
AntibanUsed, startexp, currentexp: integer;
stop: boolean;


Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name :='username';
Players[0].Pass :='password';
Players[0].Nick :='jnickname';
Players[0].Active:=True;
Smart_Server := 0;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;
loginplayer;
stop:= false
startexp:= GetXPBarTotal

end;

Procedure ChopIvy;
var
x, y: Integer;
Begin;

x:=MSCx
y:=MSCy

If FindObjTPA(x, y, 5477747, 5, 1, 10, 10, 10, ['hop']) Then
Begin
Writeln('Colour found, chopping ivy.....')
Case Random(8) of
0: Begin
Mouse(x, y, 5, 5, False);
WaitOption('Chop', 200);
End;
Else
Mouse(x, y, 5, 5, true);

End;
End
else
begin
Writeln('Colour not found.');
Writeln('Logging out.');
logout;
stop:= true
End;
End;

Function Chopping: integer;
var
cutting: TBox;
Begin
cutting := IntToBox(245, 130, 285, 195);
Result := AveragePixelShift(cutting, 250, 750)
End;
Procedure AntiBan;
Begin
If(not(LoggedIn))Then
Exit;
case Random(300) of
0:
begin
HoverSkill('Woodcutting', false);
wait(Random(1000));
inc(AntibanUsed);
end;
1:
begin
PickUpMouse;
inc(AntibanUsed);
end;
2:
begin
MakeCompass('N');
wait(100+random(133));
MakeCompass('S');
wait(50+random(133));
MakeCompass('N');
inc(AntibanUsed);
end;
3: Begin PickUpMouse; SleepAndMoveMouse(3000 + Random(500));
inc(AntibanUsed);
End;
4: Begin GameTab(Tab_Stats); Wait(3000 + Random(500)); GameTab(Tab_Inv);
inc(AntibanUsed);
End;

end;
end;

procedure Report;
begin
ClearDebug;
currentexp:= GetXPBarTotal
WriteLn('++++++++++++++++++++++++++++++++++++');
WriteLn(Padr('AntiBans: ' + IntToStr(AntiBanUsed), 67));
WriteLn(Padr('EXP Gained: ' + IntToStr((currentexp - startexp)), 67));
Writeln('Ran for: '+ TimeRunning);
WriteLn('++++++++++++++++++++++++++++++++++++');
end;

begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
repeat
if Chopping <300 then
begin
ChopIvy;
Report
wait(750+random(250))
end else
begin
wait(50);
Antiban
end;
until(stop= true)
end.

Borland

2012-01-20 01:46:17

Exp gained:

Record the exp bar, or skill exp at the start of the script, then everytime you want to check exp gained you subtract the starting exp from the current exp.

ExpGained = GetXPBarTotal - Starting Exp

-
Script is a decent starting point, needs more failsafes and standards could be improved. Make sure there's white space between functions & procedures, little things like that, the rest you'll pick up naturally.

Good luck.

farmer jack

2012-01-20 03:22:26

thanks for the help, worked well, however another question.. do you know the code to exit the script?

I actually reckon that one fail-safe might be the only one it needs.

Flight

2012-01-20 03:40:41

Looks nice bud, congratulations on you first script. :) I don't see anything about birds nest searching, have you considered adding that? It might prove to be a bit more challenging but if you can pull it off then you'll have that much more knowledge on scripting. :) Best of luck to you!

Borland

2012-01-20 05:50:00

To stop the script use
TerminateScript;

Just make sure that if you wish to log the player out you have to call 'Logout;' before terminating, the script can't log the player out AFTER it's terminated now can it :)

And yeah, try your hand at finding & looting nests. I'll be pretty interested to see what method you come up with.

For the simple things like reports/proggies & logout procedures it's perfectly fine to look at other scripts for reference, as long as the main part of the script (such as finding the ivy, chopping it) was your own original idea, no one will complain.

Keep going :thumbsup: