SRL Archive - First Scripts

Chicken Fighter


ElPolloFeo92

2007-11-26 16:37:25

Here is my first script. It finds and fights a chicken, waits for 5 seconds and then looks for all feathers and bones on the ground and buries the bones. It works, but it is slow and inefficient. I will add stuff like antirandoms and progress reports and try to make it act less stupid later. Please post any comments and suggestions.

EDIT: Forgot to mention, all the multiplayer code came straight from the_rs_monkey's woodcutting tutorial. Thanks for the great tutorial!

////////////////////////////////////////////////////////////////////////////////
// ChickenFighter.scar //
////////////////////////////////////////////////////////////////////////////////
// - Kills chickens //
// - Picks up feathers //
// - Picks up and buries bones //
// //
// Instructions: //
// 1. Drag crosshairs to client //
// 2. Pick a color on the chickens and edit the script variables //
// 3. Enter the number of players and information for each //
////////////////////////////////////////////////////////////////////////////////

program ChickenFighter;

// SRL Includes
{.include SRL/SRL.scar}

const
ChickenColor = 6326691; // Color of chicken to look for
FeatherColor = 9737377; // Color of feather to look for
BoneColor = 12435141; // Color of bone to look for
KillsPerPlayer = 50; // Number of chickens killed before switching
WaitTime = 5000; // Time to wait before attacking a new chicken

var
BoneDTM : Integer;

// Shows title
procedure ShowTitle;
begin
writeln(' ===========================================================');
writeln(' __ ___ ');
writeln(' / | * | | * | | ');
writeln(' | | _ _ | _ | _ |__ __ | _ -+- _ | _ ');
writeln(' | |/ \ | / |/ /_\ |/ \ | | / \ |/ \ | /_\ |/ \');
writeln(' \__ | | | \_ |\ \_ | | | | \__| | | | \_ | ');
writeln(' | ');
writeln(' -Version 1.0- By ElPolloFeo \_/ ');
writeln(' ===========================================================');
end;

// Set up the players
procedure DeclarePlayers;
begin
NumberOfPlayers(2);
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;

// Find all of the feathers on the ground
procedure FindFeathers;
var
x, y : Integer;
begin
Flag;
repeat
if not FindObj(x, y, 'eather', FeatherColor, 0) then Exit;
Mouse(x, y, 0, 0, True);
Flag;
until (False);
end;

// Find all of the bones on the ground and bury them
procedure FindBones;
var
x, y : Integer;
FoundAllBones : Boolean;
begin
Flag;
FoundAllBones := False;
repeat
if not FindObj(x, y, 'ones', BoneColor, 0) then FoundAllBones := True;
if not FoundAllBones then Mouse(x, y, 0, 0, True);
Flag;
until (FoundAllBones);
repeat
if not FindDTM(BoneDTM, x, y, 540, 180, 750, 480) then Exit;
Mouse(x, y, 3, 3, True);
Wait(2000);
until (False);
end;

// Kill a chicken
procedure KillChicken;
var
x, y : Integer;
begin
repeat
Wait(100);
until FindObj(x, y, 'hicken', ChickenColor, 0);
Mouse(x, y, 1, 1, True);
Wait(WaitTime);
end;

// Main program
begin
ShowTitle;
SetupSRL;
DeclarePlayers;
if LoggedIn then Logout;
LoginPlayer;
BoneDTM := DTMFromString('78DA63CC616260E0606440067B366F626005D' +
'23051C62CA01A465435CB66CD4455930E54C389AA664E5F1FAA9A' +
'12A01A2E54352BE7CD4555538EE91E137D7D5435A94035CCA86A4' +
'0B2286AF2806AD850D594E764A3AAC904AA11C46DCE7F20000065' +
'0B1167');
// Main Loop
repeat
KillChicken;
FindFeathers;
FindBones;
Inc(Players[CurrentPlayer].Banked);
if Players[CurrentPlayer].Banked mod KillsPerPlayer = 0 then
begin
NextPlayer(True);
end;
if not LoggedIn then NextPlayer(False);
until False;
end.

P1nky

2007-11-26 18:06:00

i like it looks good for first =) simple and nice but, get anti-BAN dawg!

[S]paz

2007-11-26 18:07:25

i like ur findobj's there all good and as p1nky said,… anti banns and randomsd r key so add them and maby some more failsafes and i can see u becoming good

spaz

ElPolloFeo92

2007-11-26 20:16:50

Thanks for the suggestions. I'll get working on antirandoms and antibans soon. Spaztaz666, failsafes are just code that makes sure the script is doing the right thing and won't freeze on doing something wrong, right?

BTW I tried to follow the standards as much as possible, does anybody see anything wrong with it?

eze01

2007-11-30 17:19:14

Seems to work great, only problem i saw was it being a tad slow and it didnt seem to get bones/feathers very often. i haven't ran it for a very long time. 10 mins maybe so maybe i should keep running it and see how well it does over a few hours with multiple players. good script though good work

dakisback

2007-11-30 17:41:21

nice script.

blackblue

2007-12-05 19:04:59

cant locate the chicken :confused:

blackblue

2007-12-05 19:12:34

ooops never mind sorry guys
forgot to pick the colors:duh:

ran script for few min and detects chicken good(yeah finaly found chicken script that works)
only problams i noticed is that it doesnt seem to detect the bones and feather well (maybe its the colors i picked) ill try to mess around wit that abit.

will defintly b using this script 2nite :f:
will try to post my progress report

and would also luv to see anti-radoms ;)

good work though

ElPolloFeo92

2007-12-08 16:35:45

Thanks for the comments, everybody. I didn't really expect anybody to be using this script, because it is my first and not very good. Now that I see that people are using it I will add anti-randoms and try to fix picking up bones and feathers. I know that it doesn't pick them up very well, any suggestions on how to improve this? Thanks for reading.

besse0

2007-12-31 11:44:12

what soes "nick" mean

besse0

2007-12-31 11:47:29

what do i put in the nick spot? Players[0].Nick := '';

MasterSparta

2007-12-31 15:42:07

Great job! It was hilarious watching my main kill chickens.

TheSantaMan

2007-12-31 17:43:24

looks good but don't use Until. because it's not a very good failsafe. Just one more thing to make sure you don't get banned :)

yurmomsmom9

2008-01-01 00:16:44

nice script worked pretty nicely for me
870 feathers collected
level 17-21 strength
in and hour and a half
didnt bury any bones though

yurmomsmom9

2008-01-01 22:01:16

ive been using this on and off last night and today. it works pretty nicely but it doesnt really bury bones
total progress:
strength 17-33
feathers 7315(ive been banking them every now and then)
bones burried 0
raw chicken collected (but i dropped them) about 45
other than the raw chickens and not burying bones its a pretty nice script :)
thanks