ID:266538
 
turf/grass
icon='grass.dmi'
icon_state="grass"
Click()
if(usr.zan==1)
usr.loc=src.loc
ok this is wrong how would i make the usr goto what he clicked on?
Strange Kidd wrote:
turf/grass
icon='grass.dmi'
icon_state="grass"
Click()
if(usr.zan==1)
usr.loc=src.loc
ok this is wrong how would i make the usr goto what he clicked on?

usr.loc=src would be more accurate.

This will make you appear on the turf instantly. If you want to walk there, it's going to take a little more work. You might want to look for Deadron's pathfinding library.
In response to Skysaw
He could use the walk_to() proc, but I'm not sure if that avoids obstacles.

-Rcet
In response to Rcet
Rcet wrote:
He could use the walk_to() proc, but I'm not sure if that avoids obstacles.

-Rcet

It doesn't avoid obstacles, but will work fine if there isn't expected to be any. :-)
In response to Skysaw
You can use,

turf/grass
icon='grass.dmi'
Click()
walk_to(usr,src,0,0)

Or,

turf/grass
icon='grass.dmi'
Click()
usr.x=src.x
usr.y=src.y
usr.z=src.z
And this, pretty darn sure htis would work

turf/click
icon='grass.dmi'
Click()
var/location=locate(src.x,src.y,src.z)
usr.Move(location)
In response to Super16
Super16 wrote:
You can use,

turf/grass
icon='grass.dmi'
Click()
walk_to(usr,src,0,0)

Or,

turf/grass
icon='grass.dmi'
Click()
usr.x=src.x
usr.y=src.y
usr.z=src.z
And this, pretty darn sure htis would work

turf/click
icon='grass.dmi'
Click()
var/location=locate(src.x,src.y,src.z)
usr.Move(location)

Nice, but you're talking about two completely different approaches, as has already been mentioned. You can move usr directly, or make them walk to their target. You've just shown code to do both, and presented them as equals.

Lummox JR
In response to Lummox JR
Well I wasn't exactly sure what he meant because as he posted he looked like he wanted to direct it as usr.loc=src.loc, and by Rcet's post he mentioned walk_to so I included both. I never intented on making them look equivalent to each other.