SRL Archive - First Scripts

Power Chopper


topiser

2008-05-08 21:56:22

Well i edited it, now it actually works well on chopping. If someone doesn't mind could they fix the progress report and anything else they find that doesn't work.xD
program Chopper;
program Chopper;
{.include SRL/SRL/Misc/Smart.scar}
{.include srl/srl.scar}
//Just fill in your username,pass,nick and run,make sure u have an axe out and are near trees
//only drops inv slots 6-28
// and if u can't read whats before these comments it uses SMART O.o
var
clicks:integer;

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

Players[0].Name := 'username';
Players[0].Pass := 'password';
Players[0].Nick := 'nick';
Players[0].Active := True;
end;

procedure progressreport;
begin
Writeln('[]========================================[]');
Writeln('---------------->Power chopper<----------------');
Writeln(' Did ' + IntToStr(Clicks) + ' Clicks' + ' ');
Writeln('[]========================================[]');
Wait (10000)
end;

procedure Clicked;
begin
ClickMouse(5, 5, false);
Clicks := Clicks + 1;
end;


procedure Chop;// works now
var
x, y : integer;
Begin
If (LoggedIn) then
begin
if FindObjTPA(x,y,3496308,20,-1,7,7,15,['ree']) then
begin
Wait(2000 + Random(425));
Mouse(x,y,0,0,false);
Wait(200 + Random(225));
chooseoption('hop')
Wait(4000+ Random (253));
If not (LoggedIn) then
Login;
LoginPlayer
end;
end;
end;

Procedure drop;

var
i: Integer;
Begin
If (LoggedIn) then
begin
Gametab(4);
For i := 6 to 28 do

If ExistsItem(i) then
DropItem(i);
If not (LoggedIn) then
Login;
LoginPlayer
end;
end;

Procedure AntiRandom;
begin
If(FindFight)then
RunAway('E', True,1,4230);
FindNormalRandoms;
FindLamp('Woodcutting');
end;

procedure AntiBan;
begin
case Random(100 + 523) of
1: RandomRClick;
2: DoEmote(523 +Random(183));
3: RandomMovement;
4: BoredHuman;
end;
end;



Procedure Mainloop;
begin
smartSetup('mn3', False, True);
While Not (SmartReady) Do
Wait(100);
SetTargetDC(SmartGetDC);
If Not (LoggedIn) Then
While Not (SmartGetColor(386, 249) = 65535) Do
Wait(100);
SetupSRL;
Login;
ActivateClient;
LoginPlayer
If (InvFull) Then
drop;
Antiban;
Repeat;
Chop;
Progressreport;
If (InvFull) Then
drop;
Until(false)
end;

begin
Mainloop;
end.


Since no one is bothering fixing it up I needed feathers so i made a chiken fighter. I just edited the chopper to fit a chicken fighter.
program Chopper;
{.include SRL/SRL/Misc/Smart.scar}
{.include srl/srl.scar}
//it uses SMART

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

Players[0].Name := 'username';
Players[0].Pass := 'password';
Players[0].Nick := 'nick';
Players[0].Active := True;
end;

procedure loot;
var
x, y : integer;
Begin
If (LoggedIn) then
begin
if FindObjTPA(x,y,12237507,20,-1,7,7,15,['eather']) then
begin

Mouse(x,y,0,0,false);
Wait(100 + Random(225));
chooseoption('ake')
Wait(400+ Random (253));// alter if your character isn't running
If not (LoggedIn) then
Login;
LoginPlayer
end;
end;
end;

procedure fight;
var
x, y : integer;
Begin
If (LoggedIn) then
begin
if FindObjTPA(x,y,1055610,20,-1,7,7,15,['hicken']) or FindObjTPA(x,y,1187465,20,-1,7,7,15,['hicken']) or FindObjTPA(x,y,1121410,20,-1,7,7,15,['hicken'])then
begin
Mouse(x,y,0,0,false);
Wait(200 + Random(225));
chooseoption('ttack')
Wait(300+ Random (253));// alter depending how fast character kills
If not (LoggedIn) then
Login;
LoginPlayer
end;
end;
end;

procedure FindRandoms;
begin
LampSkill := 'Strength';
FindNormalRandoms;
if FindFight then RunAway('N',True,1,15000);
end;

procedure AntiBan;
begin
if not LoggedIn then Exit;
case Random(30) of
1: RandomRClick;
2: HoverSkill('Woodcutting', False);
3: RandomMovement;
4: BoredHuman;
5: AlmostLogout;
end;
end;




Procedure Mainloop;
begin
smartSetup('mn3', False, True);
While Not (SmartReady) Do
Wait(100);
SetTargetDC(SmartGetDC);
If Not (LoggedIn) Then
While Not (SmartGetColor(386, 249) = 65535) Do
Wait(100);
SetupSRL;
Login;
ActivateClient;
LoginPlayer
Repeat;
fight;
loot;
Until(false)
end;

begin
Mainloop;
end.
Hope someone actually likes it xD

totoro

2008-05-09 02:47:43

what do you do with the nick??

Nava2

2008-05-09 08:05:43

If you want a simple way to stop it from chopping dead trees; do:



procedure ChopnWait;
begin
FindColorSpiralTolerance(x, y, COLOR, MSX1, MSY1, MSX2, MSY2, 6);
MMouse(x, y, 3, 3);
result:= IsUpText('hop');
if result then
begin
Mouse(x, y, 0, 0, true);
repeat
Wait(100+random(50));
until not FindColorSpiralTolerance(x, y, COLOR, x+10, y+10, x-10, y-10, 6);
end;
end;

That might work; never tried it but yeah :) all that does is wait until it cant find the color 10 in a box defined 10 pts around the where the color was found.

Hope I helped.

Nava2

topiser

2008-05-09 16:18:10

Thanks for the help but it doesn't work :( I'm still trying at the moment and i'm not gonna bother copying some1 chop procedure from a workign script cause i wanna learn not copy xD

Sir R. M8gic1an

2008-05-09 17:45:32


if not IsUpText('Dead') then

should solve your dead tree problem :)

nice first script

~RM

topiser

2008-05-09 18:19:20

Nvm thanks for making the TPA tut Rasta.Now i got the script to work xD

opensourcev2

2008-05-09 23:41:23

Great first scripts lol

Crow

2008-05-11 13:09:56

i got a problem. everytime i use Smart, scar exits itself.

topiser

2008-05-14 18:01:25

not sure what your problem is but if you want to run it without smart then remove the lines:
{.include SRL/SRL/Misc/Smart.scar} in the beggining and

smartSetup('mn3', False, True);
While Not (SmartReady) Do
Wait(100);
SetTargetDC(SmartGetDC);
If Not (LoggedIn) Then
While Not (SmartGetColor(386, 249) = 65535) Do
Wait(100);

at the end of the script.Hope that helps.

FreakyMonkey

2008-05-14 18:19:16

good first attempt but make sure u put in failsafes for ur functions. a lotta unstable functions like Mouse need backup failsafes in case of failure

slackeru

2008-05-16 16:57:47

pretty good but mess up finding a tree sometimes then it starts to drop when i dont even got full inv., but OK :)