SRL Archive - First Scripts

Chicken Killer


barbarianl3t

2008-10-05 19:54:30

Ok this is my first script. I tried to also have it pick up the feathers but i have trouble with btms.

Please leave constructive critisim + proggies
Please don't leave mean comments

All help to make it better would be appreciated.
program barbarianl3tschickenkiller;
{.include SRL/SRL.Scar}

var
timesdone:Integer;
const
whitechickencolor=7114401; //change to any part of the white chicken
brownchickencolor=3430514;//change to any part of the brown chicken
feathercolor=402948;//Try to get the black part of the feather because black is uncommon in rs
AveradgeTimeToKillAChickenInSeconds=16;//Change this to however long it takes you to kill a chicken in seconds
YourName='Alphaeater';//your username
YourPassword='yhnyhn';//your password
Numberofsets=10;


procedure login;
begin;
Mouse(325,260,20,10,true);
Wait(100 + random(300));
TypeSend(YourName);
Wait(500 + random(200));
TypeSend(YourPassword);
Wait(250 + random(300));
Mouse(382,365,10,10,true);
Wait(4000+random(200));
Mouse(369,354,0,0,true);
Wait(3000);
end;

procedure killchickens;
var
x,y,whitechickenfound:integer;

begin;
whitechickenfound:=0;
FindColorSpiral(x,y,whitechickencolor,0,0,600,600);
if x=0 then FindColorSpiral(x,y,brownchickencolor,0,0,600,600);
if x=0 then Exit;
Mouse(x,y,3,3,true);
Wait(AveradgeTimeToKillAChickenInSeconds*1000+random(800));
Wait(1000);
end;

Procedure pickupfeathers;
var
x,y:Integer;

begin;
FindColor(x,y,feathercolor,30,30,480,300);
if x=0 then x:=20;
if y=0 then y:=20;
Mouse(x,y,1,1,false);
Wait(50+random(150));
TextCoords(1);
Wait(200+random(50));
Mouse(x,y,1,1,true)
Wait(6000);
end;




begin
MouseSpeed:=15;
TimesDone:=0;

if not LoggedIn then login;
repeat
killchickens;
timesdone:=timesdone+1;
pickupfeathers;
ClearDebug;
Writeln('Chickens attacked' + IntToStr(timesdone));
until(timesdone>numberofsets)
end.
Currently I can't click the menu. I right click the feather but don't click on the menu.

Blumblebee

2008-10-05 19:58:14

umm first thing, use declare players instead of the login you made. I'm impressed that you made your own log in, but its unneeded.

Mouse(x,y,random(3),random(3),true);

can be

Mouse(x,y, 3, 3,true);


and it yeilds the same result.

  Wait(400+random(125));
Wait(400+random(200));
Wait(7000+random(200));

you could just combine them into one wait, instead of having 3 in a row, thats just inefficient. Other than that it ooks alright, congrads on your first script :)

-Blumblebee

barbarianl3t

2008-10-05 21:26:21

Ok thanks for the adivce. Ill go edit that right now.

TViYH

2008-10-05 21:51:14

Can I fix it and post?

Lol. There's quite a few mistakes =/

barbarianl3t

2008-10-05 21:52:51

Sure could you help me with picking up feathers??? I already made a bitmap but can't make it work.

[edit]Here is my feather bitmap.
Feather2 := BitmapFromString(20, 25, 'beNpjYBgFIxMcWDoFSB5a' +
'M+XYuknEqN+3e8KGtV1Q9rJZl/ZvXLmwZ+Witn2re4+s7Mav98Tx6' +
'RcvrTqwe/bBXQsObJ2/Zcus7SeW7Lu86sDxuccPzTi5q5+g7RdPLQ' +
'CSty6tO31hxdrj05ce6999bvpoJI6CUYATAABAUToz');
[/edit]

I just can't seem to put it into my script

TViYH

2008-10-05 22:07:52


program ChickenKiller;
{.include SRL/SRL.Scar}

const
ChickensToKill = 5;

var
ChickensKilled: Integer;
ChickenColors: TIntegerArray;

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

ChickenColors := [0, 0, 0]; // Choose a few colors off of the chickens and put them here.

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

function KillChickens: boolean;
var
l, i: Integer;
ChickenPointsATPA: T2DPointArray;
ChickenPoints: TPointArray;
ChickenPoint: TPoint;
begin
l := High(ChickenColors);
FindColorsSpiralTolerance(MSCX, MSCY, ChickenPoints, ChickenColors[Random(l)], MSX1, MSY1, MSX2, MSY2, 5);
if Length(ChickenPoints)=0 then
FindColorsSpiralTolerance(MSCX, MSCY, ChickenPoints, ChickenColors[Random(l)], MSX1, MSY1, MSX2, MSY2, 5);
ChickenPointsATPA := SplitTPA(ChickenPoints, 3);
SortATPASize(ChickenPointsATPA, True);
for i := 0 to High(ChickenPointsATPA) do
begin
ChickenPoint := MiddleTPA(ChickenPointsATPA[i]);
Mouse(ChickenPoint.x, ChickenPoint.y, 0, 0, False);
Wait(750);
if ChooseOption('hicken') then
begin
Result := True;
Exit;
end;
end;
end;

