ID:1884785
 
(See the best response by Kaiochao.)
Code:
#define KEY_NORTH "north"
#define KEY_NORTHEAST "northeast"
#define KEY_NORTHWEST "northwest"
#define KEY_SOUTH "south"
#define KEY_SOUTHEAST "southeast"
#define KEY_SOUTHWEST "southwest"
#define KEY_EAST "east"
#define KEY_WEST "west"

#define MOVEMENT2COMMAND list(KEY_NORTH = "North", KEY_NORTHEAST="Northeast", KEY_NORTHWEST="Northwest", KEY_SOUTHEAST="Southeast", KEY_SOUTHWEST="Southwest", KEY_SOUTH = "South", KEY_EAST = "East", KEY_WEST = "West")
#define DOUBLE_PRESS_TIME 1 // the interval allowed between valid double taps

#define MOVEMENT_KEYS list(\
KEY_NORTH = 1,\
KEY_SOUTH = 2,\
KEY_EAST = 4,\
KEY_WEST = 8,\
KEY_NORTHEAST = 5,\
KEY_NORTHWEST = 9,\
KEY_SOUTHEAST = 6,\
KEY_SOUTHWEST = 10\
)

mob
var
tmp/todash=0
tmp/amdashing=0
tmp/dashdistnormal=3
verb
Toogle_Dash()
set category = "Commands"
set name = "Dash"
if(src.todash==0&&usr.can_dash())
usr.todash=1
//var/returndistance=usr.dashdistnormal
//usr.dashdistnormal=3
//usr<<"You prepare to dash!"
usr.amdashing=1
usr.dash(usr.dashdistnormal,usr.dir)
usr.amdashing=0
//usr.dashdistnormal=returndistance
spawn(12)
usr.todash=0
//usr<<"You can now dash again."
testtoggledash()
set category = "Commands"
set name = "Dash Toggle"
set hidden = 1
if(usr.amdashing==0)
usr.amdashing=1
usr.dashdistnormal=3
usr<<"You are now dashing"
else
usr.amdashing=0
usr.dashdistnormal=0
usr<<"You are no longer dashing."




#define DASH_COOLDOWN 50 // 5 seconds
#define DASH_STAMINA_DRAIN 50

mob
var/tmp/last_dash = 0

proc
get_dash_distance(var/distance)
return distance

can_dash()
if(last_dash > world.time) return 0

if(DASH_STAMINA_DRAIN >= stamina)
src << "You do not have enough stamina to dash!"
return 0

stamina -= DASH_STAMINA_DRAIN
return 1

dash(distance, dir)
if(!can_dash(src)||amdashing==0)
return

distance = distance || get_dash_distance(distance)
distance = dashdistnormal
if(distance<1)
distance=1

for(var/i in 1 to distance)
afterimage_effect(loc, src, state = icon_state, dir = dir)
step(src, dir)
sleep(world.tick_lag)

last_dash = world.time - DASH_COOLDOWN - (world.tick_lag * distance)//was world.time + DASH_COOLDOWN + (world.tick_lag * distance)


proc/afterimage_effect(turf/loc, atom/movable/user, fade_time = 20,
state,
dir,
pixel_x = 0, pixel_y = 0
)

var/obj/temp = new/obj {alpha = 160} (loc)
temp.icon = user.icon
temp.overlays = user.overlays
temp.underlays = user.underlays
temp.icon_state = state
temp.dir = dir
//temp.step_x = step_x
//temp.step_y = step_y
temp.pixel_x = pixel_x
temp.pixel_y = pixel_y

animate(temp, alpha = 0, time = fade_time)
spawn(fade_time) if(temp) temp.loc = null



/*
#define KEY_NORTH "north"
#define KEY_NORTHEAST "northeast"
#define KEY_NORTHWEST "northwest"
#define KEY_SOUTH "south"
#define KEY_SOUTHEAST "southeast"
#define KEY_SOUTHWEST "southwest"
#define KEY_EAST "east"
#define KEY_WEST "west"

#define MOVEMENT2COMMAND list(KEY_NORTH = "North", KEY_NORTHEAST="Northeast", KEY_NORTHWEST="Northwest", KEY_SOUTHEAST="Southeast", KEY_SOUTHWEST="Southwest", KEY_SOUTH = "South", KEY_EAST = "East", KEY_WEST = "West")
#define DOUBLE_PRESS_TIME 1 // the interval allowed between valid double taps

#define MOVEMENT_KEYS list(\
KEY_NORTH = 1,\
KEY_SOUTH = 2,\
KEY_EAST = 4,\
KEY_WEST = 8,\
KEY_NORTHEAST = 5,\
KEY_NORTHWEST = 9,\
KEY_SOUTHEAST = 6,\
KEY_SOUTHWEST = 10\
)

client
var/tmp
controller/controller

New()
..()
controller = new(src)

Del()
controller = null
..()

verb
key_press(k as text)
set hidden = 1
set instant = 1
if(controller)
controller.key_press(k)

key_release(k as text)
set hidden = 1
set instant = 1
if(controller)
controller.key_release(k)

proc
dash(distance, dir)
mob.dash(distance, dir)


#define DASH_COOLDOWN 50 // 5 seconds
#define DASH_STAMINA_DRAIN 50

mob
var/tmp/last_dash = 0

proc
get_dash_distance()
return 3

can_dash()
if(last_dash > world.time) return 0

if(DASH_STAMINA_DRAIN >= stamina)
src << "You do not have enough stamina to dash!"
return 0

stamina -= DASH_STAMINA_DRAIN
return 1

dash(distance, dir)
if(!can_dash(src))
return

distance = distance || get_dash_distance()

for(var/i in 1 to 3)
afterimage_effect(loc, src, state = icon_state, dir = dir)
step(src, dir)
sleep(world.tick_lag)

last_dash = world.time + DASH_COOLDOWN + (world.tick_lag * distance)


proc/afterimage_effect(turf/loc, atom/movable/user, fade_time = 20,
state,
dir,
pixel_x = 0, pixel_y = 0
)

var/obj/temp = new/obj {alpha = 160} (loc)
temp.icon = user.icon
temp.overlays = user.overlays
temp.underlays = user.underlays
temp.icon_state = state
temp.dir = dir
//temp.step_x = step_x
//temp.step_y = step_y
temp.pixel_x = pixel_x
temp.pixel_y = pixel_y

animate(temp, alpha = 0, time = fade_time)
spawn(fade_time) if(temp) temp.loc = null
*/

