SRL Archive - OSR Help

Need some ideas...


Function

2010-02-07 20:22:21

- I'm in the making of a chicken killer and its coming along like magic… But I'm at a dillema, my chicken finder is almost flawless except it clicks on a lot of chickens that are already under attack… And I need some ideas of how to check if theres a hp bar over the head of the chicken.

I was trying

if(not(FindColorTolerance(x, y, 50027, (TPAs[i][ii].x - 10), (TPAs[i][ii].y - 10), (TPAs[i][ii].x + 10), (TPAs[i][ii].y + 10), 10)))then

But I'm getting a type mismatch and I don't know why.
+ EDIT: I'm an idiot I had FindColorsTolerance instead of FindColorTolerance I think I got it now

YoHoJo

2010-02-07 20:25:04

Take a gander at Tarajunky's chicken killer.
His non-members version is outdated, but the code is still beautiful, and I'm pretty sure I had a fail safe against attacking already in-combat chickens:

http://www.villavu.com/forum/showthread.php?t=4082

Sorry I cant find the EXACT code where he did it. You can shoot him a PM and though, he's very helpful.
Basically what you are doing is just fine though. Find the chicken, and GetMousePos(x,y) then search for an HP bar color in x-10,y-10,x+10,y+10. Would be a simple way of going about doing that. I believe there is also GetFightAt(x,y) (or something similar to that) in SRL which you can also use and basically does what you are trying to do in one line.

Function

2010-02-07 20:27:31

From: YoHoJo
Take a gander at Tarajunky's chicken killer.
His non-members version is outdated, but the code is still beautiful, and I'm pretty sure I had a fail safe against attacking already in-combat chickens:

http://www.villavu.com/forum/showthread.php?t=4082


Thanks I think I got it but I'll deffinatly take a look.

Sex

2010-02-07 23:46:42

Ah, I hate when people do that (edit the original post out when they solved the problem).
Keep it in for archival purposes and if somebody else has the same problem!
I want to see it so can you please edit it back.

YoHoJo

2010-02-08 00:34:16

I did it :]
Also, I agree, great attitude sex!

Function

2010-02-08 20:21:38

From: Sex
Ah, I hate when people do that (edit the original post out when they solved the problem).
Keep it in for archival purposes and if somebody else has the same problem!
I want to see it so can you please edit it back.


Sorry about that, but it was a dumb mistake. :p

From: YoHoJo
I did it :]
Also, I agree, great attitude sex!


Thanks savin' me time :)

Timer

2010-02-08 21:01:23

You can steal it from my Feathers!
The whole script is still fully functional.
EDIT:
function UnderAttack(fx, fy: Integer): Boolean;
var
Nom: TPointArray;
CTS: Integer;
begin
if (not LoggedIn) then
Exit;
FindNormalRandoms;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(2.60, 0.27);
FindColorsSpiralTolerance(MSCX, MSCY, Nom, 8420611, fx - 25, fy - 25, fx + 25, fy, 19);
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Result := Length(Nom) > 20;
end;
There.. Should work.. use ie..
if (not UnderAttack(MiddleTPA of chicken x, Middle TPA of chicken y)) then
…
else
Continue;/NextChickenCode

Function

2010-02-08 23:06:29

From: Timer
You can steal it from my Feathers!
The whole script is still fully functional.
EDIT:
function UnderAttack(fx, fy: Integer): Boolean;
var
Nom: TPointArray;
CTS: Integer;
begin
if (not LoggedIn) then
Exit;
FindNormalRandoms;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(2.60, 0.27);
FindColorsSpiralTolerance(MSCX, MSCY, Nom, 8420611, fx - 25, fy - 25, fx + 25, fy, 19);
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Result := Length(Nom) > 20;
end;
There.. Should work.. use ie..
if (not UnderAttack(MiddleTPA of chicken x, Middle TPA of chicken y)) then
…
else
Continue;/NextChickenCode


Thanks! I'll totally look into this, but right now I'm to tired and am off to bed. So thanks.