SRL Archive - OSR Intermediate Scripting Tutorials

Surfaces! - Accurate way of locating objects in RuneScape.


superuser

2013-03-30 11:58:35

Good day folks,

I wanted to explain and show my surfaces-system, which should be quite useful for finding objects accurately in RuneScape.
You might have seen it in action in my script Irony. So, to cut the chase, the basic part of a surface consists of the following
structure:


type
TSurfacePart = record
// The filter function which ultimately decides which surface to pick up.
filter: TSurfacePartFilterFunc;

// Hue modifier.
hm: extened;

// Saturation modifier.
sm: extended;

// Color.
c: integer;

// Tolerance.
t: integer;

// Minimum width of the surface.
minw: integer;

// Maximum width of the surface.
maxw: integer;

// Minimum height of the surface.
minh: integer;

// Maximum height of the surface.
maxh: integer;

// Offset Y-axis, from the median.
off_y: integer;

// Offset X-axis, from the median.
off_x: integer;

// A simple TBox containing the bounds of the surface.
bounds: TBox;

// Pixel density / distance.
step: integer;

// Ignore, for internal use.
index: integer;

// The point where the surface was found.
p: TPoint;

// Ignore, for internal use.
base_atpa: T2DPointArray;

// Maximum distance allowed, where the surface can be found.
max_distance: integer;
end;

One of the useful things about the system is that you can define a surface object which
constructs out of multiple surfaces. This ensures great accuracy.

Maybe it's the best to demonstrate this through an example. Lets take an iron rock and try to detect it, closest to us
and as accurately as possible! First off, you need to define your surface variable for the rock itself. Not iron rock, but an
empty one instead! Lets call it..


var
surface_rock: TSurfacePart;

Fantastic, now lets put there some values:


// c, hm, sm and t can be neatly found with the wonderful ACA.

with surface_rock do begin
c := 3367539;
hm := 0.02;
sm := 0.07;
t := 16;
minw := 4; // At least 4 pixels wide.
maxw := 80; // No more than 80 pixels wide.
minh := 4; // At least 4 pixels tall.
maxh := 80; // No more than 80 pixel tall.
step := 9;
max_distance := 200;
end;

We can use now surface_rock as a base for all type of rocks, like iron, mithril and adamantite, since all of those has the same
looking rock when its empty or mined.

Now, lets define our iron rock surface object:


var
obj_iron_rock: TSurfaceObject;

As explained above, we use the base surface for all type of rocks:


// We need two different surfaces for iron rock. The rock and the brown part in middle of it.
// Remember, the consecutive parts has to be found inside the previous one.
CreateSurfaceParts(obj_iron_rock, 2);

with obj_iron_rock do begin
// So, the first part we copy:
parts[0] := CopySurfacePart(surface_rock);

// And then the second one, which is the brown part in iron rock when it's not mined yet.
// For mithril, you can use ACA for the blue-part, etc.
parts[1].c := 2831959;
parts[1].hm := 0.05;
parts[1].sm := 0.64;
parts[1].t := 10;
parts[1].filter := @SurfaceFilterClosest; // We want to have the closest iron rock next to us.
parts[1].minw := 1;
parts[1].maxw := parts[0].maxw;
parts[1].minh := 1;
parts[1].maxh := parts[0].maxh;
parts[1].step := 16;
parts[1].max_distance := parts[0].max_distance;

name := 'Iron ore';
uptext := 'Iron';
filter := @SurfaceFilterClosest;
end;

That's pretty much the basics. Now if you want to find an iron rock, you can simply call


if FindSurfaceObject(obj_iron_rock, MSX1, MSY1, MSX2, MSY2) then begin
WriteLn('Found the iron rock!');

// Now you can click the iron rock, if you wish..

with obj_iron_rock do
Mouse(p.x, p.y, 2, 2, mouse_left);
end;

and you should get this:


If you want the system to automatically click it, you can call


if ClickSurfaceObject(obj_iron_rock, true) then // False for left click through menu instead.
WriteLn('Clicked iron ore!');

