ID:146602
 
Code:
var/tmp/my_counting = 0
var/count = 1
client/Move(newloc, dir)
while(my_counting != 1)
walk(usr.dir, 0)
usr.dir = dir
usr << "Debuging."
count += 1
my_counting = 1
while(count == 2)
walk(usr.dir, 1)
my_counting = 0
var/random_fall = rand(1,100)
if(random_fall == 27)
usr << "You fell."


Problem description:What the problem is here is I need it so that once the pushes a button once such as the up button, south, etc, It changes in that dir, but then once the person hits the button again, they move in that direction. It needs to keep going on this way as well.

For ex. I hit the north button once, my character faces north, I hit norht button again, my character moves 1 north, I hit south button, my character looks in south direction, I hit south button again, my character moves 1 south.

By the way, everything underneath the var/random_fall thing, disregard that.
Well, you don't need the counting vars for anything unless this is for that random "you fall" thing. Besides that you don't have to do much, though. This can be done in mob/Move() if you like instead of client/Move():

mob/Move(newloc, newdir)
if(newdir && newdir != dir)
dir = newdir
return 0 // don't move; just turn
return ..()


Or in client/Move():

client/Move(newloc, newdir)
if(newdir != mob.dir)
mob.dir = newdir
return
..()


Lummox JR
In response to Lummox JR
:) Man thanks a lot Lummonx JR. This work, kinda pisses me off thought that this is all I need -.-.