Squirrel/Client/Functions/Controls/GetKeyStatus

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(New page: {{Squirrel/Title|GetKeyState}} This function returns whether the key has been pressed down. This is useful for example if you want to bind key combinations. == Syntax == <code>bool GetK...)
 

Latest revision as of 18:43, 8 April 2010

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.

[edit] Syntax

  1. bool GetKeyStatus( int key )

[edit] 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

[edit] 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.  

[edit] Notes

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

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox