Difference between revisions of "IsControlPressed"
Jump to navigation
Jump to search
imported>Haama (→See Also: New links) |
imported>Haama (Added notes) |
||
Line 7: | Line 7: | ||
Returns 1 if either the key or mouse button assigned to the specified control code is currently pressed. Detects disabled keys. | Returns 1 if either the key or mouse button assigned to the specified control code is currently pressed. Detects disabled keys. | ||
==Notes== | |||
* This function won't detect script [[TapKey]]s or [[TapControl]]s, but will detect keys disabled with [[DisableKey]] or [[DisableControl]]. | |||
* 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 && isControlPressed curkey ) ; key still being held down | |||
return ; wait until it's released | |||
else | |||
set curkey to 0 | |||
endif | |||
if ( isControlPressed <keyCode> ) | |||
; do stuff | |||
set curKey to <keyCode> | |||
endif</pre> | |||
==Control IDs== | ==Control IDs== |
Latest revision as of 18:40, 26 November 2007
A command for Oblivion Script Extender
Syntax:
(isPressed:bool) IsControlPressed whichControl:short
Returns 1 if either the key or mouse button assigned to the specified control code is currently pressed. Detects disabled keys.
Notes[edit | edit source]
- This function won't detect script TapKeys or TapControls, but will detect keys disabled with DisableKey or DisableControl.
- 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 && isControlPressed curkey ) ; key still being held down return ; wait until it's released else set curkey to 0 endif if ( isControlPressed <keyCode> ) ; do stuff set curKey to <keyCode> endif
Control IDs[edit | edit source]
Forward 0 Back 1 Slide Left 2 Slide Right 3 Attack 4 Activate 5 Block 6 Cast 7 Ready Weapon 8 Crouch/Sneak 9 Run 10 Always Run 11 Auto Move 12 Jump 13 Toggle POV 14 Menu Mode 15 Rest 16 Quick Menu 17 Quick1 18 Quick2 19 Quick3 20 Quick4 21 Quick5 22 Quick6 23 Quick7 24 Quick8 25 QuickSave 26 QuickLoad 27 Grab 28