Creation/Dev/Script/Functions/keydown: Difference between revisions

From Graal Bible
(Created page with 'Category:Scripting Reference ''Clientside'' ''Description'' <p>Used to check which key a player has held down.</p> example: <pre> function onKeyPressed() { if (keydown(5))…')
 
No edit summary
 
(One intermediate revision by one other user not shown)
Line 2: Line 2:
''Clientside''
''Clientside''


''Description''
'''Description'''
<p>Used to check which key a player has held down.</p>
<p>Used to check which key a player has held down.</p>
example: <pre>
''example:'' <pre>
function onKeyPressed()
function onKeyPressed()
{
{
Line 13: Line 13:
}</pre><p>Checks if the player presses the default sword key.</p>
}</pre><p>Checks if the player presses the default sword key.</p>


''Notes''
'''Notes'''
<p>Joysticks only work with keydown, not keydown2. </p>
<p>Joysticks only work with keydown, not keydown2. </p>
{| border="1" cellpadding="2" width="100%"
{| border="1" cellpadding="2" width="100%"
Line 32: Line 32:
|-
|-
|4
|4
|a
|d (Weapon)
|-
|-
|5
|5
|s
|s (Sword)
|-
|-
|6
|6
|d
|a (Grab)
|-
|-
|7
|7
|m
|m (Map)
|-
|-
|8
|8
|TAB
|TAB (Chat Bar Toggle)
|-
|-
|9
|9
|q
|q (Inventory)
|-
|-
|10
|10
|p
|p (Pause)
|}
|}

Latest revision as of 03:28, 25 July 2010

Clientside

Description

Used to check which key a player has held down.

example:

function onKeyPressed()
{
  if (keydown(5))
  {
    player.chat = "You pressed s";
  }
}

Checks if the player presses the default sword key.

Notes

Joysticks only work with keydown, not keydown2.

Value Description
0 up
1 left
2 down
3 right
4 d (Weapon)
5 s (Sword)
6 a (Grab)
7 m (Map)
8 TAB (Chat Bar Toggle)
9 q (Inventory)
10 p (Pause)