Patch for hotkey modding tutorial
-
Since it's another part , I'm aiming to post a new post.
What's the difference between UserKeyActions and UserKeyMap ?
1. Every time you insert something into UserKeyActions , the game will automatically update UserKeyActions table in game.prefs , but without a specific hotkey bound , what is updated is only UserKeyActions .
2. Once you distribute a hotkey for the added new action , the game will copy the default key mappings into UserKeyMap and UserDebugKeyMap , and automatically update your custom hotkey into UserKeyMap even if it's a debug hotkey , thus UserDebugKeyMap is not important in this case.
3. As a kind of overriding specification of SupCom , once UserKeyMap exists , the game will only read mappings from UserKeyMap , ignoring default key mappings , which is why if you delete some of UserKeyMap's elements , the corresponding hotkey lost in game.
4. To solve 3 , you can delete UserKeyMap entirely , which drives game to read datas from default file .
5. UserKeyActions is maybe a interface left by someone to make customing hotkeys easier . It's complex to explain , but there is a bug if you don't use this convenience :
Your own hotkeys won't be recognized until F1 pressed detecting hotkey files once again , since the command path is written else where the program had already passed through ,while the path written in UserKeyActions can be recognized automatically. (there is no place other than /lua/keymap that can be read if you don't use UserKeyActions )
Thus I think it's impossible to define custom hotkeys in /lua/keymap by table operations in gamemain.lua . The program had already passed through.
6. Defaultly , players don't have UserKeyMap or UserKeyActions in game.prefs , if you do , maybe your game had encountered a SetUserKeyAction command sometime , and you gave the custom action a hotkey .
7. It's terrible to get polluted game.prefs rid of various custom hotkey mappings from UserKeyActions and UserKeyMap by programming manner . If you have a polluted game.prefs consists of tons of esoteric hotkey mappings , delete the UserKeyMap , leaving the actions blank without hotkey , and distribute them manually again.