You can download su_surfaces.simba, which contains all the necessary functions etc. To summarize, here's the actual script
which find you the iron ore:


program surfaces;

{$DEFINE SMART}

{$i srl\srl.simba}
{$i srl\srl\misc\SmartGraphics.simba}

{$i su_surfaces.simba}

var
surface_rock: TSurfacePart;
obj_iron_rock: TSurfaceObject;

procedure Init();
begin
SetupSRL();
SMART_ClearMS();

with surface_rock do begin
c := 3367539;
hm := 0.02;
sm := 0.07;
t := 16;
minw := 4; // At least 4 pixels wide.
maxw := 80; // No more than 80 pixels wide.
minh := 4; // At least 4 pixels tall.
maxh := 80; // No more than 80 pixel tall.
step := 9;
max_distance := 200;
end;

CreateSurfaceParts(obj_iron_rock, 2);

with obj_iron_rock do begin
// So, the first part we copy:
parts[0] := CopySurfacePart(surface_rock);

// And then the second one, which is the brown part in iron rock when it's not mined yet.
parts[1].c := 2831959;
parts[1].hm := 0.05;
parts[1].sm := 0.64;
parts[1].t := 10;
parts[1].filter := @SurfaceFilterClosest; // We want to have the closest iron rock next to us.
parts[1].minw := 1;
parts[1].maxw := parts[0].maxw;
parts[1].minh := 1;
parts[1].maxh := parts[0].maxh;
parts[1].step := 16;
parts[1].max_distance := parts[0].max_distance;

name := 'Iron ore';
uptext := 'Iron';
filter := @SurfaceFilterClosest;
end;
end;

begin
Init();

if FindSurfaceObject(obj_iron_rock, MSX1, MSY1, MSX2, MSY2) then begin
WriteLn('Found the iron rock at ' + IntToStr(obj_iron_rock.p.x) + ', ' + IntToStr(obj_iron_rock.p.y));
end;
end.

There's still more to the surfaces, but this'll get you started. Please shoot if you have any guestions.

Edit:

Just a curious thought, but it would be possible to create huge database of various objects (surfaces) of RuneScape. Now
wouldn't that be nice, eh?

All the best,
superuser

wthomas

2013-03-30 12:08:01

First, :) this looks really nice. The example you provide is exactly how my Lumbridge miner works, it first finds all the empty rocks then finds the ore veins inside them.

Runehack123

2013-03-30 12:10:33

wow this really nice
I will use in all my script if I make a script k bye

King

2013-03-30 12:31:20

This is awesome! im going to try this out in some scripts I am making I'll post the results!(:

Flight

2013-03-30 12:35:10

Really nice job with this superuser!

Runehack123

2013-03-30 12:45:45

have you use for anything else than mining?
like treeS?

superuser

2013-03-30 12:49:43

From: Runehack123
have you use for anything else than mining?
like treeS?


Yeah, take a look at Superuser's Arctic Pines :)

Runehack123

2013-03-30 12:52:25

From: superuser
Yeah, take a look at Superuser's Arctic Pines :)


will do thanks
this is so nice

superuser

2013-03-30 12:57:09

From: Flight
Really nice job with this superuser!

From: SRLKing
This is awesome! …

From: Runehack123
wow this really nice …


Thanks ya'll. I know I didn't give the most explaining tutorial, but please, try it out and as I said, ask if you got something on your mind!

Runehack123

2013-03-30 12:58:17

From: superuser
Thanks ya'll. I know I didn't give the most explaining tutorial, but please, try it out and as I said, ask if you got something on your mind!


maybe brief summary at top for tl;dr user :o would help some people
or summary at bottom

Ashaman88

2013-03-30 23:36:33

Very nice guide man!

Total

2013-03-31 00:00:30

Looks very accurate, thanks for sharing!

serajin

2013-03-31 00:01:27

superuser, how does this compare to say…getting the colors in a TPA, and then sorting the TPA/ATPA and scanning it by size?

