Log in

View Full Version : Checking state of a door(gate)



Footy
08-14-2012, 09:40 PM
In my latest script, I need to know weather or not the gate to the lumbridge cowpen is open or not, so I know if I need to open it or not. The camera angle will be at north, angle highest, if that matters. I cant precisely place myself in a specific spot to check, since Im using Radialwalk. How would I go about doing this?

NKN
08-14-2012, 09:43 PM
Find red on minimap.
Make sure the door is closed.(Only during the process of making the checker, after you make it, it won't matter)
Have it create a box around the red the door is on the minimap
Count average colors in the box of the red color
If the door is open, the colors in the box should be less, if it's closed, it should be around that average.

Footy
08-14-2012, 09:45 PM
Red on minimap doesent change when gate is opened or closed...

John
08-14-2012, 09:47 PM
Red on minimap doesent change when gate is opened or closed...

Simple way would be to hover the gate and get the uptext.

Footy
08-14-2012, 09:49 PM
Uptext does change depending on state of the gate, but the gate is near impossible to single out when its closed...
http://i0.simplest-image-hosting.net/picture/untitled197.png#REMEMBER-TO-LINK-SIMPLEST-IMAGE-HOSTING.NET-WHEN-HOTLINKING

NKN
08-14-2012, 09:56 PM
If you can get to the same spot, you can use a search area. Only search like, 30 Z above you, so it only gets the gate.

Footy
08-14-2012, 09:58 PM
I can try to get to the same spot via ODTM, but it likely wont be exact, +/- 1 or two spots.

putonajonny
08-14-2012, 10:03 PM
You could use object DTMs to very accurately click just inside the gate, then use ObjDTM_InArea to work out if you are in the pen, then only search for the gate if you are not

Runaway
08-14-2012, 10:10 PM
I can outline a specific way to do this, but it could get complicated... oh well :)

1) Find the door on the MM
2) Sort the TPA of the MM door from the top-left of the MM (to single out TPA[0] as the top-most point of the gate whether it's open or not)
3) Make a box with +/- 8 (12, 16 whatever) pixels along the x-axis and +20 (estimate) pixels along the y-axis.
4) Convert the MM Box to an MS Box
5) Search for the gate color within the MS box
6) Check for continuity along the y-axis in the TPA (or for gaps)

If there's a large gap, the door is open; If not, it's closed. I can write this out in code if you'd like, but I think that should spark some of your own ideas, creativity, and whatnot :)

Footy
08-14-2012, 10:13 PM
fairly new to TPAs, never used MMToMS, never made boxes around things, but Ill give it a shot. Thanks for the answers guys!
E: punta, ill try your suggestion first, it seems pretty idiot-proof, :D

Le Jingle
08-14-2012, 10:25 PM
^ lol - I think it's 'putona'

Also, I think Runaway made a similar function to the one he suggested here (http://villavu.com/forum/showthread.php?t=83397) (found it browsing old topics the other night). But T2DPointArrays are definitely a jump past TPA's. Looking of the variety of TPA tuts as well as examples / practicing it on your own, really helps you get an idea/hang of it - this is what I've been doing, and compared to a couple weeks ago (when I had no idea how to implement them), I've came a long way in understanding how to use them. (Still more for me to go tho)
*sorry for the floating in&out of topic >.<

Footy
08-14-2012, 10:28 PM
:O I've always said his name wrong... And Im starting to learn ATPA's now, well I made a function that uses SplitTPA into an ATPA, then finds an object based on uptext and CTS1(color and tolerance)

m3gaman3g3nd
08-15-2012, 06:01 AM
some experienced advise would be to make a dtm of the closed gate... could do dot in the middle then get the sides... check the srl ess-miner one of the coders made a nice nifty method ...