SRL Archive - Jr. Member General Help and Discussion

Best way to find a tree?


Kaladin

2014-01-22 07:17:23

I think the color of the wood would be enough but yew trees are mostly leaf, and only the center is clickable?

I can see in Coh3ns draynor script that you can store a custom object and then find the middle? (I still need to look at it longer to fully understand)
but how do you find out information such as hue and sat for the colors? I tried the ACA tool without much success.

Thanks

EDIT: Okay, so from research so far I've seen a few things, but I'm not sure If I'm confusing versions, I made a BMP of the tree leaves and then planned to create a TBox and check for the BMP within those coords…

So I declared my var at the top, TreeBox1: Tbox;

then I tried to intialize it;

TreeBox1 := (358,402,702,805);   

That didn't work… Just attempting things and blindly working my way around :D

bonsai

2014-01-22 11:02:39

For help with ACA, I suggest watching Yohojo's video.

When you select the colors, make sure you have selected the radio button for CTS 2. After selecting all your colors, there is a 'best color' displayed. That's where you get your hue/sat from. Colors change a lot so it helps to grab a number of screenshots from different logins (computers, characters).

Bitmaps of the leaves will probably not work well since the colors will be too variable. I think one of the findcolor type functions will serve you better.

For the box init, you need brackets [] instead of parenthesis (). Or use intToBox(x,y,x2,y2).

Clarity

2014-01-22 11:29:48

bonsai covered your question but a side note since you wanted to use bitmaps:
Bitmaps are usually used for completely unchanging 2D elements, like dialogue options (their colors don't vary to my knowledge).
e.g. you might use bitmaps to choose what to say from these options.
Colors on mainscreen change a lot which is why we use tolerance/hue/sat/etc.

xtrapsp

2014-01-22 11:41:13

From: acredelta
bonsai covered your question but a side note since you wanted to use bitmaps:
Bitmaps are usually used for completely unchanging 2D elements, like dialogue options (their colors don't vary to my knowledge).
e.g. you might use bitmaps to choose what to say from these options.
Colors on mainscreen change a lot which is why we use tolerance/hue/sat/etc.


I would suggest learning how to use ACA with a TPA. it's really quite useful to help pick out the colours for the tree. When picking colours, hop between worlds until you get the perfect colour palette to find trees.

Kaladin

2014-01-22 12:41:25

Thank you very much for all the replies, that's cleared things up for me.
Will go have a read of these links :D

NKN

2014-01-22 14:03:36

If you're still looking, I'd split it into ATPA's using AutoColor, and then you can iterate through each TPA in the ATPA and get the middle of the TPA. It should result in a clickable portion of the tree. It's how I wrote my wood cutter script, anyway.

King

2014-01-22 18:00:29

From: NKN
If you're still looking, I'd split it into ATPA's using AutoColor, and then you can iterate through each TPA in the ATPA and get the middle of the TPA. It should result in a clickable portion of the tree. It's how I wrote my wood cutter script, anyway.


+1 This worked very well for me as well. I suggest it as well. Possibly still using a larger box base then searching within it as well.

Kaladin

2014-01-23 19:10:49

From: NKN
If you're still looking, I'd split it into ATPA's using AutoColor, and then you can iterate through each TPA in the ATPA and get the middle of the TPA. It should result in a clickable portion of the tree. It's how I wrote my wood cutter script, anyway.


Anychance you could expand on this? I looked at all the material above however the ACA + Autocolour stuff no longer really works?
I'm gonna use it for finding the best color ofc, what exactly is an APTA?

Thanks for your patience.

The Mayor

2014-01-23 20:28:40

From: agoson
Anychance you could expand on this? I looked at all the material above however the ACA + Autocolour stuff no longer really works?
I'm gonna use it for finding the best color ofc, what exactly is an APTA?

Thanks for your patience.


Just to give you a sneak preview to my tutorial:

The single red dot is a TPoint (i.e. a single pixel):


Multiple TPoints (such as the 13 or so pixels that match the gold colour) is called a TPointArray (TPA):


An Array of TPointArrays (also called a ATPA) is simply multiple TPAs grouped into an array:


So in this runescpae example we have 6 TPAs (all the red dots are TPoints) all grouped into an ATPA:


I posted this code in another thread today:


function findColor: boolean;
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;

begin
if not isLoggedIn then
exit;
// color // tol //CTS, hue, sat from ACA
if findColorsSpiralTolerance(x, y, TPA, 7916778, mainScreen.getBounds(), 10, colorSetting(2, 0.17, 2.72)) then

if (Length(TPA) < 1) then // if no matching TPoints are found, exit
exit;

ATPA := TPA.toATPA(30, 30); // split our TPA into boxes of 30 x 30 pixels and put into an ATPA
ATPA.sortFromMidPoint(mainscreen.playerPoint); // sort the array from player, so closest TPA to player is first in array
smartImage.debugATPA(ATPA);

for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE); // move move to each TPA one at a time, until we get a match
if isMouseOverText(['mayor', 'cool'], 500) then
begin
fastClick(MOUSE_LEFT);
smartImage.clear;
exit(true);
end;
end;
end;

Like in that example, if I sorted the ATPA from player point, each TPA sorted in the array in this order:


Savvy?

Kaladin

2014-01-23 21:12:38

I'm gonna study that right now, thank you so much man, looks like it will be a super informative tut if this is just a sneak peak <3

Turpinator

2014-01-24 12:44:34

From: agoson
TreeBox1 := (358,402,702,805);

if you had stayed in IRC for more than 5 seconds, you would have noticed that every time you asked, i replied with
intToBox(stuff);

Kaladin

2014-01-24 12:52:54

From: Turpinator
if you had stayed in IRC for more than 5 seconds, you would have noticed that every time you asked, i replied with
intToBox(stuff);


I got disconnected from IRC and then when I tried to login I kept getting "username already taken" xD Thanks very much though, appreciate that Turpinator.

Spartan 117

2014-01-26 04:44:51

@The Mayor If that's just a sneak peek of your tutorial, then I can't wait to see it. I wish someone had shown me that when I was learning tpa/atpa. Very nice!

The Mayor

2014-01-26 05:15:21

From: Spartan 117
@The Mayor If that's just a sneak peek of your tutorial, then I can't wait to see it. I wish someone had shown me that when I was learning tpa/atpa. Very nice!


You are behind the times! I released it yesterday - check the sig.