ID:2412271
 
Code:
mob
verb

stepright()
set hidden = 1
Move(get_step(src,EAST),usr.dir)


Problem description:

this lets me side step one tile,but i want it to work like the arrow keys in that you keep moving while key is held down. how can i make that happen?
You'd probably want to incorporate some kind of key handling loop and use key-up and key-down events to track what's being held (it's a good idea to do this anyways)

client
var/tmp/list/keys_pressed = list()
proc/MovementLoop()
set waitfor = 0
while(src && src.mob)
var
mob/c_mob = src.mob
step_direction = 0
if(keys_pressed && keys_pressed.len)
for(var/key_pressed in keys_pressed)
step_direction |= key_pressed
if(step_direction)
c_mob.Move(get_step(c_mob,step_direction),c_mob.dir)
sleep(1) // You can change this to slow things down


Then you'd set macros up that do something like call "KeyDown [key]" and "KeyUp [key]", you can do this with the "Any" macro, which lets you capture all key press and release events, but it does generate a little more overhead than just having macros for what you need.

client/verb
KeyDown(button as num)
set instant = 1
set hidden = 1
if((button in keys_pressed)) return
keys_pressed += button

KeyUp(button as num)
set instant = 1
set hidden = 1
keys_pressed -= button


In this example you'd be passing a number (direction) to the verb, but if you used the Any macro you'd need to handle them as strings and do some conversion.

(This was written off the top of my head and is to be taken as an example, not working code)