IsKeyPressed2

From the Oblivion ConstructionSet Wiki
Revision as of 12:40, 9 August 2006 by imported>DragoonWraith (messed up Note)
Jump to navigation Jump to search

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