ID:180783
 

how exactly would the code for that look?

you should click somewhere and your char should start walking to that place.
On 2/17/01 10:38 am Kaidorin wrote:
how exactly would the code for that look?

you should click somewhere and your char should start walking to that place.

turf/Click()
var/lag = 3 //how fast you do it
if(src.density)
walk_to(usr,src,1,lag)
return
else
var/O
for(O in src)
if(O.density)
walk_to(usr,src,1,lag)
return
walk_to(usr,src,0,lag)

This is a special one; it provides checking to make sure that the turf you click doesn't have something in it; if it doesn't, it walks to that turf. If it does, it walks to the nearest turf beside it. It isn't foolproof, though; if obstructed, it won't work, and your character will wander willy nilly all over the place, trying to get there. And if you click on a dense turf that's surrounded by dense turfs, it'll do the same thing. But it works otherwise.

There aren't much better solutions, other than checking each specific distance, or using an accessibility checker (which is very processor intensive), or using Deadron's famed library simply titled "The Deadron BYOND Library" (which is feature-filled and possibly confusing).
In response to Spuzzum
There aren't much better solutions, other than checking each specific distance, or using an accessibility checker (which is very processor intensive), or using Deadron's famed library simply titled "The Deadron BYOND Library" (which is feature-filled and possibly confusing).

There's a lot of good stuff in Deadron's library, but there's really only one function you'll need to use for walking to a target. I think it's called dd_step_toward(). I haven't used it yet, but Deadron swears it's simple as anything to use!
In response to Spuzzum
On 2/18/01 2:51 pm Spuzzum wrote:
or using Deadron's famed library simply titled "The Deadron BYOND Library" (which is feature-filled and possibly confusing).

If something is confusing just tell me what!

You get the current time in text format by simply calling dd_time().

You take a step towards something by calling dd_StepTowards().

You get a list of lines in a file by calling file2list().

You get a list from text by calling text2list().

Long long ago some things were harder to use, but now everything is pretty much one function call and you get what you want...but I'm very open to improving anything someone finds confusing.