GetKeyState

From Liberty Unleashed Wiki
Jump to: navigation, search
Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events


This function returns whether the key has been pressed down. This is useful for example if you want to bind key combinations.

Syntax

  1. bool GetKeyStatus( int key )

Arguments

  • key - This is the key you want to retrieve the status for. For keys 'A'-'Z' and '0'-'9' this value will be the ascii code of the character. For special keys, check a list here

Example

This example will print "Testage!" to the chatbox when the player presses CTRL + A key combination.

  1.  
  2. function onScriptLoad()
  3. {
  4. BindKey( 'A', BINDTYPE_DOWN, Testage );
  5. }
  6.  
  7. function Testage()
  8. {
  9. if ( GetKeyStatus( KEY_CONTROL ) ) Message( "Testage!" );
  10. }
  11.  

Notes

The function Message and call onScriptLoad were used in in this example. More info about them in the corresponding pages.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox