SRL Archive - SRL Archives

function EvilChicken : Boolean;


JuKKa

2007-03-08 18:03:02


program New;
{.Include SRL/SRL.Scar}

function EvilChicken : Boolean;
var
begone , Fleeme : integer;
begin
Begone:= CreateBitmapMaskFromText('egone', UpChars);
Fleeme:= CreateBitmapMaskFromText('lee fr', UpChars);
if FindBitmapMaskTolerance(NickNameBMP,x,y,3,3,515,336,0,40)then
if(FindBitmapMaskTolerance(Begone,x,y,3,3,515,336,0,40))or
(FindBitmapMaskTolerance(FleeMe,x,y,3,3,515,336,0,40))then
begin
Writeln('******** FOUND EVIL CHICKEN ********')
RunAwayDirection('N')
Wait(5000+random(5000))
RunBack;
Case 1+random(5) of
1: Typesend('stupid chicken')
2: Typesend('bwuk')
3: Typesend('bwuk bwuk')
4: Typesend('useless chicken')
5: Typesend('stupid evil chicken')
end
Result:= True;
Writeln('******** SOLVED EVIL CHICKEN ********')
end;
Freebitmap(Begone)
Freebitmap(FleeMe)
end;

begin
SetupSRL;
repeat
Wait(100)
until(EvilChicken)
end.

This SHOULD solve the evil chicken.
I HAVENT TESTED IT.. the text is based on a YouTube video i saw.
PLEASE if you ever get a evil chicken PLEASE PLEASE test this so i know it works!

Dark_Sniper

2007-03-08 18:05:37

or use the infight function :p

but this looks good from first glance. :p

JuKKa

2007-03-08 18:07:58

i mainly needed it for my auto fighter :D

WT-Fakawi

2007-03-08 19:29:01

You need to constantly monitor GameTab(2) for an AutoFighter and detect fast level drops. I normally only check once every 20 secs or so for a box or lamp with GameTab(4). That way you can avoid the overhead caused by the BitMapMasksFromText and simply ignore the bwukbwuk and focus on health.
Try my Falador Guard Mager. It is an autofighter designed not to die!

JuKKa

2007-03-09 00:17:45

great. ill check it out, for some reason when run the evil chicken function the bitmapmasks start to lag a bit its just for 300 - 400 msec. ill try and add a wait..

well i couldnt get a wait to cure the problem but i made this:


Function EatFood : boolean;
Begin
if GetHP < HpToEat then
begin
if EatWhenLow then
begin
Writeln('Eating Food')
if FindItemColor(FoodColor)then
begin
Mouse(x,y,5,5,false)
Chooseoption(x,y,'Eat')
Result:= True;
Eaten:= Eaten + 1;
EatFood;
end else
begin
writeln('No Food!')
killmepl0x; //fancy procedure a bit like: nextplayer(false)
end;
end else
begin
writeln('Eating is off, and low health!')
killmepl0x; //fancy procedure a bit like: nextplayer(false)
end;
end;
AntiRandoms;
end;

TOB

2007-03-09 19:56:49

I haven't checked them over really but I have a comment on your use of random() and case.

Though it is a good thing in this case so that it doesn't say anything every time but random(5) can possibly return 0 which you have not provided for in your case statement. For times when you NEED something done every time you should use random(4) and instead of stating your case statements with 1 you should begin with case 0-4.

You probably already knew that ;)

JuKKa

2007-03-10 20:24:38

yeah i just noticed that.. ill fix.. still havent got a SINGLE evil chicken to test this on :(

well i made a test .. and this seems to WORK! i added few things changed and saw it owns!


program New;
{.Include SRL/SRL.Scar}

var
Mark2 : integer;

Procedure DeclarePlayers;
begin
CurrentPlayer:=0;
NumberOfPlayers(1);
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := 'Rule';
Players[0].Skill := '';
Players[0].Active := true;
end;

function EvilChicken : Boolean;
var
begone , Fleeme : integer;
begin
if not loggedin then exit;
if FindBitmapMaskTolerance(NickNameBMP,x,y,170,100,370, 230,0,5)then
begin
wait(150)
writeln('Found Name')
Begone:= CreateBitmapMaskFromText('egone', UpChars);
Fleeme:= CreateBitmapMaskFromText('lee fr', UpChars);
if(FindBitmapMaskTolerance(Begone,x,y,3,3,515,336,0,40))or
(FindBitmapMaskTolerance(FleeMe,x,y,3,3,515,336,0,40))then
begin
Writeln('******** FOUND EVIL CHICKEN ********')
RunAwayDirection('N')
Wait(5000+random(5000))
RunBack;
Case 1+random(5) of
1: Typesend('stupid chicken')
2: Typesend('bwuk')
3: Typesend('bwuk bwuk')
4: Typesend('useless chicken')
5: Typesend('stupid evil chicken')
end
Result:= True;
end;
end;
Freebitmap(Begone)
Freebitmap(FleeMe)
end;

begin
SetupSRL;
DeclarePlayers;
NickNameBMP:= CreateBitmapMaskFromText(Players[Currentplayer].Nick, UpChars);
repeat
Marktime( Mark )
EvilChicken;
Mark2:= TimeFromMark(Mark)
Writeln('' + inttostr(Mark2) + ' Msec')
Wait(1000)
until(False)
end.

run this and type in RUNESCAPE: (Rule is nick)
- Rule flee from me
- Rule begone

or edit to make it trigger other words..

and it should run away ;D and run back.. of course u should remove the talk if testing..

omgh4x0rz

2007-03-10 20:54:17

I'll try and test it if I get one, although it looks good. I like fakawi's plan for checking stat drops though, that way it will work even if there is a screen covering the ms like in an auto-buyer or something.

Although, I still think it looks more like an evil-rooster.

neG

2007-03-16 08:23:36

Can you spawn randoms on a private server? Because if you can that would be a good way to test this.

JuKKa

2007-03-16 14:27:03

or u can just type in the messages it says in the REAL RS and it will trigger the function

WT-Fakawi

2007-03-16 18:19:05

Dankness and me had the solution to this, if you insist on ID'ing the Chicken. There are only two f2p NPC's I know of that speak aloud with CAPITALS: "MUHAHAHAHAAAA", so you could check for the BitmapMaskfromText "HA", or "AA", or "UH". But since you dont know it it is you its after, you will next need to look at your HPPercent or Damage.

Function Damage:Integer;
var HPAmount, HPLevel:Integer;
begin
HPAmount := GetSkillAmount('hitpoints');
HPLevel := GetSkillLevel ('hitpoints');
Result := HPLevel - HPAmount
end;

n3ss3s

2007-04-29 04:34:59

I had a nice working not released health-eating funtion but i had to do system recovery and the files are on a cd ill try to search.