SRL Archive - OSR Help

Tunnel finding help?


Ian

2013-02-14 15:39:25

Hey, I'm wondering what a good way of finding one of these tunnels would be. It doesn't matter which one, any of them will work. The problem is that the tunnel color is the same color as the large nothingspace that surrounds the cave. Tunnel entrances are circled in blue.

E: The second tunnel from the left isn't actually accessible, so ignore that one.


Thanks

Neodymium

2013-02-14 15:53:31

I would try searching for the "nothingness" color, and make sure the cream color is within a certain distance of that. If needed, you could look for the pillar color as well.
RemoveDistTPointArray should do it (removing all points that are not withing 30 pixels for example). FindTPACluster may do the trick as well (I haven't tried it yet though).

Ian

2013-02-14 16:12:43

From: Neodymium
I would try searching for the "nothingness" color, and make sure the cream color is within a certain distance of that. If needed, you could look for the pillar color as well.
RemoveDistTPointArray should do it (removing all points that are not withing 30 pixels for example). FindTPACluster may do the trick as well (I haven't tried it yet though).


I think I'm going to try MMToMS first, but thanks for the suggestions :)

Olly

2013-02-14 16:18:18

you guys way overthink things :p


?

Ian

2013-02-14 16:40:41

I have to say Olly, that is easier. I still need think of a way to avoid the pink one though.

DannyRS

2013-02-14 16:45:24

From: Ollybest
you guys way overthink things :p


?


another tip, tunnel/black shifts between 0 and 1 in RS, tolerance wont do alone on 0, so CTS2 it 100 sat mod


Function FindObj: Boolean;
Var
tmpCTS, i, l, r, counter:integer;
ObjTPA:TPointArray;
ObjATPA:T2DPointArray;
x,y:integer;
Begin
tmpCTS := GetToleranceSpeed;

SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.00, 100.0);
FindColorsTolerance(ObjTPA, 0, MSX1, MSY1, MSX2, MSY2, 5);

SplitTPAWrap(ObjTPA, XV, ObjATPA);
SortATPASize(ObjATPA,True);
End;

From: BMWxi
I have to say Olly, that is easier. I still need think of a way to avoid the pink one though.



Something like olly's +


SortATPAFrom(ObjATPA, Point(MSX1, MSY1+20));
DeleteValueInATPA(ObjATPA, 1);

YoHoJo

2013-02-14 16:55:19

TPA
ATPA
Pixel Counts
Box Size Limits etc
Get me?

As for color
http://i.imgur.com/pg0rSbs.png

LikeABoss!

Olly

2013-02-14 17:06:36

From: BMWxi
I have to say Olly, that is easier. I still need think of a way to avoid the pink one though.


easy enough to add a check for the green colour in it :p

YoHoJo

2013-02-14 17:08:56

From: Ollybest
easy enough to add a check for the green colour in it :p


Just saw yours too, damn nice!
Care to explain the code please? :)

Ian

2013-02-14 17:23:08

From: Ollybest
easy enough to add a check for the green colour in it :p


Yeah, that's basically what I had in mind. Thanks for the help Olly, YoHoJo, and Danny :)

Olly

2013-02-14 17:34:22


procedure oo;
var
tpa: TPointArray;
atpa: T2DPointArray;
i: Integer;
tb: TBox;
begin
findColorsTolerance(tpa, 0, 1, 1, w-1, h-1, 10);

splitTPAexWrap(tpa, 10, 5, atpa);
sortATPASize(atpa, true);

if (length(atpa) < 1) then
exit;

// atpa is obviously sorted to biggest first, and the biggest will obviously be the black empty
// space so lets remove it.
deleteValueInATPA(atpa, 0);

if (length(atpa) < 1) then
exit;

// removing the tpa from the atpa if we find the brown sign colour in it
for i := high(atpa) downto 0 do
begin
tb := getTPABounds(atpa[i]);
if (countColorTolerance(1190186, tb.x1, tb.y1, tb.x2, tb.y2, 5) > 5) then
deleteValueInATPA(atpa, i);
end;

DebugATPA(atpa, '');

end;

Sawyer

2013-02-16 23:30:25

Ehh… What? :p I know TPA's are collections of tpoints, and tpoints are x,y coordinates, but It's still mumbo-jumbo to me. It confuses me.

Sjoe

2013-02-16 23:32:32

From: Sawyer
Ehh… What? :p I know TPA's are collections of tpoints, and tpoints are x,y coordinates, but It's still mumbo-jumbo to me. It confuses me.


learn the basics first, young jedi!

EDIT:

http://villavu.com/forum/showthread.php?t=33111 I love this tut, very well explained!
And after u know that, read the Wizzyplugin tutorial.

Sawyer

2013-02-16 23:36:16

Thanks. I guess I'm no jedi master yet :p

Sjoe

2013-02-16 23:38:02

From: Sawyer
Thanks. I guess I'm no jedi master yet :p


And remember smart_debugatpa(), then u know what's going on with the searchings

Sawyer

2013-02-16 23:53:54

Okay :) Time to paint a bunch of points different colors :p