Key input

From the Oblivion ConstructionSet Wiki
Revision as of 06:21, 26 April 2009 by imported>Gregbert (Discussion on Article page turned into article.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


If you wish to detect a key input without OBSE, then the best way to go about this is to detect what the effect of this key press would be. For example, if you want to detect the pressing of the Ctrl button, then your best best would be to detect Stealth (assuming that the player has Ctrl set to activate Stealth Mode). Using stealth as an example:

short sneak
short switch
float timer
/index.php?showtopic=511998&view=findpost
Begin GameMode

  set timer to ( timer + GetSecondsPassed )
  if ( timer > 2 )
    set timer to 0
    set sneak to 0
  elseif ( player.IsSneaking == 1 ) && ( sneak == 0 )
    set switch to ( switch + 1 )
  elseif ( player.IsSneaking == 0 ) && ( sneak == 1 )
    set switch to ( switch + 1 )
  endif

  if ( player.IsSneaking == 1 )
    set sneak to 1
  else
    set sneak to 0
  endif

  if ( switch == 4 )
    set switch to 0
    ;switch weapon mode
  endif

End

However, it is impossible (without OBSE) to detect a key press without the key having an effect. If this is your aim, then OBSE must be used.

See Also