ID:160196
 
Well, a few weeks back I stumbled across a few useful proc's that I can't seem to find now that I'm actually looking.

I know it had some great features like getting a true direction (which I'd really like for my ai system)

If anyone can find this, or knows who made it, that would be great. Thanks!
This doesn't go here. I'm pretty sure Nadrew made it, though.
In response to Jeff8500
hub://Nadrew.rangedetection
In response to Nadrew
Thanks :)
In response to Nadrew
Thanks again; I've been battling with it for a while now, but am unsure of how to use the return values.

My attempt:

                var/direction
var/a=advanceddirection(src,src.target)
var/return_val=a.
if(return_val=="Northeast")
direction=NORTHEAST
else if(a=="Northwest")
direction=NORTHWEST
else if(a=="Southeast")
direction=SOUTHEAST
else if(a=="Southwest")
direction=SOUTHWEST
else if(a=="North")
direction=NORTH
else if(a=="South")
direction=SOUTH
else if(a=="East")
direction=EAST
else if(a=="West")
direction=WEST
step(src,direction)
world<<"stepping [a]"
speedstop=0



My suspicion is that I'm returning a true value every time and the compiler isn't actually comparing the text, but rather just comparing that it's an empty text string or not.

Does anyone know how I can use the return values easier? The var/return_val was my attempt at finding the real return value, but obviously I have no idea what I'm doing.

Thanks!

--Beatmewithastick

EDIT: By the way, ignore the indentation, and yes, I know I could use a switch here. Just figured I'd point that out before anyone said anything. I just chose that to, and don't ask me why. :p
In response to Beatmewithastick
This is demonstrating some very odd behavior when I actually try to apply it as movement, rather than a text value. How would I go about this?
In response to Beatmewithastick
Make sure you know what precise value the proc returns.
proc/advanced_direction_numeric(..args..)
switch(advanced_direction_thing(..args..))
if("North") return NORTH
if("East") return EAST
if("West") return WEST
if( //....

Then use this custom proc that converts the returned value to numbers first, instead.
Way back, I wrote something that might be helpful to you: [link]

The get_approx_dir() function basically is like get_dir() but it will return cardinal directions when it's close enough.

Lummox JR