Jump to content

[LE] Hotkeys aren't updating. They stay with the save game.


monsto

Recommended Posts

int dxcode_variable = 59 ; F1 key
UnregisterForAllKeys() 
RegisterForKey(dxcode_variable)

My code is on a playeralias on a nothing shell of a quest.

 

At first I had the lines 2-3 above (and all the other registered keys) in `Event OnInit` until I realized that it was causing my keys to not change at all ever after I updated the script. So I moved it to `Event OnPLayerLoadGame` which works . . . if you load the mod, save the game then load the game.

 

`Event OnPLayerLoadGame` however does NOT work if an earlier version of the script was previously loaded and I load that save.

 

Example. . . I had set keys 9&0 for increment/decrement a var that tracks the players current position. I updated that script a bit, changed the keys to [] and compiled.

 

doing in game `reloadscript scriptname` then reloading that save game, does not affect the key assignments. The rest of the script updates, but 9 & 0 still work and [ ] don't. In order to make it work, I have to either load a more previous save (that didn't have the mod attached, or use a savegame tool to remove the mod (effectively the same thing)

 

So how do I make this work?

Link to comment
Share on other sites

My suggestion, if possible, use a MCM menu and let the player configure the keys. You'll have the advantage of not needing to specify values but rather call upon global variables to retrieve the stored value.

 

The pre-MCM method was to use global variables to store the hotkey values, change them in the console and ensure that your code would check against the value of the global variable rather than using something in memory.

Link to comment
Share on other sites

My suggestion, if possible, use a MCM menu and let the player configure the keys. You'll have the advantage of not needing to specify values but rather call upon global variables to retrieve the stored value.

 

The pre-MCM method was to use global variables to store the hotkey values, change them in the console and ensure that your code would check against the value of the global variable rather than using something in memory.

 

global vars ok.

 

I was avoiding MCM as I couldn't get a grip on how to set it up when I looked at it.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...