King

2013-03-31 00:03:06

From: serajin
superuser, how does this compare to say…getting the colors in a TPA, and then sorting the TPA/ATPA and scanning it by size?


Ive used it in a mining script and seems to be more reliable for me, and has a much wider range of uses. TPA/ATPA's only go so far, this works very well for things like banking(;

serajin

2013-03-31 00:04:33

Cool stuff. I'll have to give it a go in my next script then.

superuser

2013-03-31 04:56:34

From: serajin
superuser, how does this compare to say…getting the colors in a TPA, and then sorting the TPA/ATPA and scanning it by size?


It's pretty much what you say, but the include gives you much more flexibility and convenience.

litoris

2013-03-31 06:31:46

Very nice! I never knew about surfaces, and this looks os professional :) I do a watered down version of this in my miner, using two colors for the iron rock, but this is insane!
You should make this support other CTS's (cts 1 is much faster tough less accurate, cts 3 is kinda slow but more accurate, and its easier to pick colors for cts 1)

superuser

2013-03-31 07:02:39

From: litoris
Very nice! I never knew about surfaces, and this looks os professional :) I do a watered down version of this in my miner, using two colors for the iron rock, but this is insane!
You should make this support other CTS's (cts 1 is much faster tough less accurate, cts 3 is kinda slow but more accurate, and its easier to pick colors for cts 1)


Trust me, this is fast enough (CTS2) ;) Beats constantly Java-bots at the same area :)

serajin

2013-03-31 14:50:41

From: superuser
It's pretty much what you say, but the include gives you much more flexibility and convenience.


Cool stuff! I'll give it a go =D

dzpliu

2013-04-04 09:15:44

does this work with objects without >2 color? since iron ore has a base empty ore color state, and an iron ore color. does it work with, lets say mithril ore when it was wholely colored blueish.

superuser

2013-04-04 10:15:47

From: dzpliu
does this work with objects without >2 color? since iron ore has a base empty ore color state, and an iron ore color. does it work with, lets say mithril ore when it was wholely colored blueish.


Yes, it works with one part as well. You can define as many parts as you wish. And yes, it works with mithril ore as well.

t4q

2013-04-05 21:20:53

very nice guide!

dzpliu

2013-04-06 04:44:46

how do i use this to search multi-objects? lets say there are 2 type of this butterfly of different color in this specified area, i wan to use it to find both of them and catch either one if it detects them.

Le Jingle

2013-04-09 22:30:35

From: dzpliu
how do i use this to search multi-objects? lets say there are 2 type of this butterfly of different color in this specified area, i wan to use it to find both of them and catch either one if it detects them.


I'd assume (didn't test nor study superuser's [awesome] code), that you could simply create two variables of the type TSurfaceObject and search for both. This would probably be an unoptimized approach, but also the more simple to use if you're not fully aware of every/most things happening in the code (the butterfly's could potentially differ to the extent where they don't share very many parts either).

rj

2013-04-14 13:50:30

I'm confused, how do you make 2 parts?

@superuser
procedure InitRocks();
begin
SMART_ClearMS();

with surface_rock do begin
c := 1070711;
hm := 0.02;
sm := 0.19;
t := 6;
minw := 4; // At least 4 pixels wide.
maxw := 80; // No more than 80 pixels wide.
minh := 4; // At least 4 pixels tall.
maxh := 80; // No more than 80 pixel tall.
step := 9;
max_distance := 200;
end;

CreateSurfaceParts(obj_coal_rock, 2);

with obj_coal_rock do begin
// So, the first part we copy:
parts[0] := CopySurfacePart(surface_rock);

// And then the second one, which is the brown part in iron rock when it's not mined yet.
parts[1].c := 1251873;
parts[1].hm := 1.39;
parts[1].sm := 4.49;
parts[1].t := 6;
parts[1].filter := @SurfaceFilterClosest; // We want to have the closest iron rock next to us.
parts[1].minw := 5;
parts[1].maxw := parts[0].maxw;
parts[1].minh := 5;
parts[1].maxh := parts[0].maxh;
parts[1].step := 16;
parts[1].max_distance := parts[0].max_distance;