procedure ProgressReport;
begin
ClearDebug;
WriteLn('Chickens Killed: ' + IntToStr(ChickensKilled));
end;

begin
SetupSRL;
LoginPlayer;
repeat
FindNormalRandoms;
if KillChickens then
Inc(ChickensKilled);
ProgressReport;
until(ChickensKilled=ChickensToKill)
end.

EDIT: I'll try to write you a feather picker upper.

EDIT2: Here you are with a feather picker upper.

program ChickenKiller;
{.include SRL/SRL.Scar}

const
ChickensToKill = 5;

var
ChickensKilled, FeatherColor: Integer;
ChickenColors: TIntegerArray;

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

ChickenColors := [0, 0, 0]; // Choose a few colors off of the chickens and put them here.
FeatherColor := 0; // Choose a color off of the "stem" of the feather.

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

function KillChickens: boolean;
var
l, i: Integer;
ChickenPointsATPA: T2DPointArray;
ChickenPoints: TPointArray;
ChickenPoint: TPoint;
begin
if not LoggedIn then TerminateScript;
l := High(ChickenColors);
FindColorsSpiralTolerance(MSCX, MSCY, ChickenPoints, ChickenColors[Random(l)], MSX1, MSY1, MSX2, MSY2, 5);
if Length(ChickenPoints)=0 then
FindColorsSpiralTolerance(MSCX, MSCY, ChickenPoints, ChickenColors[Random(l)], MSX1, MSY1, MSX2, MSY2, 5);
ChickenPointsATPA := SplitTPA(ChickenPoints, 3);
SortATPASize(ChickenPointsATPA, True);
for i := 0 to High(ChickenPointsATPA) do
begin
ChickenPoint := MiddleTPA(ChickenPointsATPA[i]);
Mouse(ChickenPoint.x, ChickenPoint.y, 0, 0, False);
Wait(750);
if ChooseOption('hicken') then
begin
Result := True;
Exit;
end;
end;
end;

function PickupFeathers: boolean;
var
i: Integer;
FeatherPoints: TPointArray;
FeatherPointsATPA: T2DPointArray;
FeatherPoint: TPoint;
begin
if not LoggedIn then TerminateScript;
FindColorsSpiralTolerance(MSCX, MSCY, FeatherPoints, FeatherColor, MSX1, MSY1, MSX2, MSY2, 5);
if Length(FeatherPoints)=0 then
FindColorsSpiralTolerance(MSCX, MSCY, FeatherPoints, FeatherColor, MSX1, MSY1, MSX2, MSY2, 10);
if Length(FeatherPoints)=0 then
TerminateScript;
FeatherPointsATPA := SplitTPA(FeatherPoints, 3);
SortATPASize(FeatherPointsATPA, True);
for i := 0 to High(FeatherPointsATPA) do
begin
FeatherPoint := MiddleTPA(FeatherPointsATPA[i]);
MMouse(FeatherPoint.x, FeatherPoint.y, 0, 0);
Wait(750);
if IsUpText('eather') then
begin
Mouse(FeatherPoint.x, FeatherPoint.y, 0, 0, False);
Wait(750);
if ChooseOption('eather') then
begin
Result := True;
Exit;
end;
end;
end;
end;

procedure ProgressReport;
begin
ClearDebug;
WriteLn('Chickens Killed: ' + IntToStr(ChickensKilled));
end;

begin
SetupSRL;
LoginPlayer;
repeat
FindNormalRandoms;
if KillChickens then
Inc(ChickensKilled);
PickupFeathers;
ProgressReport;
until(ChickensKilled=ChickensToKill)
end.

barbarianl3t

2008-10-05 22:24:00

Ok I think that that would work better then my current one but doesn't make sense to me yet. + I'm tired. I'll try learning from that tommorow. Thanks for the help though.

TViYH

2008-10-05 22:28:28

Just PM me if you need help.

joelster134

2008-10-06 08:58:59

Nice first script keep up the work! if you get a feather finder please Pm me…cause i am looking for how to make my own ( will cred you definatley!)

barbarianl3t

2008-10-06 21:11:10

Ok I'm still learning from TheVoiceInYourHead's script. I don't want to immplement something I don't fully understand yet into my script so it will be a couple days before my current script looks like yours.

Thanks for the help and advice all.

joelster134

2008-10-07 01:27:44

From: TheVoiceInYourHead

program ChickenKiller;
{.include SRL/SRL.Scar}

const
ChickensToKill = 5;

var
ChickensKilled: Integer;
ChickenColors: TIntegerArray;

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

ChickenColors := [0, 0, 0]; // Choose a few colors off of the chickens and put them here.

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

