Key Steal Manager

The key steal manager provides functionality in battle and frontend game modes related to stealing the ESC key and intercepting key presses.

In battle, the battle_manager automatically creates a key-steal manager and provides a pass-through interface to its functions via battle_manager:steal_escape_key_with_callback and battle_manager:release_escape_key_with_callback. Do not try to manually create and use a key-steal manager in battle, but instead use the battle manager's pass-through interface.

In the frontend, a key steal manager is automatically created when the libs are loaded. This is called ksm. In frontend, functions listed on this page can be called in the following form:

Example:

ksm:<function_name>(<args>)
Loaded in Campaign Loaded in Campaign
Loaded in Battle Loaded in Battle
Loaded in Frontend Loaded in Frontend
Back to top

Creation

key_steal_manager:new()

Creates and returns a new key-steal manager. This should not be called by client scripts - in battle, the battle_manager creates a key steal manager internally, and in the frontend a key steal manager is created automatically by the script libraries.

Returns:

  1. key_steal_manager key steal manager

defined in ../../Warhammer/working_data/script/_lib/lib_key_steal_manager.lua, line 32

Back to top

ESC Key Stealing

key_steal_manager:steal_escape_key_with_callback(
  
string callback name,
  function
callback,
  [boolean
is persistent]
)

Steals the escape key if it wasn't stolen before, and registers a callback to be called if the player presses it. The callback entry must be registered with a unique string name, by which it may be cancelled later if desired.
Multiple escape key callbacks may be registered at one time, although only the most recently-registered callback is notified when the ESC key is pressed. Once an ESC key callback is called it is removed from the list, and the next ESC key press causes the next most recent callback to be notified, and so-on.

Parameters:

1

string

Callback name.

2

function

Callback to call.

3

boolean

optional, default value=false

Key should remain stolen after callback is first called.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_key_steal_manager.lua, line 125

key_steal_manager:release_escape_key_with_callback(string callback name to cancel)

Cancels an escape key callback registered with key_steal_manager:steal_escape_key_with_callback by name.

Parameters:

1

string

callback name to cancel

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_key_steal_manager.lua, line 171

Last updated 8/23/2024 4:55:16 PM