name := 'Coal ore';
uptext := 'Coal';
filter := @SurfaceFilterClosest;
end;


with surface_bank do begin
c := 6713206;
hm := 0.29;
sm := 0.08;
t := 5;
minw := 4; // At least 4 pixels wide.
maxw := 40; // No more than 80 pixels wide.
minh := 4; // At least 4 pixels tall.
maxh := 100; // No more than 80 pixel tall.
step := 9;
max_distance := 250;
end;

CreateSurfaceParts(obj_Deposite, 2);

with obj_deposite do begin
// So, the first part we copy:
parts[1] := CopySurfacePart(surface_bank);

// And then the second one, which is the brown part in iron rock when it's not mined yet.
parts[1].c := 6653336;
parts[1].hm := 0.11;
parts[1].sm := 0.39;
parts[1].t := 3;
parts[1].filter := @SurfaceFilterClosest; // We want to have the closest iron rock next to us.
parts[1].minw := 5;
parts[1].maxw := parts[1].maxw;
parts[1].minh := 5;
parts[1].maxh := parts[1].maxh;
parts[1].step := 16;
parts[1].max_distance := parts[1].max_distance;

name := 'Deposite booth';
uptext := 'deposite';
filter := @SurfaceFilterClosest;
end;
end;

Does not seem to work?

Itankbots

2013-04-15 21:32:44

From: superuser
Yes, it works with one part as well. You can define as many parts as you wish. And yes, it works with mithril ore as well.


Two questions.

1. Would this work on monsters? Or can it only be objects that are always in the same spot

2. If the object your looking for does not have 2 colors (un-Like how a rock is two objects, empty and full.) How to do make a function for that? Do you use both like for the iron rock? An example of using it on 1 color item(like finding a waterfiend, who only is one color, blue) would be helpful if you have the time :) cheers

sdf

2013-04-23 06:20:13

From: Officer Barbrady
I'm confused, how do you make 2 parts?

Does not seem to work?


parts[1] := CopySurfacePart(surface_bank);

should be

parts[0] := CopySurfacePart(surface_bank);

since you've defined 2 objects at
CreateSurfaceParts(obj_Deposite, 2);


parts[1].maxw := parts[1].maxw;
parts[1].minh := 5;
parts[1].maxh := parts[1].maxh;
parts[1].step := 16;
parts[1].max_distance := parts[1].max_distance;

Those should be changed accordingly, since you've made them equal to themselves?

Sk1nyNerd

2013-04-24 00:04:35

super cool! can u use with DTM's so it can be found at different angles or objects that aren't a static x,y?

euphemism

2013-04-24 00:37:50

From: Itankbots
Two questions.

1. Would this work on monsters? Or can it only be objects that are always in the same spot

2. If the object your looking for does not have 2 colors (un-Like how a rock is two objects, empty and full.) How to do make a function for that? Do you use both like for the iron rock? An example of using it on 1 color item(like finding a waterfiend, who only is one color, blue) would be helpful if you have the time :) cheers


Yes, this will work with monsters.

If the object you are searching for has only one color, then you need only one surface part for the surface object.

From: ibot_dung11
super cool! can u use with DTM's so it can be found at different angles or objects that aren't a static x,y?


In most cases you really do not need to rotate the camera. In the instances that you do, you just need to make sure the variations of the width and height of the object fall within the min/max of the width and height of your surface object.

Sk1nyNerd

2013-05-01 17:20:22

From: superuser
// c, hm, sm and t can be neatly found with the wonderful ACA.


whats ACA and how do i access it?
edit: figured it out

From: euphemism
Yes, this will work with monsters.

If the object you are searching for has only one color, then you need only one surface part for the surface object.



so i wanna try this to find a nearby NPC because other methods have failed to do so/i cant quite figure them out- what if i want to find a human NPC that has multiple colors? do i litterally need to create a surface for every color (skin, clothes, hair, shield, ect) or can i pick a couple colors that help define the NPC over other surrondings?

