SRL Archive - Help and Support

Not fighting a COW..


Camaro'

2008-05-15 17:20:34

Well , I'm making a fally cow fighter and my question is, if it sees the the black chat message 'ome' (standing for someone is already fighting or w/e) ..

How would i go about making a TBOX for where that Cow was? So i could use

[BANANA]function FindColorSkipBox(var x, y: Integer; color, x1, y1, x2, y2: Integer; SkipBox: TBox): Boolean;
Finds a color in an area specified by x1, y1, x2 and y2, while skipping the area specified by the TBox, SkipBox.
[/BANANA]

and if you don't think i should make a tbox of the cow then please give me suggestions

Nava2

2008-05-15 18:18:13

Why not just, after you click the cow, call it to check for the chat text. If it finds it then say repeat it?

I cba to write out what that looks like haha

Nava2

MylesMadness

2008-05-15 18:19:41

How would you get the box of cow? If you can do that in a quick and flawless way do that. Other was just keep clicking on the cows until you get it right

Special Ed

2008-05-15 19:56:34

Well… first take like… 20 screen shots of cows at different distances away, fighting people or not. Then Find the Maximum height and width of the cow on the screen and use that to create generic measurements for creating the box.

Next, when you initially find the cow you need to use FindColorsTolerance or something that you can use to find the center of the cow. Add / Subtract half the max width and half the max height to those coords to make your box.

You could also create a procedure using FindColorsTolerance that will get all the points that make up the cow and make a TBox from that using the max / min x and y values.

Camaro'

2008-05-15 20:53:32

From: Special Ed
Well… first take like… 20 screen shots of cows at different distances away, fighting people or not. Then Find the Maximum height and width of the cow on the screen and use that to create generic measurements for creating the box.

Next, when you initially find the cow you need to use FindColorsTolerance or something that you can use to find the center of the cow. Add / Subtract half the max width and half the max height to those coords to make your box.

You could also create a procedure using FindColorsTolerance that will get all the points that make up the cow and make a TBox from that using the max / min x and y values.


Wow, you win the medal. Now lets see if i can actually understand it now :P

Okay , im getting you…

-take pics
-get max / min value
-get all points that make up the cow
-make a tbox from that using the max/min values of x,y Gots it! TY !!

The reason why i didnt want it repeating cause thats so botty.. Since when do you click on a cow thats in fight 3 times in a row? LOL

R0b0t1

2008-05-15 21:18:04

You could pretty much mouse over the cow's or click on them as much as you want, people normally do that anyway.

Infantry001

2008-05-15 21:57:44

Well, if you find the text, simply break out of the function. Then, just call up the same cow-finding procedure. Your cow-finding function does check if the cow is already in a fight or not, right?

Special Ed

2008-05-15 23:05:24

From: Infintry001
Well, if you find the text, simply break out of the function. Then, just call up the same cow-finding procedure. Your cow-finding function does check if the cow is already in a fight or not, right?


The question is what is the best way to check if the cow is in a fight? Granted you could see if a Health Bar is near it but that gives false positives / negatives 30% of the time so IMO one of the worst ways to do it.

Lets brainstorm! :p We'll have the best Cow related procedures ever made in this script!

Widget

2008-05-15 23:34:54

Hmm, you could try FindColors-ing the green or red (or both and combine them), then FindColorsTolerance the cow color, then if any bars are within say, 25 pixels of a cow, blacklist it and click whatever's left? :)

Miitchyy

2008-05-16 08:10:42

Just copy and paste findobjecttpa and rename it findmonstertpa and when it checks for uptext make it also check for fight..

program FindMonster;

{.include SRL\SRL.scar}
{.include SRL\SRL\Skill\Fighting.scar}

function FindMonster(var x, y: integer; color, tol, cts, ObjWidth, ObjHeight, minCount :Integer; UpText: tstringarray): Boolean;
var
I, j, tcts: Integer;
myPoint: TPoint;
Points: TPointArray;
aPoints: T2DPointArray;
s: string;
begin
tcts := GetColorToleranceSpeed;
if not (cts >= 0) and (cts <= 2) then
cts := 1; // Standard.
ColorToleranceSpeed(cts);
FindColorsSpiralTolerance(x, y, Points, Color, MSX1, MSY1, MSX2, MSY2, Tol);
aPoints := TPAtoATPAEx(Points, ObjWidth, ObjHeight);
SetLength(Points, 0);
for I := 0 to Length(aPoints) - 1 do
begin
if Length(aPoints[I]) < minCount then
Continue;
myPoint := MiddleTPA(aPoints[I]);
MMouse(myPoint.X, myPoint.Y, 0, 0);
Wait(100 + Random(50));
ColorToleranceSpeed(1);
s := rs_getuptext;
for j := 0 to high(uptext) do
if (pos(uptext[j], s) <> 0) and not IsFightAt(myPoint.X, myPoint.Y) then
begin
x := myPoint.X;
y := myPoint.Y;
Result := True;
ColorToleranceSpeed(tcts);
Exit;
end;
ColorToleranceSpeed(cts);
end;
ColorToleranceSpeed(tcts);
end;

