Difference between revisions of "IsKeyPressed2"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>DragoonWraith
(OBSE)
 
imported>DragoonWraith
(messed up Note)
Line 65: Line 65:
==Notes==
==Notes==


* Bear in mind that this function returns 1 for as long as the key is held down, so it's generally a good idea to trap the key and then wait until it is released, i.e.:<pre>if ( curKey && isKeyPressed curkey ) ; key still being held down
* Bear in mind that this function returns 1 for as long as the key is held down, so it's generally a good idea to trap the key and then wait until it is released, i.e.:
<pre>if ( curKey && isKeyPressed2 curkey ) ; key still being held down
   return ; wait until it's released
   return ; wait until it's released
else
else
Line 71: Line 72:
endif
endif


if ( isKeyPressed <keyCode> )
if ( isKeyPressed2 <keyCode> )
   ; do stuff
   ; do stuff
   set curKey to <keyCode>
   set curKey to <keyCode>

Revision as of 12:40, 9 August 2006

A command for Oblivion Script Extender

Syntax:

IsKeyPressed2 key

Returns true if key is currently pressed down. Key values are DirectX scancodes, as opposed to IsKeyPressed's Windows header codes.

DirectX scancodes are typically in hexadecimal, but this function takes decimal values.


Notes

  • Bear in mind that this function returns 1 for as long as the key is held down, so it's generally a good idea to trap the key and then wait until it is released, i.e.:
if ( curKey && isKeyPressed2 curkey ) ; key still being held down
  return ; wait until it's released
else
  set curkey to 0
endif

if ( isKeyPressed2 <keyCode> )
  ; do stuff
  set curKey to <keyCode>
endif

See Also