Not sure if this helps :-
function pressed(code)
` returns 1 if the key/button for the code is pressed
press = 0
if code > 0
press = keystate(code)
else
` special code
select code
case -1 : press = (mouseclick() and 1) : endcase
case -2 : press = ( (mouseclick() and 2) > 0 ) : endcase
endselect
endif
endfunction press
Using this you can do a menu like in most FPS games, where the user presses the key they want for the function, you then just store the scancode (or -1 for lmb or -2 for rmb)in a variable (eg upkey, downkey etc) and in your code you can simply do 'If pressed(upkey) then ypos = ypos + 1' etc
It does not have Joystick commands but they would not be too difficult to add (except maybe the analog controls).