Morrowind Mod:XKeyPressed

The UESPWiki – Your source for The Elder Scrolls since 1995
Jump to: navigation, search

A function added by MWSE.

xKeyPressed monitors the status of the keyboard (and mouse buttons). This can be similar to GetPCSneaking, but it actually detects whether a particular key is really being pressed. If input parameter code is a Virtual Key Code (between 1 and 254), the return value will indicate the status of that key, and a non-zero value means the key is being pressed. If the input code is 0, then on each call, the function will return the key code for the key (or one of the keys) currently being pressed. The specific values for the virtual key codes can be found in the Microsoft documentation at http://msdn.microsoft.com/en-us/library/aa243025%28v=vs.60%29.aspx. Some of the codes match different keys on different keyboard layouts.

Syntax[edit]

code (long): ref->xKeyPressed code (long)

Example[edit]

long temp
long key

setx temp to xKeyPressed key

if ( key == 0 )
        if ( temp ) 
                messagebox "Pressed keycode: %g" temp
                return
        endif
endif

See Also[edit]

xTextInput
xTextInputAlt