ID:148574
 
I am having trouble with the following code. What I want is for it to allow me to move freely, when I login. Once I login now, I cannot move at all, which is what i need help with. One more thing, how exactly would I check if Src and M are standing on the same turf? I dont mean both standing at the same oview(0) distance. I mean on the same turf, a little distance away. Thanks in advance

client
Move(mob/M as mob in world)
start
if(usr.Battle==1)
return
if(usr.isturn==0)
return
if(usr.turnee >= 0) usr.turnee -= 1
..()
if(usr.turnee<=0)
usr<<"Ending Turn."
usr.turnee=0
usr.isturn=1
else
usr<<"It isn't your turn"
goto start
Much of this code doesn't make sense. client/Move() doesn't take an "M as mob" argument, for example; it takes the new location and the direction to travel in, just like regular atom/movable/Move() does. Best to look this up in the reference. The weird argument is probably the reason moving isn't working for you.

Second, your use of goto is bad here. In about 99.9% of cases, you don't need goto at all and it's easier to just use a loop construct. I think what you were trying to go for was a while loop:
while(1)
// keep looping until something calls break or return
...
if(something happens)
break
...
But that's kind of moot because using a loop in this proc makes no sense whatsoever.

Lummox JR