SRL Archive - OSR Help

MSI's Object Finding [ pretty point cloud lol ]


sm0k3

2011-05-16 07:32:38

just a question

i want MSI object finding … lol

well more specificly i would like to get a script of mine to do that cool colour thing that msi does with tree finding or is it when it looks for nests

it creates a kind of green [ point-cloud? ]

i would guess it srl object finding function or possibly reflection?

and how would i go about using this [ if MSI dosent mind .. :) ]

Bobzilla69

2011-05-16 07:45:35

all it is is a TPA of the locaion the colour is found and at the height asked for.

the colour bit is simply DebugATPA or DebugTPA depending on what you use, think MSI uses ATPA.

its somthing like


if FindColorsSpiral(TPA, color, x1, y1, x2, y2, xc, yc) then
begin
ATPA:= SortTPA(20, 20);
DebugATPA(ATPA, '');
end;

i am sure i got its wrong, but thats the basic idea, cant give better answer at work sorry

edit:

i think i got the functions right, maybe not FindColorsSpiral but its close

sm0k3

2011-05-16 08:16:26

thank you ill give this a try later ..

also ive seen in tribot / rsbuddy the same kind of [Pointcloud] effect . altho in tribot for example when finding a gate or fence there will be wireframe overlay [see pic]


will DebugTPA or ATPA do the same thing

Bobzilla69

2011-05-16 08:46:11

hmmm no it wont, the wireframe thing is a reflection/SMART thing (i think)

NCDS

2011-05-16 10:29:37

No no no.

The "point cloud" your referring to is simply Drawing on SMART's canvas. There a re a few different functions to do this in SRL.

The points that are drawn are the point returned in your array after searching for the color(s).

Did you mean you also want the accuracy of MSI's object finding? or just the look?

sm0k3

2011-05-16 10:50:39

From: NCDS
No no no.

The "point cloud" your referring to is simply Drawing on SMART's canvas. There a re a few different functions to do this in SRL.

The points that are drawn are the point returned in your array after searching for the color(s).

Did you mean you also want the accuracy of MSI's object finding? or just the look?



i know its just Drawing on smart ..
i would like the look .

just as research i wish to try to recreat the image in my post above

i am trying to create an object recognition system
for example
Looking for a gate
when it finds the color and uptext of the gate it will
then Draw the wireframe of a gate (like in above post)
at the coords of the gate
then attempt to match the wireframe to the actual gate
when they match then the script knows its found the actual gate not a similar color object ( i know thats what the uptexts for )
if the wireframe dosent match it'l shift the Wireframe Around a little
and check again.

i know it sounds a little pointless but its just for fun

altho if i can get it to work i do have a few "Secret" Projects on the way :)

NCDS

2011-05-16 11:00:41

From: sm0k3
i know its just Drawing on smart ..
i would like the look .

just as research i wish to try to recreat the image in my post above

i am trying to create an object recognition system
for example
Looking for a gate
when it finds the color and uptext of the gate it will
then Draw the wireframe of a gate (like in above post)
at the coords of the gate
then attempt to match the wireframe to the actual gate
when they match then the script knows its found the actual gate not a similar color object ( i know thats what the uptexts for )
if the wireframe dosent match it'l shift the Wireframe Around a little
and check again.

i know it sounds a little pointless but its just for fun

altho if i can get it to work i do have a few "Secret" Projects on the way :)

All you would have to do is search for the object, sort your points, and accurately find the object then draw the points on SMART.


DrawDotsMulti(true, ATPA);
That's all we use in MSI to create the effect.

sm0k3

2011-05-16 11:24:10

when you say search for the object and sort your Points…

what do you mean by sort my points ..? and how ..?

NCDS

2011-05-16 12:44:59

From: sm0k3
when you say search for the object and sort your Points…

what do you mean by sort my points ..? and how ..?


Well, you would be using color to search for the object with FindColorsTolerance (or something similar) and those functions will Return an array of points found that match the color you searched for.

As far as sorting goes, that's really up to you. Split into an ATPA and check your width and height. Check your min and max color count, etc. There are quite a few possibilities.

sm0k3

2011-05-16 12:59:36

thnaks its just the DrawDotsmulti that dosent exist according to simba

Coh3n

2011-05-16 13:07:12

From: sm0k3
thnaks its just the DrawDotsmulti that dosent exist according to simba

You have to include paintsmart.scar in your script:

{$i srl/srl/misc/paintsmart.scar}

sm0k3

2011-05-16 13:14:36

ohhh … lol i write a function everytime i want to draw to smart lol didnt even know that existed lol … :(

Coh3n

2011-05-16 13:18:55

From: sm0k3
ohhh … lol i write a function everytime i want to draw to smart lol didnt even know that existed lol … :(

It happens. :p

As for recognizing a fence (comparing a "wire-frame" like you said), the best way to do that in color would be to compare the length of the TPA from the object found to the length of the TPA that should be found. If the lengths are within a certain range, chances are you've found the right object.

sm0k3

2011-05-16 15:00:05

yeh sounds like a good idea ..

i was playing with the idea of building an array out of the dots to create the wire-frame

the modal of a gate will allways have a load of points the same distance from each other
for example the top 'rail' of the gate should allways be the same distance from the bottom 'rail' . just as the two rails in between them should allways be in the same position between them

i was going to build an array out of these distances / positions and create a wire frame from that , then check that wireframe against the object in game

not sure if that makes sense :) but thats was the basic idea

i need to find way of creating a wireframe out of a TPointArray
all i need to do is minimise the amount of points to the basic shape of the object
and then somehow draw lines between the remainong Tpoints

i may start off with something like this:

……………….
……………….
……………….
……………….

^ supposed to represent a T2DPointArray of a box on SMARTs Canvas
and then end up with this..

. _________.
| …………. |
| …………. |
'————–'
^ supposed to ba a representation of The WireFrame lol i know its rubbish but
hopfully you all get the idea

Brandon

2011-05-16 17:02:07

/Reflection/Core/RefPaint..

R_DebugObjects
R_DebugNPCs
R_DrawTile
R_DrawTileHeight

Forgot what include but:

SetPixel or SetTransparentPixel would work..

Example: After colouring the whole object, set every –[few pixels + a radius]– transparent.
This would create that wireframe look.

Look at those and I guess