Difference between revisions of "Lua:Class:MemoryRecordHotkey"
Jump to navigation
Jump to search
(Initial page creation.) |
(No difference)
|
Latest revision as of 13:03, 11 July 2025
class MemoryRecordHotkey (Inheritance: Object)
The MemoryRecordHotkey class represents a hotkey attached to a memory record. It is mainly read-only, except for event properties used for trainer creation. For custom hotkeys not tied to memory records, use the generic hotkey class.
Properties[edit]
Property | Type | Description |
---|---|---|
Owner | MemoryRecord | The memory record this hotkey belongs to (ReadOnly). |
Keys | Table | Table containing the key combination for this hotkey. |
action | Integer | The action that should happen when this hotkey triggers. See action values below. |
value | String | Value used depending on the hotkey type (see action). |
ID | Integer | Unique ID of this hotkey (ReadOnly). |
Active | Boolean | True if this hotkey will be handled, false if ignored. |
Description | String | The description of this hotkey. |
HotkeyString | String | The hotkey formatted as a string (ReadOnly). |
ActivateSound | String | Tablefile name of a WAV file inside the table to play on activate events. |
DeactivateSound | String | Tablefile name of a WAV file inside the table to play on deactivate events. |
OnHotkey | Function(sender) | Function called when a hotkey has just been pressed. |
OnPostHotkey | Function(sender) | Function called when a hotkey has been pressed and the action has been performed. |
Action Values[edit]
Constant | Value | Description |
---|---|---|
mrhToggleActivation | 0 | Toggles between active/deactive. |
mrhToggleActivationAllowIncrease | 1 | Toggles between active/deactive. Allows increase when active. |
mrhToggleActivationAllowDecrease | 2 | Toggles between active/deactive. Allows decrease when active. |
mrhActivate | 3 | Sets the state to active. |
mrhDeactivate | 4 | Sets the state to deactive. |
mrhSetValue | 5 | Sets a specific value to the value property. |
mrhIncreaseValue | 6 | Increases the current value with the value property. |
mrhDecreaseValue | 7 | Decreases the current value with the value property. |
Methods[edit]
Method | Parameters | Returns | Description |
---|---|---|---|
doHotkey | None | None | Executes the hotkey as if it got triggered by the keyboard. |
Examples[edit]
-- List all hotkeys for a memory record local mr = AddressList[0] for i=0, mr.HotkeyCount-1 do local hk = mr.Hotkey[i] print("Hotkey:", hk.HotkeyString, "Action:", hk.action, "Active:", hk.Active) end -- Set a function to run when a hotkey is pressed local hk = mr.Hotkey[0] hk.OnHotkey = function(sender) print("Hotkey pressed for:", sender.Owner.Description) end -- Execute a hotkey manually hk:doHotkey()