Peanuts

2013-05-26 05:43:49

HELP :(

=.=

im confused..

Sometimes it will create a box like that… on certain angles n positions…
.like.. it.. uhh….

[ATTACH=CONFIG]21445[/ATTACH]

EDIT: Anybody.. ? Tried changing box sizes etc.. but mmm.. to no avail.

rj

2013-05-26 09:54:34

From: Peanuts
HELP :(

=.=

im confused..

Sometimes it will create a box like that… on certain angles n positions…
.like.. it.. uhh….

[ATTACH=CONFIG]21445[/ATTACH]

EDIT: Anybody.. ? Tried changing box sizes etc.. but mmm.. to no avail.


Change the size of the MAX width and height.

Peanuts

2013-05-28 06:25:34

From: Officer Barbrady
I'm confused, how do you make 2 parts?

@superuser
procedure InitRocks();
begin
SMART_ClearMS();

with surface_rock do begin
c := 1070711;
hm := 0.02;
sm := 0.19;
t := 6;
minw := 4; // At least 4 pixels wide.
maxw := 80; // No more than 80 pixels wide.
minh := 4; // At least 4 pixels tall.
maxh := 80; // No more than 80 pixel tall.
step := 9;
max_distance := 200;
end;

CreateSurfaceParts(obj_coal_rock, 2);

with obj_coal_rock do begin
// So, the first part we copy:
parts[0] := CopySurfacePart(surface_rock);

// And then the second one, which is the brown part in iron rock when it's not mined yet.
parts[1].c := 1251873;
parts[1].hm := 1.39;
parts[1].sm := 4.49;
parts[1].t := 6;
parts[1].filter := @SurfaceFilterClosest; // We want to have the closest iron rock next to us.
parts[1].minw := 5;
parts[1].maxw := parts[0].maxw;
parts[1].minh := 5;
parts[1].maxh := parts[0].maxh;
parts[1].step := 16;
parts[1].max_distance := parts[0].max_distance;

name := 'Coal ore';
uptext := 'Coal';
filter := @SurfaceFilterClosest;
end;


with surface_bank do begin
c := 6713206;
hm := 0.29;
sm := 0.08;
t := 5;
minw := 4; // At least 4 pixels wide.
maxw := 40; // No more than 80 pixels wide.
minh := 4; // At least 4 pixels tall.
maxh := 100; // No more than 80 pixel tall.
step := 9;
max_distance := 250;
end;

CreateSurfaceParts(obj_Deposite, 2);

with obj_deposite do begin
// So, the first part we copy:
parts[1] := CopySurfacePart(surface_bank);

// And then the second one, which is the brown part in iron rock when it's not mined yet.
parts[1].c := 6653336;
parts[1].hm := 0.11;
parts[1].sm := 0.39;
parts[1].t := 3;
parts[1].filter := @SurfaceFilterClosest; // We want to have the closest iron rock next to us.
parts[1].minw := 5;
parts[1].maxw := parts[1].maxw;
parts[1].minh := 5;
parts[1].maxh := parts[1].maxh;
parts[1].step := 16;
parts[1].max_distance := parts[1].max_distance;

name := 'Deposite booth';
uptext := 'deposite';
filter := @SurfaceFilterClosest;
end;
end;

Does not seem to work?



Not sure if this is your problem…

but.. the uptext is deposit box.. Not deposite

OR

With the deposit box you will only need one colour so you could you could just use..

  CreateSurfaceParts(_object_deposit_box, 1);

with _object_deposit_box do begin
parts[0].c := 6719386;
parts[0].hm := 0.11;
parts[0].sm := 0.51;
parts[0].t := 3;
parts[0].filter := @SurfaceFilterClosest;
parts[0].minw := 6;
parts[0].maxw := 30;
parts[0].minh := 6;
parts[0].maxh := 30;
parts[0].step := 16;
parts[0].max_distance := 999;

name := 'Deposit box';
uptext := 'box';
end;

Peanuts

2013-05-29 14:05:34

any idea how i would get the mouse to hover over box?

Solved. Edited a surfaces.srl function..
So simple..
Gotta think more peanuts!

armthehomeless

2013-07-02 08:26:55

First off, VERY cool stuff here!

I tried messing around with it in a goblin script I am working on and a weird glitch
http://imgur.com/kGL1zPu

procedure Init();
begin

SMART_ClearMS();

with surface_Goblin do begin
c := 3299668;
hm := 0.11;
sm := 0.07;
t := 10;
minw := 5; // At least 4 pixels wide.
maxw := 25; // No more than 80 pixels wide.
minh := 20; // At least 4 pixels tall.
maxh := 60; // No more than 80 pixel tall.
step := 9;
max_distance := 200;
end;

CreateSurfaceParts(obj_Green_Goblin, 2);

with obj_Green_Goblin do begin
// So, the first part we copy:
parts[0] := CopySurfacePart(surface_Goblin);

// And then the second one, which is the brown part in iron rock when it's not mined yet.
parts[1].c := 3299668;
parts[1].hm := 0.11;
parts[1].sm := 0.07;
parts[1].t := 10;
parts[1].filter := @SurfaceFilterClosest; // We want to have the closest iron rock next to us.
parts[1].minw := 1;
parts[1].maxw := parts[0].maxw;
parts[1].minh := 1;
parts[1].maxh := parts[0].maxh;
parts[1].step := 16;
parts[1].max_distance := parts[0].max_distance;

name := 'Goblin';
uptext := 'Goblin';
filter := @SurfaceFilterClosest;
end;
end;


if FindSurfaceObject(obj_Green_Goblin, MSX1, MSY1, MSX2, MSY2) then
begin
with obj_Green_Goblin do
Mouse(p.x, p.y, 2, 2, mouse_left);


Any idea on what I messed up??

superuser

2013-07-02 08:34:08

From: armthehomeless
First off, VERY cool stuff here!

I tried messing around with it in a goblin script I am working on and a weird glitch
http://imgur.com/kGL1zPu

procedure Init();
begin

SMART_ClearMS();

with surface_Goblin do begin
c := 3299668;
hm := 0.11;
sm := 0.07;
t := 10;
minw := 5; // At least 4 pixels wide.
maxw := 25; // No more than 80 pixels wide.
minh := 20; // At least 4 pixels tall.
maxh := 60; // No more than 80 pixel tall.
step := 9;
max_distance := 200;
end;

CreateSurfaceParts(obj_Green_Goblin, 2);

with obj_Green_Goblin do begin
// So, the first part we copy:
parts[0] := CopySurfacePart(surface_Goblin);

// And then the second one, which is the brown part in iron rock when it's not mined yet.
parts[1].c := 3299668;
parts[1].hm := 0.11;
parts[1].sm := 0.07;
parts[1].t := 10;
parts[1].filter := @SurfaceFilterClosest; // We want to have the closest iron rock next to us.
parts[1].minw := 1;
parts[1].maxw := parts[0].maxw;
parts[1].minh := 1;
parts[1].maxh := parts[0].maxh;
parts[1].step := 16;
parts[1].max_distance := parts[0].max_distance;

name := 'Goblin';
uptext := 'Goblin';
filter := @SurfaceFilterClosest;
end;
end;


if FindSurfaceObject(obj_Green_Goblin, MSX1, MSY1, MSX2, MSY2) then
begin
with obj_Green_Goblin do
Mouse(p.x, p.y, 2, 2, mouse_left);


Any idea on what I messed up??


Hi,

Yeah, you are not experiencing a glitch, but misconfiguration instead ;) For instance, I can see that the second part is having the same color as first one. What I would do, is that have only one part, which is the greenish one.

armthehomeless

2013-07-02 08:57:21

Thanks for the fast rely :) How exactly would that syntax look? Do I still need the parts or can I pretty much comment out the second half (starting with CreateSurfacePart)?