begin
end.

Camaro'

2008-05-16 12:47:41

From: Kevin Wolf
Just copy and paste findobjecttpa and rename it findmonstertpa and when it checks for uptext make it also check for fight..

program FindMonster;

{.include SRL\SRL.scar}
{.include SRL\SRL\Skill\Fighting.scar}

function FindMonster(var x, y: integer; color, tol, cts, ObjWidth, ObjHeight, minCount :Integer; UpText: tstringarray): Boolean;
var
I, j, tcts: Integer;
myPoint: TPoint;
Points: TPointArray;
aPoints: T2DPointArray;
s: string;
begin
tcts := GetColorToleranceSpeed;
if not (cts >= 0) and (cts <= 2) then
cts := 1; // Standard.
ColorToleranceSpeed(cts);
FindColorsSpiralTolerance(x, y, Points, Color, MSX1, MSY1, MSX2, MSY2, Tol);
aPoints := TPAtoATPAEx(Points, ObjWidth, ObjHeight);
SetLength(Points, 0);
for I := 0 to Length(aPoints) - 1 do
begin
if Length(aPoints[I]) < minCount then
Continue;
myPoint := MiddleTPA(aPoints[I]);
MMouse(myPoint.X, myPoint.Y, 0, 0);
Wait(100 + Random(50));
ColorToleranceSpeed(1);
s := rs_getuptext;
for j := 0 to high(uptext) do
if (pos(uptext[j], s) <> 0) and not IsFightAt(myPoint.X, myPoint.Y) then
begin
x := myPoint.X;
y := myPoint.Y;
Result := True;
ColorToleranceSpeed(tcts);
Exit;
end;
ColorToleranceSpeed(cts);
end;
ColorToleranceSpeed(tcts);
end;

begin
end.


ill try that but first im trying special eds.. then this one.. sorry widget i didnt get what you said.. whats blacklist it mean? check for blackchatlastmessage or w/e???

Naum

2008-05-17 05:30:43

FindBlackChatMessage

Should do the trick.

n3ss3s

2008-05-17 05:48:24

You can avoid everything suggested by just doing IsFightAt(x, y) at the cow coordinates, if true, then continue in your loop/ don't click the cow etc.

Oh yea Nashi has that in there…

Cazax

2008-05-17 11:30:27

Or you could check if there is a hp bar over the cow.

Camaro'

2008-05-17 11:39:05

From: Cazax
Or you could check if there is a hp bar over the cow.



Thats a better idea…. Im gonna do that for a failsafe, cant believe i didn't think of that.

function Fighting:integer;
begin
result:=GetColor(Cow.x-5,cow.y+5,255);
end;

something like that could work…

Special Ed

2008-05-17 12:12:55

But what if the HP bar is over a cow near it? Then you're getting a false positive… Granted it does work but I'm sure there are better and more accurate solutions to this problem.

Camaro'

2008-05-17 12:33:26

From: Special Ed
But what if the HP bar is over a cow near it? Then you're getting a false positive… Granted it does work but I'm sure there are better and more accurate solutions to this problem.


Thats why im using the idea you gave me :P Like the second post.

Special Ed

2008-05-17 13:03:55

Ahhhh… have you gotten that idea to work yet, or are you working on something else right now?

n3ss3s

2008-05-17 17:10:57

Erm… That's what IsFightAt exactly does -.-

Camaro'

2008-05-18 21:24:51

From: Special Ed
Ahhhh… have you gotten that idea to work yet, or are you working on something else right now?


Its working , just gotta fix some errors but it will be alright.. And honestly, i know what IsFightAt Does and i dont want to use it:fiery:

Drakan

2008-05-23 08:01:35

Try getting the MiddleTPA of the cow, then using IsFightAt(x, y-whatever) =]

Narcle

2008-05-23 08:15:44

IsFightAt is still bad at determining if the mob is really in a fight. Its only like maybe 75% accurate. I still haven't found a better way tho. Of course theres the checking for the chat message, but it doesn't disappear for 5 mins if no one talks.

Drakan

2008-05-23 08:45:46

Well, try using IsFightAt first and if not then check for chat msg? I mean one HAS to work eventually :p Doing isfightat would be best to do first so u dont click a cow in a fight therefore looking less like a bot

Camaro'

2008-05-23 16:35:30

From: The[Cheese]
Well, try using IsFightAt first and if not then check for chat msg? I mean one HAS to work eventually :p Doing isfightat would be best to do first so u dont click a cow in a fight therefore looking less like a bot


Well, im gonna make a t box of where the cow was found, and findcolorsskipbox or w/e