SRL Archive - OSR Help

Find object on mainscreen


Bixby Sayz

2012-05-18 08:47:52

Trying to find an object on the mainscreen comprised of a variety of colors and the colors can vary. Initially I tried making dtms with tolerance but just could not get it consistently working.

Playing around with aca tool came up with a color search that consistently finds the points of the object (and just the points of the object). And now I'm stuck.

So now I have this TPA of 100ish points found on the screen that match the object, but I have to have something to compare it to in order to know if I have a match.

Element17

2012-05-18 11:42:45

Use UpText to determine if the object is really what you want.

Runaway

2012-05-18 11:48:40

Try something like this:


...
for i := 0 to High(TPA) do
begin
MMouse(TPA[i].x, TPA[i].y, 5, 5);
if WaitUptext('object', 1000) then
begin
...

Bixby Sayz

2012-05-18 12:18:10

No that will not work in this case. The uptext is the same regardless of whether the shape is present or not.

Trying to write my own home teleport routine. For locked teleports the map displays a lock symbol that is clearly distinguishable to the human eye even though it is composed of multiple colors and the colors of each and every lock is different.

So I am looking to match a shape on screen without relying on any other information (such as uptext). I have other uses for this in mind if I can ever get this working. Trying to master the concept so I can apply it to other projects. But I am struggling. Proving to be much more difficult than it initially seems.

x[Warrior]x3500

2012-05-18 12:24:25

i did this with dtms, when it first came out. just create a dtm of the upper part of the lock. or you can find the length of the TPA. for instance, have a tpa of a certain teleporting location that only contains the locks colors. then find the tpa length of those same colors w/o the lock present. record that High(tpa) or length(tpa). then you can do something like: if( high(tpa) < 127)then writeln('lock not there');

Runaway

2012-05-18 14:32:58

Check out my TPA cluster function, it's made for exactly these scenarios :p

You input an array of colors that should be within a specified distance of each other and it will output all instances it found. So if all of the colors for the teleports are different (or even slightly different) it will find the one you're looking for no sweat.

Bixby Sayz

2012-05-18 17:08:05

From: Runaway
Check out my TPA cluster function, it's made for exactly these scenarios :p

You input an array of colors that should be within a specified distance of each other and it will output all instances it found. So if all of the colors for the teleports are different (or even slightly different) it will find the one you're looking for no sweat.
I'll check it out for sure. Good suggestions all round.

putonajonny

2012-05-18 21:19:33

From: Runaway
Try something like this:


...
for i := 0 to High(TPA) do
begin
MMouse(TPA[i].x, TPA[i].y, 5, 5);
if WaitUptext('object', 1000) then
begin
...



Because that would try the most top left point, then the next then the next (possibly not moving by much each time I usually use:


...
for i := 0 to 5 do
begin
R := Random(GetArrayLength(TPA);
MMouse(TPA[R].x, TPA[R].y, 5, 5);
if WaitUptext('object', 1000) then
begin
...