Probably missing something super obvious, been up a few to many hours lol

EDIT: Got it figured out. had to add SMART_ClearMS(); an extra time inside my loop and change it to one part.

Omniusaspirer

2013-07-03 02:42:55

EDIT: Ignore all this, was able to get it working after looking through the surfaces include in the OP. My new question is how I could check within the drawn object repeatedly for when it no longer has a color. In other words: When I start siphoning an esshound, how do I get it to recheck the box periodically for the esshound colors and if it doesn't find them, find another esshound to siphon?

Hey!

I'm attempting to get this working currently for a runespan script, but I'm having uptext issues (I think) that I'm finding hard to troubleshoot. Here's the relevant bits of my code:

    //Cosmic Esshound
with surface_cosmic_essling do begin
c := 8441417;
hm := 0.95;
sm := 1.45;
t := 26;
minw := 20;
maxw := 50;
minh := 20;
maxh := 50;
step := 16;
max_distance := 200;
end;

CreateSurfaceParts(obj_cosmic_essling, 3);

with obj_cosmic_essling do begin
parts[0] := CopySurfacePart(surface_cosmic_essling);

parts[1].c := 9229402;
parts[1].hm := 1.37;
parts[1].sm := 2.13;
parts[1].t := 18;
parts[1].filter := @SurfaceFilterClosest;
parts[1].minw := 4;
parts[1].maxw := parts[0].maxw;
parts[1].minh := 4;
parts[1].maxh := parts[0].maxh;
parts[1].step := 16;
parts[1].max_distance := parts[0].max_distance;