function KillChickens: boolean;
var
l, i: Integer;
ChickenPointsATPA: T2DPointArray;
ChickenPoints: TPointArray;
ChickenPoint: TPoint;
begin
l := High(ChickenColors);
FindColorsSpiralTolerance(MSCX, MSCY, ChickenPoints, ChickenColors[Random(l)], MSX1, MSY1, MSX2, MSY2, 5);
if Length(ChickenPoints)=0 then
FindColorsSpiralTolerance(MSCX, MSCY, ChickenPoints, ChickenColors[Random(l)], MSX1, MSY1, MSX2, MSY2, 5);
ChickenPointsATPA := SplitTPA(ChickenPoints, 3);
SortATPASize(ChickenPointsATPA, True);
for i := 0 to High(ChickenPointsATPA) do
begin
ChickenPoint := MiddleTPA(ChickenPointsATPA[i]);
Mouse(ChickenPoint.x, ChickenPoint.y, 0, 0, False);
Wait(750);
if ChooseOption('hicken') then
begin
Result := True;
Exit;
end;
end;
end;

procedure ProgressReport;
begin
ClearDebug;
WriteLn('Chickens Killed: ' + IntToStr(ChickensKilled));
end;

begin
SetupSRL;
LoginPlayer;
repeat
FindNormalRandoms;
if KillChickens then
Inc(ChickensKilled);
ProgressReport;
until(ChickensKilled=ChickensToKill)
end.

EDIT: I'll try to write you a feather picker upper.

EDIT2: Here you are with a feather picker upper.

program ChickenKiller;
{.include SRL/SRL.Scar}

const
ChickensToKill = 5;

var
ChickensKilled, FeatherColor: Integer;
ChickenColors: TIntegerArray;

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

ChickenColors := [0, 0, 0]; // Choose a few colors off of the chickens and put them here.
FeatherColor := 0; // Choose a color off of the "stem" of the feather.

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

function KillChickens: boolean;
var
l, i: Integer;
ChickenPointsATPA: T2DPointArray;
ChickenPoints: TPointArray;
ChickenPoint: TPoint;
begin
if not LoggedIn then TerminateScript;
l := High(ChickenColors);
FindColorsSpiralTolerance(MSCX, MSCY, ChickenPoints, ChickenColors[Random(l)], MSX1, MSY1, MSX2, MSY2, 5);
if Length(ChickenPoints)=0 then
FindColorsSpiralTolerance(MSCX, MSCY, ChickenPoints, ChickenColors[Random(l)], MSX1, MSY1, MSX2, MSY2, 5);
ChickenPointsATPA := SplitTPA(ChickenPoints, 3);
SortATPASize(ChickenPointsATPA, True);
for i := 0 to High(ChickenPointsATPA) do
begin
ChickenPoint := MiddleTPA(ChickenPointsATPA[i]);
Mouse(ChickenPoint.x, ChickenPoint.y, 0, 0, False);
Wait(750);
if ChooseOption('hicken') then
begin
Result := True;
Exit;
end;
end;
end;

function PickupFeathers: boolean;
var
i: Integer;
FeatherPoints: TPointArray;
FeatherPointsATPA: T2DPointArray;
FeatherPoint: TPoint;
begin
if not LoggedIn then TerminateScript;
FindColorsSpiralTolerance(MSCX, MSCY, FeatherPoints, FeatherColor, MSX1, MSY1, MSX2, MSY2, 5);
if Length(FeatherPoints)=0 then
FindColorsSpiralTolerance(MSCX, MSCY, FeatherPoints, FeatherColor, MSX1, MSY1, MSX2, MSY2, 10);
if Length(FeatherPoints)=0 then
TerminateScript;
FeatherPointsATPA := SplitTPA(FeatherPoints, 3);
SortATPASize(FeatherPointsATPA, True);
for i := 0 to High(FeatherPointsATPA) do
begin
FeatherPoint := MiddleTPA(FeatherPointsATPA[i]);
MMouse(FeatherPoint.x, FeatherPoint.y, 0, 0);
Wait(750);
if IsUpText('eather') then
begin
Mouse(FeatherPoint.x, FeatherPoint.y, 0, 0, False);
Wait(750);
if ChooseOption('eather') then
begin
Result := True;
Exit;
end;
end;
end;
end;

procedure ProgressReport;
begin
ClearDebug;
WriteLn('Chickens Killed: ' + IntToStr(ChickensKilled));
end;

begin
SetupSRL;
LoginPlayer;
repeat
FindNormalRandoms;
if KillChickens then
Inc(ChickensKilled);
PickupFeathers;
ProgressReport;
until(ChickensKilled=ChickensToKill)
end.




Hey do you mind if i use your Feather Part…will add you to creds

TViYH

2008-10-07 15:54:28

Go ahead. As long as you know how it works.

joelster134

2008-10-07 17:09:30

From: 3goodfriends
this is a cool web.


How about you comment on this script/how it ran/suggestions/bugs insetad of just saying its cool etc.

GOING SKEWL BBAK 8 HOURS

in2it

2008-10-11 21:51:47

joelstar really needs the code where u pick up the feathers, he will cred u and so will i plz help us
in2it and joelster:f:

joelster134

2008-10-11 21:58:22

not urgent but if someone can look at my chicken raper V5 then i WILL add feather pickup, please PM me or just add my script + chicken feather pickup in it on my thread will add to creds!

in2it

2008-10-12 04:46:46

looks nice but need code to pick up feathers :f: