Losing Hotkeys
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 93
- Joined: Sun, 6. Mar 11, 19:33
Losing Hotkeys
Now that I'm a fair way into my game I noticed that my hotkeys for the cheats instant brake and instant accel are missing. A few days later (I probably installed another script somewhere during this time) I'm missing the reload shields hotkey. Anyone know of a simple fix- maybe using the hotkey manager- for this?
-
- Posts: 14163
- Joined: Sun, 16. May 04, 13:01
It happens when you add new hotkeys and somehow they overwrite old ones.
There is no real fix.
If you catch it immediately, you can abort the game, shut down the computer, cold restart the computer, load game, load save from before adding the new hotkey. That should load the new hotkey correctly. Then save again to be sure you keep it.
But if you add a hotkey after already starting the game, it buggers your list up. No fix if you progress to a new save with it wrong.
At this point, Egosoft are aware of it, have put it to the person who can fix it, but nothing so far has been done. Given that it only happens in a modded game (so far), they dont give it any priority.
Scripting wise, I'm now avoiding using hotkeys and going back to commands.
I dont hold any hope of this being fixed in the mid to long term, if ever. Its a case of them fixing a TC bug by breaking something different in AP and until they do a Bonus Pack update that introduces a new hotkey, they wont care about the bug because it wont affect vanilla players until then. If they never update the Bonus pack with a new hotkey, they will never trigger a need to get it fixed.
Btw, its the hotkey manager thats broken. It was completely rewritten at the command level for AP, and they c*cked it up badly. Obviously no one tested it at all before the game was released.
If your lost hotkeys are a game breaker, you may as well start a new game, as thats the only way to get them all back. BUT, do the game start after a cold start of the computer. Even shutting down and restarting doesnt clear the problem, only power off works. First thing you do is check they are all listed, and reassign all of them to the keys you want them on.
There is no real fix.
If you catch it immediately, you can abort the game, shut down the computer, cold restart the computer, load game, load save from before adding the new hotkey. That should load the new hotkey correctly. Then save again to be sure you keep it.
But if you add a hotkey after already starting the game, it buggers your list up. No fix if you progress to a new save with it wrong.
At this point, Egosoft are aware of it, have put it to the person who can fix it, but nothing so far has been done. Given that it only happens in a modded game (so far), they dont give it any priority.
Scripting wise, I'm now avoiding using hotkeys and going back to commands.
I dont hold any hope of this being fixed in the mid to long term, if ever. Its a case of them fixing a TC bug by breaking something different in AP and until they do a Bonus Pack update that introduces a new hotkey, they wont care about the bug because it wont affect vanilla players until then. If they never update the Bonus pack with a new hotkey, they will never trigger a need to get it fixed.
Btw, its the hotkey manager thats broken. It was completely rewritten at the command level for AP, and they c*cked it up badly. Obviously no one tested it at all before the game was released.
If your lost hotkeys are a game breaker, you may as well start a new game, as thats the only way to get them all back. BUT, do the game start after a cold start of the computer. Even shutting down and restarting doesnt clear the problem, only power off works. First thing you do is check they are all listed, and reassign all of them to the keys you want them on.
-
- Moderator (Script&Mod)
- Posts: 22409
- Joined: Sun, 14. Nov 04, 23:26
actually thats incorrect, the hotkey manager and the AP hotkeys are 2 different things.apricotslice wrote: Btw, its the hotkey manager thats broken. It was completely rewritten at the command level for AP, and they c*cked it up badly. Obviously no one tested it at all before the game was released.
the problem is actually due to a bug that has existed since X3R but only started showing up due to the better hotkey handling in AP.
if you dont call the unregister hotkey command, you shoudl be able to avoid the problem. It happens because the old system used the amount of registered hotkeys as the next available id.
So if you add 10 hotkeys, the next id will be 11. If you remove a hotkey the next id will then goto 10. But as 10 is already assigned to a hotkey, it just ends up getting overwritten. The problem appeared because in AP it checks if a hotkey is already registered first, if it exists it changes the existing entry instead of simply adding another.
Its not such a major problem that there needs to be a hotfix specifically for it. If theres ever a new patch then a fix can be included then
-
- Posts: 14163
- Joined: Sun, 16. May 04, 13:01
@Cycrow
Did you modify the hotkey manager for AP ? If so, whats the link to its download ?
There are no unregister calls in my scripts, only in the hotkey manager add script (that I can find), and I frankly dont understand that code.
So if you didnt update hotkey manager for AP, I'd want to see some code for what needs changing.
I dont like the idea of me changing your code without knowing what I'm doing.
Did you modify the hotkey manager for AP ? If so, whats the link to its download ?
There are no unregister calls in my scripts, only in the hotkey manager add script (that I can find), and I frankly dont understand that code.
So if you didnt update hotkey manager for AP, I'd want to see some code for what needs changing.
I dont like the idea of me changing your code without knowing what I'm doing.
-
- Posts: 5715
- Joined: Sat, 17. Dec 11, 01:44
I stumbled across a workaround a couple of days ago. I did not know why it worked until your explanation. It is a one-minute fix for an already-corrupted saved game:Cycrow wrote:if you add 10 hotkeys, the next id will be 11. If you remove a hotkey the next id will then goto 10. But as 10 is already assigned to a hotkey, it just ends up getting overwritten.
Create a new hotkey (for the overwritten script) with a new name.
1) Open the setup script in the Script Editor.
2) Change the name of the hotkey (not the script that it calls).
3) Save and reload.
Peace through superior firepower
Bullwinkle's List | Marine Repairs and Training | Mobile Mining Mk2 | Drone Carrier Software 2 (DCS2) | Ship Tricks: Mini-Guides (with Video)
Bullwinkle's List | Marine Repairs and Training | Mobile Mining Mk2 | Drone Carrier Software 2 (DCS2) | Ship Tricks: Mini-Guides (with Video)
-
- Posts: 4320
- Joined: Sun, 6. Nov 05, 23:53
Isn't it already the case due to borked synchronization logic in the purge script? I found lots of orphan hotkeys in the hotkey manager collection when investigating this issue.Cycrow wrote:i've not modified yet, but ill upload a version where it removes the unregistered command completly
One thing I am wondering about: would it be possible to trick the system by registering enough "dummy" hotkeys to make it actually allocate a new one? i.e. create 100 "return null" script files called
my.crappy.script.001.xml through 099.xml and then keep registering them until you get a different hotkey handle number? I was able to make some hotkeys to show up after unregistering some hotkeys I do not use via an ad-hoc script.
-
- Moderator (Script&Mod)
- Posts: 22409
- Joined: Sun, 14. Nov 04, 23:26
-
- Posts: 4320
- Joined: Sun, 6. Nov 05, 23:53
Awesome, exactly what we need. It should be fairly easy to write a script that unregisters all hotkeys and resets whatever global variables are used by scripts not using hotkey manager.Cycrow wrote: also, unregistered all hotkeys will also fix it as it'll reset the id back to 0 and allow new ones to be added
-
- Moderator (Script&Mod)
- Posts: 22409
- Joined: Sun, 14. Nov 04, 23:26
a simple script to unregister them all
Code: Select all
$id = 1536
while $id < 3000
unregister hotkey: $id
inc $id
end
-
- Posts: 14163
- Joined: Sun, 16. May 04, 13:01
-
- Moderator (Script&Mod)
- Posts: 22409
- Joined: Sun, 14. Nov 04, 23:26
im only suggesting the fix in a broken game. to you dont have to start a new game to get the hotkeys back
not something u should do every time you load the game.
if you avoid using unregister then it should be avoided.
as i said, it cant be fix without needed a patch, so until theres a patch, the only thing to do is use work arounds
not something u should do every time you load the game.
if you avoid using unregister then it should be avoided.
as i said, it cant be fix without needed a patch, so until theres a patch, the only thing to do is use work arounds
-
- Posts: 93
- Joined: Sun, 6. Mar 11, 19:33
@cycrow. so if I run that script it will unassign all my hotkeys and return the ones that have been deleted? That would be worth it to get my hotkeys back without starting over. Also, if I want to add another script that brings in more hotkeys to my game, how can I avoid it overwriting any of my current hotkeys?
-
- Posts: 4320
- Joined: Sun, 6. Nov 05, 23:53
As far as I can see, it won't return anything. You will also need to clear the hotkey manager global collection to make it re-register the hotkeys managed by it.0o0o0 wrote:@cycrow. so if I run that script it will unassign all my hotkeys and return the ones that have been deleted? That would be worth it to get my hotkeys back without starting over. Also, if I want to add another script that brings in more hotkeys to my game, how can I avoid it overwriting any of my current hotkeys?
For any script that does not use the hotkey manager you would need to investigate how does it manage its hotkey handle. Usually it is a global variable and you will need to reset it to whatever value causes this script to register its hotkey. I am planning on doing it with my game at some point.
-
- Posts: 14163
- Joined: Sun, 16. May 04, 13:01
The whole thing is a dogs breakfast and needs to be FIXED.
No offense intended Cycrow, but I think you underestimate the problem and its effects on people. Our previous discussion on this highlighted a much more extensive problem than what you outline here.
Personally, I consider AP broken by this problem. And I consider it to be a major problem worthy of its own patch. I've halted all mod development work, because I'm sick to death of redoing all the hotkeys every time I start a new game to test something, and having a new hotkey buggering up an ongoing test game.
But as I said before, if Egosoft never add a new hotkey to the Bonus Pack or in a patch, the problem will never occur in vanilla and thus they wont give it any priority to fix. However, if they dont fix it and at some point they add a new hotkey to the vanilla game, all hell will break loose when it breaks vanilla games unexpectedly. If I was them, I'd be fixing this one as a priority because its an unexploded bomb waiting to be triggered.
No offense intended Cycrow, but I think you underestimate the problem and its effects on people. Our previous discussion on this highlighted a much more extensive problem than what you outline here.
Personally, I consider AP broken by this problem. And I consider it to be a major problem worthy of its own patch. I've halted all mod development work, because I'm sick to death of redoing all the hotkeys every time I start a new game to test something, and having a new hotkey buggering up an ongoing test game.
But as I said before, if Egosoft never add a new hotkey to the Bonus Pack or in a patch, the problem will never occur in vanilla and thus they wont give it any priority to fix. However, if they dont fix it and at some point they add a new hotkey to the vanilla game, all hell will break loose when it breaks vanilla games unexpectedly. If I was them, I'd be fixing this one as a priority because its an unexploded bomb waiting to be triggered.