client
var/tmp
controller/controller

New()
..()
controller = new(src)

Del()
controller = null
..()

verb
key_press(k as text)
set hidden = 1
set instant = 1
if(controller)
controller.key_press(k)

key_release(k as text)
set hidden = 1
set instant = 1
if(controller)
controller.key_release(k)
proc
dash(distance, dir)
if(mob.amdashing==1)
mob.dash(mob.dashdistnormal, mob.dir)

controller
var/tmp
client/client

list/keys = list()
list/key_press_time = list()
list/key_release_time = list()
list/key_taps = list()
list/movement_keys = list()
last_key


New(client/master)
if(master)
client = master


proc
key_press(key)
keys[key] = 1
key_press_time[key] = world.time

//world << "[key] has been pressed at [world.time]"

if(key != last_key)
key_taps[key] = 1
else
key_taps[key]++
if(key_taps[key] == 2)
var/last_release = world.time - key_release_time[key]
if(last_release <= DOUBLE_PRESS_TIME)
if(MOVEMENT_KEYS[key])
client.dash(dir = MOVEMENT_KEYS[key])
else
if(hascall(client, "[key]_double_press"))
call(client, "[key]_double_press")()
else
key_taps[key] = 1

if(MOVEMENT_KEYS[key])
movement_keys |= key
if(!client.moving)
spawn() client.move()
else
if(hascall(client, "[key]_press"))
call(client, "[key]_press")()

last_key = key


key_release(key)
keys[key] = 0
key_release_time[key] = world.time

//world << "[key] has been released at [world.time]"

if(MOVEMENT_KEYS[key])
movement_keys -= key
if(!client.moving)
spawn() client.move()

if(hascall(client, "[key]_release"))
call(client, "[key]_release")()


client
var/tmp
moving

proc
get_key_dir()
var/recent_key = controller.movement_keys.len && controller.movement_keys[controller.movement_keys.len]

if(controller.movement_keys.len == 2)
if(controller.keys[KEY_NORTH])
if(controller.keys[KEY_EAST])
Northeast()
return 1
else if(controller.keys[KEY_WEST])
Northwest()
return 1
else
North()
return 1
else if(controller.keys[KEY_SOUTH])
if(controller.keys[KEY_EAST])
Southeast()
return 1
else if(controller.keys[KEY_WEST])
Southwest()
return 1
else
South()
return 1
else
if(controller.keys[KEY_EAST])
East()
return 1
else if(controller.keys[KEY_WEST])
West()
return 1

if(recent_key && controller.keys[recent_key])
call(src, MOVEMENT2COMMAND[recent_key])()
return 1
return 0


move()
if(moving) return 0
moving = 1

spawn()
set background = 1
var/d
while(src)
d = get_key_dir()

if(!d) break

sleep(world.tick_lag)


moving = 0


Problem description:
The problem is that when ever you move your moves 2 spaces instead of 1 making it look as though you moved over a space which i can't figure out how to get rid of, please assist
Best response
Stick this in your code:
client/Move()

You might still be moving according to the built-in movement handler. Overriding client.Move() and leaving it blank will cancel the default behavior.
In response to Kaiochao
so i should make
 move()
if(moving) return 0
moving = 1

spawn()
set background = 1
var/d
while(src)
d = get_key_dir()

if(!d) break

sleep(world.tick_lag)


moving = 0

To

client/Move()

only?
In response to Joejoe13
No, just add that line to your code. It's just overriding a built-in proc to do nothing.
In response to Kaiochao
I see, thanks ^_^
In response to Kaiochao
I tried that and had no luck, after it was added i couldn't move at all
It looks like you are calling client.move() in both key_press and key_release. I'm on a phone, so its a bit hard to read through, but I'm guessing that's where your issue is.
Tried that, couldn't move after