key_set (number, function);

Sets the given function to the key with the given scancode. This way keyboard remapping can be done very easily.

Parameters:

number scancode of key
function pointer of function assigned to the key with given scancode

Speed:

Fast

Example:

Example for remapping a key:
print("Please press key to assign function to");

while (key_any == 0) { wait(1); } // wait until a key is hit
str_cpy(my_str,"You have pressed "); str_for_key(temp_str,key_lastpressed); str_cat(my_str,temp_str); print(my_str); // indicate which key
while (key_any == 1) { wait(1); } // wait until key is released
key_set(key_lastpressed,my_function); // assign function to key

See also:

key_pressed, key_for_string, str_for_key, key_lastpressed, inkey, Key functions and mapping

► latest version online