ID:142170
 
Code:
turf
Click()
var/mob/User = usr//makes User the urs
User << "User initialized"
var/turf/movloc = src.loc //just in case another turf is clicked before this move is done
User << "Turf set"
while(User.loc != movloc.loc)//while user isnt on turf
User << "In while"
step_towards(User,movloc)//move towards turf
sleep(movedelay*2)//sleep the move delay*2
User << "After move"


Problem description:


(BTW the User<<"TEXT HERE" is to show if proc was stopped somwhere)

The code runs through perfectly fine... but the player does not move towards the turf and the code runs through infinitly because of this.

If you can spot the problem in the code (or have an easier way of doing this, or better code procedures) please post
You have an amount of wrong crap in there... I'm not gong to go through all that in the morning, but I'll show you you can simply do this:
turf/Click() walk_towards(usr,src)

Point of Duh: Look up the walk() series. Also, your User var is use-less.
In response to Kaioken
Alright. Lets just not yell at him :(

first of all, "user" variable is pointless in this case. Because as you can see, usr, works just as well. So, get rid of that. Second of all, using turf/Click(), the source of this proc, per se, is the turf. So, all you need to do is like Kaioken posted, walk_towards(usr,src).
In response to Generation
When i use the walk_towards proc, the player/mob almost teleports there because of an edit in tick_lag, which was needed for quicker reaction times.

I had step_towards working at one point (clicking and moving to an obj) but it doesnt seam to work for turfs

User is used because if the usr changes while the mob is still moving then the new usr would be moving

the obj proc (full+working properly)
obj/item
Click()
var/mob/User = usr
if(src in oview(0,User))
if(Move(User))
User.UpdateEquipment()
User.UpdateInventory()
User << output("You pick up the [src]","system")
return
if(src in oview(10,User))//tsting walk to item.. not working
while(User.loc != src.loc)
while(User.loc != src.loc)
step_towards(User,src)
sleep(movedelay*2)
if(Move(User))
User << output("You pick up the [src]","system")
return


hope that helps

the walk_towards proc doent have a lag option thats why i didnt use it
In response to KingCold999
KingCold999 wrote:
User is used because if the usr changes while the mob is still moving then the new usr would be moving

It won't change magically just because, unless you're using usr in places it shouldn't be used (eg [movement,etc] procs) or you're changing it manually yourself. By deduction, your User var is unneeded.

the walk_towards proc doent have a lag option thats why i didnt use it

Kaioken wrote:
Point of Duh: Look up the walk() series.

Why does the Duh need to be stated twice, really? =(