Dynamically Assign Hotkeys?
Posted: Tue Sep 28, 2021 7:31 pm
I'm trying to assign hotkeys to a cheat via Lua. The cheat exists as a memory record in a table, NOT a trainer. The hotkey is supposed to set a value of that record.
Usage: My memory record points to spells in a game. The game doesn't allow keyboard keys for switching between spells. I want to use CE's hotkey feature to assign keyboard keys to spell ids.
Why Lua: Yes, I can assign several keys to the memory record and hard set each one to apply a specific value. In fact, this already works. However, I want to load the keys from an ini file so that my table is more distributable. I upload signed tables, so I can't ask users to assign their own keys if they want different keys mapped to different spells.
I have code that loads, reads and splits the ini into
1. How to transform T and I into the respective VK values -- NOT as "VK084" (string) but as VK084 (constant).
2. How to assign the hotkey so that T sets the memrec value to 23, I sets it to 5 and so on.
Ideally, the memrec will have 0 assigned hotkeys until this function is called. Any help will be appreciated.
Thanks!
Usage: My memory record points to spells in a game. The game doesn't allow keyboard keys for switching between spells. I want to use CE's hotkey feature to assign keyboard keys to spell ids.
Why Lua: Yes, I can assign several keys to the memory record and hard set each one to apply a specific value. In fact, this already works. However, I want to load the keys from an ini file so that my table is more distributable. I upload signed tables, so I can't ask users to assign their own keys if they want different keys mapped to different spells.
I have code that loads, reads and splits the ini into
{[T]=23,[I]=5},...
. I now face 2 problems:1. How to transform T and I into the respective VK values -- NOT as "VK084" (string) but as VK084 (constant).
2. How to assign the hotkey so that T sets the memrec value to 23, I sets it to 5 and so on.
Ideally, the memrec will have 0 assigned hotkeys until this function is called. Any help will be appreciated.
Thanks!