SRL Archive - First Scripts

ARRLN's Feather Farmer


a really really long name

2008-06-02 19:51:55

woot first script… hope it works :(
mainly i want help on the fight… the best i know to do is to just put a wait for killing :p



4th try lol
{-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-)
( ---------------I'm new to SRL, and hopefully, this--------------- )
( ----------------will be my first functional script--------------- )
(-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-)
( ------ v1: Features: Chicken finder------------------------------ )
( ---------------------Feather picker------------------------------ )
( ---------------------Multiplayer--------------------------------- )
( ---------------------Antiban------------------------------------- )
(-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-)
( Lines of Setup: 20-27,32-43-------------------------------------- )
(-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-}

{.include SRL/SRL.scar}
{.include SRL/SRL/Skill/Fighting.scar}
program FeatherFarmer;

var
i,x,y,k,f
FeatherDTM, feathertext, chickenkills, antibans: integer

const
Timebeforeswitch = ''; //in miliseconds
MySRLID = '';
MySRLPassword = '';
chickencolor1 = ''; //crest
chickencolor2 = ''; //dark shadow
chickencolor3 = ''; //another dark shadow


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

Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active :=True;

Players[1].Name :='';
Players[1].Pass :='';
Players[1].Nick :='';
Players[1].Active :=True;

end;

Procedure AntiRandoms;
Begin
Status('Doing AntiRandoms');
for i:=0 to 3 do
begin
FindNormalRandoms;
Wait(30+random(50));
end;
end;


procedure Antiban;
begin
if not LoggedIn then Exit;
case Random(68) of
0:
begin
HoverSkill('Hitpoints', False);
Antibans:=Antibans+1;
end;
1:
begin
HoverSkill('Defence', false);
Antibans:=Antibans+1;
end;
2:
begin
GameTab(1 + Random(12));
wait(800 + random(500));
GameTab(4);
Antibans:=Antibans+1;
end;
3:
begin
BoredHuman;
Antibans:=Antibans+1;
end;
end;


Procedure LoadDTM;
begin

FeatherDTM := DTMFromString('78DA630C60606030634001AC1A6C609A11CA6' +
'70C0412A6A86AB6AE5A89AAC60753CDCEF5EB50D5780209735435' +
'270F1D4455E30B242C08A809C4547374EF5E5435C184FD0500665' +
'30F0E');
end;

procedure findfeather;
if (FindDTM(FeatherDTM: x, y, MSX1, MSY1, MSX2, MSY2)then
begin
wait(800 + random(600));
Mouse(x, y, 2, 2, True);
break
end else
f:=f+1
end;

procedure chickenfight;
begin
Antirandoms;
if NotLoggedIn then exit
case Random(3) of

1:
Begin
if FindColorSpiralTolerance(x, y, chickencolor1, MSX1, MSY1, MSX2, MSY2, 15) then
Mouse(x, y, 2, 2, True);
end else
writeln('cannot find chicken...attempting again');
k:= k + 1
if k > 10 then writeln('chickens out of range...stopping script');
break else
chickenfight;
end;


2:
Begin
if FindColorSpiralTolerance(x, y, chickencolor2, MSX1, MSY1, MSX2, MSY2, 15) then
Mouse(x, y, 2, 2, True);
end else
writeln('cannot find chicken...attempting again');
k:= k + 1
if k > 10 then writeln('chickens out of range...stopping script');
break else
chickenfight;
end;

3:
Begin
if FindColorSpiralTolerance(x, y, chickencolor3, MSX1, MSY1, MSX2, MSY2, 15) then
Mouse(x, y, 2, 2, True);
end else
writeln('cannot find chicken...attempting again');
k:= k + 1
if k > 10 then writeln('chickens out of range...stopping script');
break else
chickenfight;
end;
end;

wait(9999 + 1 + random(5000));

repeat
findfeather;
if f > 5 then break
until(false)

chickenkills:= chickenkills + 1

end;


procedure Proggy;
begin
cleardebug;
writeln('+++++++++++++++++++++++++++++++++++++');
writeln('Killed ' +IntToStr(chickenkills)+' Chickens!');
writeln('Performed ' +IntToStr(Antibans)+ ' Antibans');
writeln('Ran for ' +TimeRunning);
writeln('+++++++++++++++++++++++++++++++++++++');
end;

procedure SRLStats;
begin
SRLID := MySRLID;
SRLPassword := MySRLPassword;
end;



begin
SetupSRL
SRLStats;
repeat
AntiRandoms;
Antiban;
LoadDTM;
k:=0
f:=0
chickenfight;
Antiban;
FreeDTM(FeatherDTM);
Proggy;
Until(timerunning:=TimeBeforeSwitch)
If TimeRunning:=TimeBeforeSwitch then
begin
NextPlayer(true)
timerunning:=0
end;
end.

FreakyMonkey

2008-06-02 20:10:28

Hey I have a lot to comment on. Some things are REALLY necessary in this script of yours.

1:
begin
//OMFG NO SETUPSRL!
DeclarePlayers;
AntiRandoms;
Antiban;
LoadBitmap;
ColorPicker;
chickenfight;
Proggy;
SRLStats;//<==Should probably go right after setupsrl
end.

2:
Procedure ColorPicker;
begin

chickencolor1:= ; //pick from crest
chickencolor2:= ; //pick from darkest shadow
chickencolor3:= ; //pick another from shadow

end;

Why didn't you put this in the consts? Much easier to find for the user.

3:
Begin
if FindColorSpiralTolerance(x, y, chickencolor3, MSX1, MSY1, MSX2, MSY2, {tol}) then//<==Why the hell did you put {tol}?
Mouse(x, y, 2, 2, True);
end;

I saw your post in the scripting help section and I know exactly why you did that. ItsChris put that {tol} there for you to put in a NUMBER. Lol. The lower the tolerance the less the function will vary the colors and vice versa.

4:
Procedure AntiRandoms;
Begin
Status('Doing AntiRandoms');
for i := 0 to 2 do
FindNormalRandoms;
FindNonInventoryRandoms;
wait(1);//You could probably extended this by a lot of milliseconds
end;

All you need to do is this:

Procedure AntiRandoms;
Begin
Status('Doing AntiRandoms');
for i:=0 to 3 do
begin
FindNormalRandoms;//FindNormalRandoms finds ALL randoms solved so far.
Wait(30+random(50));
end;
end;

5:
begin
DeclarePlayers;
AntiRandoms;
Antiban;
LoadBitmap;
ColorPicker;
chickenfight;
Proggy;
SRLStats;
end. //now tell me how badly i screwed that up ^.^

You didn't put a repeat/until function for this? o.0. How will the script repeat killing chickens or will it kill one and stop lol XD.

6:
Procedure LoadBitmap;
begin

feather := BitmapFromString(11, 5, 'beNpjYMAEm1esACJM8Z3r12' +
'1bsxqCtq5aCURwqT2bNgERqwYbVnTy0EEIOnHgABAd3rULGaHZAlR' +
'2fP8+IDq6dy8QgYQAjSA4BQ==');

end;

Haha, for this you probably don't need to define just ONE bitmap in ONE procedure :p . UNLESS you are planning to add other bitmaps later.

7:
Also I only see one event in which you actually USE the bitmap..

if FindBitmapToleranceIn(feather, x, y, MIX1, MIY1, MIX2, MIY2, {tol}) then
Mouse(x, y, 2, 2, True);

If you only use it once MAKE SURE that you free the bitmap by using this function

FreeBitmap(Feather);

Those are most of my comments that I can think of right now. If you have further trouble PM me so I can give you my MSN. BTW the most important thing you can do right now is work on your failsafes. You have absolutely none right now. What if the user's computer lags? What if it can't find the bitmap or color? You needa consider this when you script thats what makes an excellent scripter.

PS: The thing I liked most about your script was its neatness. Keep it up!

PPS: I think you should actually see if the script compiles before you post it lol :p

~Rep me if I helped.

a really really long name

2008-06-02 20:34:24

thanks a lot ^.^
soon i will have a functional script lol…

about the bitmaps im thinking about it…mayb add optional cooker and/or buryer

btw is 100 a good tol?

plus i put in the repeat after lol… didnt realize it at first =P
is that how to set a time?

FreakyMonkey

2008-06-02 20:37:02

haha, thanks I put like 10 minutes into that :p. I suggest that you use DTMs for the feathers. Honestly about adding the cooker and buryer I think that you should first develop your current script to a more advanced level and then expand what it does.

And for the tolerance 250 is for inventory items and roughly 5-15 for main screen object finding.

a really really long name

2008-06-02 21:54:16

lol srry but what are DTMs…

btw, im not thinkin about buryer/cooker just yet
i went the featherer to work first

edit: alright edited in something where if it cant find a chicken after ten tries it closes…cant really add failsafes to feather being you dont always get them

FreakyMonkey

2008-06-03 18:06:07

Its true that feathers are not always dropped but you can always double check, so if it doesnt find the bitmap after 5 searches, a feather wasn't dropped. If you want to know what a DTM is read this tut hereor here. Its very in depth about DTMs. If not, search for different tuts.

a really really long name

2008-06-04 17:43:12

alright seems like i worked all the kinks out of it other than the whole begin thing >.<

sk8boyrider55

2008-06-04 18:12:16

Very good for a first script,, now i dont have to get the feathers my self;)

a really really long name

2008-06-04 18:44:26

lol…it doesnt work yet

not for me at least

epichalfblud

2008-06-10 15:46:13

Its Ok

a really really long name

2008-06-28 01:45:08

i just rlly want help figuring out the begin thing…does it actually WORK at all for any1?

sirlaughsalot

2008-06-28 10:48:26

 
var
i,x,y,k,f
FeatherDTM, feathertext, chickencolor1, chickencolor2,
chickencolor3, chickenkills, antibans: integer

const MySRLID = '';
const MySRLPassword = '';
const chickencolor1 = ''; //crest
const chickencolor2 = ''; //dark shadow
const chickencolor3 = ''; //another dark shadow

First of all you dont need to set up th constants like that


Const
MySRLID = '';
MySRLPassword = '';
chickencolor1 = ''; //crest
chickencolor2 = ''; //dark shadow
chickencolor3 = ''; //another dark shadow

Also you have the chickencolors as both variables and constants, you cannot do that =D


procedure SRLStats;
begin
SRLID := MySRLID;
SRLPassword := MySRLPassword;
end;
Im not 100% on this but i think its the other way around…


begin
SetupSRL
SRLStats;
repeat
AntiRandoms;{sprinkle these procedures throughout the script, you can put procedures you made into other procedures}
Antiban;
LoadBitmap;//you changed this to "LoadDTM" hehe
ColorPicker;//this is no longer a procedure
k:=0//if you keep having it repeat this then it will always =1
f:=0
chickenfight;
FreeDTM(FeatherDTM);
until(TimeRunning:=60)//idk wtf this is ill explain something better below
Proggy;//put it in the main loop so people can see how they are doing
end.

okay i made most of the comments in there, about the "until(TimeRunning:=60)" the one problem is that it will only =60 once, so unless you declare it to =0 and im not sure if you can do that lol, if you cant then use timemark and whatnot…


Until(timerunning:=TimeBeforeSwitch)//have a constant that people can use at the beginning
If TimeRunning:=TimeBeforeSwitch then
begin
NextPlayer(true)//Something like that for multiplayer
timerunning:=0 //idk if you can do that
//you might want to put your main loop in a procedure just for this reason
end;

you will have to figure out how to make that work, but its just an example, there you go =D

a really really long name

2008-07-11 22:00:53

From: sirlaughsalot



begin
SetupSRL
SRLStats;
repeat
AntiRandoms;{sprinkle these procedures throughout the script, you can put procedures you made into other procedures}
Antiban;
LoadBitmap;//you changed this to "LoadDTM" hehe
ColorPicker;//this is no longer a procedure
k:=0//if you keep having it repeat this then it will always =1
f:=0
chickenfight;
FreeDTM(FeatherDTM);
until(TimeRunning:=60)//idk wtf this is ill explain something better below
Proggy;//put it in the main loop so people can see how they are doing
end.



done;
fixed;
deleted;
look at the next procedure more thoroughly;
done;
done;

greent

2008-08-09 12:31:09

Failed when compiling
Line 15: [Error] (12702:1): 'BEGIN' expected in script

Should i be using a certain revision of srl

Flame

2008-08-15 20:43:39

It looks good to me; I'll be trying it right away ^^ I hope it's a good one and erm oes it have auto color picker or should I pick the colors ?

Thanks :)