SRL Archive - SRL Archives

TPAFromColor - Improved TPA Finder


BazzBarrett

2008-09-25 14:04:22

Hi again =) ive been inspired to make a simpler more effective TPA Finder so here we are =) the script is compleatly my own but i would still like to say special thx to ProphesyOfWolf cuz he has thaugh me everytihng about TPA's and HSL's =) + giving me tips i wouldent be here making this if it wasent for him ;)

anyways this is much simpler than the old 1 so even noobs can use it =)

you may use the function as u please but just remember to credit me =) and hopfuly with the permision of the ammasing and kind Devs this may be even included in the next revision =D

X and Y = were to store to coodanates of the found object
Color = The color of your object (eg leafs for a tree the color of the ore for mining)
Tolerance = The Tolerance to search the color with
UpTextToCheck = The UpText to check with (eg Oak, Iron, Door, Bank)


Function TPAFromColor(Var X, Y : Integer; Color, Tolerance :Integer; UpTextToCheck : String):Boolean;
//By Bazzbarrett
var
CTS, II : Integer;
TPA : TPointArray;
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, Color, MSX1, MSY1, MSX2, MSY2, Tolerance);
ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(TPA, 15, 15);
For II := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[II], X, Y)
MMouse(X, Y, 2, 2);
Wait(50+Random(10));
If(IsUpText(UpTextToCheck))then
begin
Result := True;
GetMousePos(x, y);
Break;
end;
end;
end;

noidea

2008-09-25 16:44:18

Jeeze, cmon. Just make this guy an SRL member now. He keeps spitting out all of theese functions That are really use full. Good job!

BazzBarrett

2008-09-25 17:42:58

From: noidea
Jeeze, cmon. Just make this guy an SRL member now. He keeps spitting out all of theese functions That are really use full. Good job!


lol im gonna make another theard in about 30 secs u though this was gud u will love my new 1 XD

Nava2

2008-09-27 00:07:10

What about just doing FindObjTPA?

Sorry. I feel like I'm putting you down. I shouldn't be, but just look at other functions previously made. :)

BazzBarrett

2008-09-27 16:59:11

From: Nava2
What about just doing FindObjTPA?

Sorry. I feel like I'm putting you down. I shouldn't be, but just look at other functions previously made. :)


0.0 I whent through every include i cant belive i missed teh object 1 :'( o well still a hell of a lot less complicated XD altough
function FindObj(var  cx, cy: Integer; Text: string; Color, Tol: Integer): Boolean; 
that basicaly does wat my 1 does.. =\ just that has a few more failsafes o well i wish some1 had mensioned this earlier XD im gonna start using that in that case..

noidea

2008-09-27 17:49:23

From: bazzbarrett
0.0 I whent through every include i cant belive i missed teh object 1 :'( o well still a hell of a lot less complicated XD altough
function FindObj(var  cx, cy: Integer; Text: string; Color, Tol: Integer): Boolean; 
that basicaly does wat my 1 does.. =\ just that has a few more failsafes o well i wish some1 had mensioned this earlier XD im gonna start using that in that case..


Don't use FindObj ;) Its very old and there are plenty of better functions.

BazzBarrett

2008-09-27 17:57:37

From: noidea
Don't use FindObj ;) Its very old and there are plenty of better functions.


Seems all very complicated and unessaery to me o well i realy like my 1 ^^ (actuly i just gereraly prefer 1s ive made cuz i know wat to do if they dnt work correctly were as i havent the slighist when i look in the includes XD)

Nava2

2008-09-28 01:22:40

Yours is better, just it seems a lot of people are writing recursively the same thing.

Its no fun to read :(

BazzBarrett

2008-09-30 14:10:51

From: Nava2
Yours is better, just it seems a lot of people are writing recursively the same thing.

Its no fun to read :(


i know wat u mean i get the fealing this is my bad =\ shame i wasent member when i first posted it otherwise i would have put it in there XD maybe we could start a discusion up on the best way to put somthing along these lines into the includes?