For staff boots you will never need to know this.. instead use something more along the lines of:
PHP Code:
for ( i=0; i<4; i++ ) {
if ( keydown(i) ) {
player.x += vecx(i) * this.speed;
player.y += vecy(i) * this.speed;
}
}
Vec X/Y would give you -1,0,1 depending on direction. I am not completly sure how to explain it to you but I understand how it works. If im not mistaken its for finding vectors?
This greatly reduces your script length and makes it easier to modify.