parts[2].c := 7519801;
parts[2].hm := 1.30;
parts[2].sm := 2.19;
parts[2].t := 19;
parts[2].filter := @SurfaceFilterClosest;
parts[2].minw := 4;
parts[2].maxw := parts[0].maxw;
parts[2].minh := 4;
parts[2].maxh := parts[0].maxh;
parts[2].step := 16;
parts[2].max_distance := parts[0].max_distance;

name := 'Cosmic Esshound';
uptext := 'Cosmic';
filter := @SurfaceFilterClosest;
end;

And:

procedure Harvestessence;

begin

begin
SMART_ClearMS();
if FindSurfaceObject(obj_cosmic_essling, MSX1, MSY1, MSX2, MSY2) then

begin
with obj_cosmic_essling do
Mouse(p.x, p.y, 2, 2, mouse_left);

wait(5000+random(7042));
end else
begin
RotateMap;
Harvestessence;
end;
end;
Harvestessence;
end;

I've tried both the FindSurfaceObject and the ClickSurfaceObject approaches. The first finds the esshounds near flawlessly, but also is finding the vine platforms and chaos esshounds due to the yellow color. It's completely ignoring the uptext string I enter when creating the surface object initially and I'm not really sure why. I attempted to put in some other manual uptext detection stuff as a secondary "if" statement to force it to find the surface, then verify the uptext before clicking with no luck. It would find the wraith perfectly, but wouldn't find the uptext and thus never clicked.

Using ClickSurfaceObject was acting strangely in that it opened the menu for everything it did and would then check for the text in the right click options. So it was effective (I guess) in not clicking the platforms, but would still end up repeatedly right clicking the platform and then not selecting anything.

It's late here and I'm tired so I hope that covers it well enough. Any help would be very much appreciated as I feel like I've hit something of a brick wall. Thanks in advance. :)

l6bustank

2013-07-21 15:51:42

Can this be applied for finding moving objects (like NPCs in combat training)?

nickyvh

2013-07-27 19:44:52

Very nice man !

nickyvh

2013-07-27 20:05:03

Can i Use this in OSR

DrChill

2013-07-27 21:15:07

From: nickyvh
Can i Use this in OSR

I see no reason why you could not.

Yew Long

2013-07-28 07:34:48

Has anyone tried using this to find banks? I know there is a FindBank function but it does not have the bank I'm looking for.