Numbered Steps to Reproduce Problem:
It just happens randomly out of the sudden you won't be able to move one or more directions unless you relog.
Code Snippet (if applicable) to Reproduce Problem:
Macros set in Skin Macro menu!
> W MoveKey 1 1
> W+UP MoveKey 1 0
> S MoveKey 2 1
> S+UP MoveKey 2 0
> D MoveKey 4 1
> D+UP MoveKey 4 0
> A MoveKey 8 1
> A+UP MoveKey 8 0
#define TICK_LAG 0.25 //set this to 10 divided by world.FPS
//this is where you would define your binds. Simply define them as numbers starting at 1, then update the BindKey() verb as necessary to handle behavior.
#define BIND_JUMP 1
#define BIND_INVENTORY 2
#define TAP_THRESHOLD 2.5
#define MOVE_TURN 1
#define MOVE_SLIDE 2
#define MOVE_JUMP 4
#define MOVE_TELEPORT 8
#define TILE_WIDTH 32
#define TILE_HEIGHT 32
#define TILE_DIAG sqrt(TILE_WIDTH * TILE_WIDTH + TILE_HEIGHT * TILE_HEIGHT)
client
var/tmp
move_keys = 0 //stores the actual state of the movement keys
move_dir = 0 //stores the direction the client is trying to move the mob in
move_loop = 0 //stores the current move_loop's starting time
last_key = 0 //stores the last key that was actually pressed
//these lists must be as long as 4+ the number of binds you define.
list/key_state = list(0,0,0,0,0,0) //stores the on-off state of each registered key
list/key_time = list(-1#INF,-1#INF,-1#INF,-1#INF,-1#INF,-1#INF) //stores the time that the registered key was pressed or released
list/key_taps = list(0,0,0,0,0,0) //stores the number of times a key has been pressed in sequence. This allows for dealing with double and triple taps.
proc
//this drives movement behavior.
MoveLoop()
if(move_loop) return //only call once while active
// var/x,y
move_loop = world.time
//repeat while move_keys are being held down
var/turf/t
while(move_keys)
if(move_dir)
t = get_step(mob,move_dir)
if(t)
Move(t,move_dir)
sleep(TICK_LAG)
move_loop = 0
verb
//called when a movement key has been pressed.
MoveKey(dir as num,state as num)
set hidden = 1
var/opp = turn(dir,180)
var/pos = log(2,dir)+1
if(state&&++key_state[pos]==1)
//key track of the keytap state
if(world.time-key_time[pos]>TAP_THRESHOLD)
key_taps[pos] = 1
else if(last_key==pos)
++key_taps[pos]
else
key_taps[pos] = 1
last_key = pos
//keep track of the move keys and direction
move_keys |= dir
if(move_keys&opp)
move_dir &= ~opp
else
move_dir |= dir
//store the time of the event
key_time[pos] = world.time
//this is an example of handling double-taps for movement
/*if(move_keys==dir&&key_taps[pos]==2)
mob.Dash(dir,0,pos)*/
else if(!state&&--key_state[pos]==0)
//this is a key release
move_keys &= ~dir
if(move_keys&opp)
move_dir |= opp
else
move_dir &= ~dir
//store the time of the event
key_time[pos] = world.time
//attempt to call MoveLoop if there are keys being held down
if(move_keys)
MoveLoop()
//called when a registered bind has been pressed
BindKey(key as num,state as num)
set hidden = 1
var/pos = key+4
key_state[pos] = state
//this is a keypress
if(state)
last_key = pos
//keep track of double, triple, quadruple, etc taps
if(world.time-key_time[pos]>TAP_THRESHOLD)
key_taps[pos] = 1
else
++key_taps[pos]
/*
switch(key)
//these are just examples, use your game's binds and functions here.
if(BIND_JUMP)
if(state)
switch(move_dir&(EAST|WEST))
if(EAST)
mob.Jump(60)
if(WEST)
mob.Jump(120)
else
mob.Jump(90)
if(BIND_INVENTORY)
if(state)
if(interface.inventory.showing)
interface.inventory.Hide()
interface.equipment.Hide()
else
interface.inventory.Show()
interface.equipment.Show()
*/
North()
South()
East()
West()
Northeast()
Southeast()
Southwest()
Northwest()
atom/movable
var
tmp
next_move = 0
move_type = 0
move_delay = 2
glide_delay = 35
Move(atom/NewLoc,Dir=0,Step_x=0,Step_y=0,Source=null)
if(!Source) Source = src
var/mtime = world.time
//make sure that we're not moving before we're allowed
if(next_move>mtime&&Source==src)
return 0
//this bit sets what kind of move we just tried to do and manages the glide size
if(loc&&NewLoc.z==z)
var/mx = abs(NewLoc.x - x)
var/my = abs(NewLoc.y - y)
move_type = MOVE_SLIDE
//determine if jump, turn or slide.
if(mx>1||my>1)
//more than one tile at a time movement is a jump
move_type = MOVE_JUMP
else if(mx)
//set the glide size based on the movement direction
if(my)
glide_size = TILE_DIAG / glide_delay / TICK_LAG
else
glide_size = TILE_WIDTH / glide_delay / TICK_LAG
else if(my)
glide_size = TILE_HEIGHT / glide_delay / TICK_LAG
else
//no movement is a turn
move_type = MOVE_TURN
else
//swapping z layers is a teleport
move_type = MOVE_TELEPORT
. = ..()
//set the next movement time
if(Source==src)
next_move = mtime + move_delay
Expected Results:
To work perfectly
Actual Results:
Does the problem occur:
Every time? Or how often?
Yes
In other games?
no?
In other user accounts?
no?
On other computers?
no?
When does the problem NOT occur?
It always occures
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
I've only tested it on 509.1312
Workarounds:
No Workaround!