Helper methods – InputReading helpers - TiberiumFusion/TTPlugins GitHub Wiki

Back to the Helper methods overview article.


These helpers are located in the nested HHelpers.InputReading class and get information about the local player's input, such what Keys are currently held.

All helper methods are static.


Method boolIsKeyDown(Keys key)

Checks if the specified Keyskey is currently held down or not. Returns true if it is down, or false if it is up.

Example usage:

if (HHelpers.InputReading.IsKeyDown(Keys.A))
{
	Debug.WriteLine("The local player is holding down the A key");
}

Method boolIsKeyPressed(Keys key)

Checks if the specified Keyskey was held down during the last update and is released in the current update. In other words, this will only return true for the single update cycle after the local player has released the key. Returns true or false.

Example usage:

if (HHelpers.InputReading.IsKeyPressed(Keys.A))
{
	Debug.WriteLine("The local player just pressed the A key");
}

Method boolIsKeyComboDown(Keys baseKey, Keys modifierKey)

Return true if the KeysbaseKey is currently held AND that the modifierKey is currently held down. Returns false otherwise. If KeysmodifierKey equals Keys.None, that part of the check is skipped, and this method becomes functionally equivalent to IsKeyDown().

Example usage:

if (HHelpers.InputReading.IsKeyComboDown(Keys.A, Keys.LeftControl))
{
	Debug.WriteLine("The local player is holding down Ctrl+A");
}

Method boolIsKeyComboPressed(Keys baseKey, Keys modifierKey)

Return true if the KeysbaseKey was just pressed (see IsKeyPressed()) AND that the KeysmodifierKey is currently held down. Returns false otherwise. If modifierKey equals Keys.None, that part of the check is skipped, and this method becomes functionally equivalent to IsKeyPressed().

TIP: This is a good method for detecting if the user has just pressed a hotkey combo, such as Ctrl + A.

Example usage:

if (HHelpers.InputReading.IsKeyComboPressed(Keys.A, Keys.LeftControl))
{
	Debug.WriteLine("The local player just entered the Ctrl+A command");
}


Back to the Helper methods overview article.