PDA

View Full Version : FindTree(TreeType : String; Tol : Integer): Boolean



Cazax
03-29-2008, 10:26 PM
I was bored so i made a function:

function FindTree(var x,y : Integer; TreeType : String; Tol : Integer): boolean;
var
TreeColor : Integer;
TPA : TPointArray;
TPAA : T2DPointArray;
Name : string;
i,TTime : integer;
begin
case lowercase(TreeType) of
'oak': TreeColor := 4615266; Name := 'ak';
'willow': TreeColor := 4748399; Name := 'illow';
'tree': TreeColor := 1520939; Name := 'ree';
'yew': TreeColor := 3038299; Name := 'ree';
else
Writeln('Invalid option');
Result := False;
end;
MarkTIme(TTime);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, TreeColor, MSX1, MSY1, MSX2, MSY2, Tol);
if length(TPA) > 0 then
begin
TPAA := TPAtoATPAEx(TPA, 25, 25);
Writeln('Finding '+TreeType+' took: '+inttostr(TimeFromMark(TTime)));
for i:=0 to high(TPAA) do
begin
MiddleTPAEx(TPAA[i], x, y);
MMouse(x, y, 3, 3);
wait(50+random(50))
if isuptext(Name) then
GetMousePos(x, y);
Result := True;
end;
end else
Result := False;
end;

Will find the nearest tree aviable.

e.g:

if FindTree(x, y, 'Yew', 15) then Writeln('YaY');

P1nky
03-29-2008, 11:01 PM
its good :) just need more colors

ShowerThoughts
03-29-2008, 11:03 PM
Good job!

Cazax
03-29-2008, 11:20 PM
Good job!

hehe thanks

its good :) just need more colors

Maybe it need more colors, becouse all trees has a dark face, thanks anyways.

P.S: Can someone take pics of ents, gases, and send it to me ? im working on it.

Bobarkinator
03-29-2008, 11:23 PM
Why do people keep making functions like these when FindObjTPA already does it?

Cazax
03-29-2008, 11:26 PM
Why do people keep making functions like these when FindObjTPA already does it?

I posted it for feedback, for their opinion, not especially for using it.

Richard
03-29-2008, 11:29 PM
I think its good.

But what you could do is add in maple. As I found them good xp when I didn't quite have 60 wc.

P1nky
03-30-2008, 02:34 AM
maples are good but i noticed it has more randoms :P ents,nests and so on

nielsie95
03-30-2008, 09:17 PM
Try cts 2 with these options:

modifiers: (0.075, 0.075)
color: 3368537
tol: 30

instead of adding colors ;)

another tip; replace TPAtoATPAEx(TPA, 25, 25) with SplitTPAEx(tpa, 6, 6) (maybe even more than 6)..

EvilChicken!
03-30-2008, 11:18 PM
Niels, may I ask you what tool you used to find the modifiers?
And, telling us what tree that color is for wouldn't be bad either.. ^_^

Edit: Wow, thanks!

nielsie95
03-31-2008, 06:09 AM
I calculated those myself, but if I'd had to calculate them now, I'd use ACA v2. That color will find all trees. In my treefinder I'm looking for all the possible trees and then try to "see" what kind it is by the size.

Naum
04-07-2008, 04:16 PM
Maybe use an array, WillowCol e.t.c.

bullzeye95
04-07-2008, 04:57 PM
I calculated those myself, but if I'd had to calculate them now, I'd use ACA v2. That color will find all trees. In my treefinder I'm looking for all the possible trees and then try to "see" what kind it is by the size.

I don't think it's possible to determine with size alone, since a far away oak could look as big as a close tree. Other things would need to be added, such as TPA length, (possibly) density, etc.

nielsie95
04-07-2008, 09:01 PM
You're right :)
That's why I try to "see" what kind it is by the size :p
But I think size can help though.