SRL Archive - Research & Development Lounge

FindTree(TreeType : String; Tol : Integer): Boolean


Cazax

2008-03-29 18:26:15

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

2008-03-29 19:01:50

its good :) just need more colors

ShowerThoughts

2008-03-29 19:03:00

Good job!

Cazax

2008-03-29 19:20:52

From: Hermpie
Good job!


hehe thanks
From: p1nky
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

2008-03-29 19:23:01

Why do people keep making functions like these when FindObjTPA already does it?

Cazax

2008-03-29 19:26:19

From: Bobarkinator
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

2008-03-29 19:29:21

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

2008-03-29 22:34:11

maples are good but i noticed it has more randoms :P ents,nests and so on

nielsie95

2008-03-30 17:17:15

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!

2008-03-30 19:18:03

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

2008-03-31 02:09:32

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

2008-04-07 12:16:32

Maybe use an array, WillowCol e.t.c.

bullzeye95

2008-04-07 12:57:47

From: nielsie95
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

2008-04-07 17:01:37

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.