Losing Hotkeys

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22408
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow »

i think your overestimating the effect its having on the majority of people.
it doesn't prevent any one from actually playing the game, only from using some 3rd party scripts, and there are work arounds for it.

so it really doesn't warrent a hotfix. Hotfix's are reserved for critical issues
User avatar
apricotslice
Posts: 14163
Joined: Sun, 16. May 04, 13:01
x4

Post by apricotslice »

I'd rather be wrong my way than yours. My way, people generally dont notice there was a problem. Yours, its a major disaster.

This is one of the reasons I left the IT industry. The unwillingness of those in charge to pay attention to unexploded bombs and neutralize them before they explode. I got sick of having to be a miracle worker after the event when my warnings got ignored.

If someone is going to be wrong, I'd rather it was me.

In the meantime, as I said, AP is a broken game for me. I'm no longer work on it. And I only play when I'm testing something. Game Over. Waiting now for X - The Next Generation (to find out if I can get it, at least.).
0o0o0
Posts: 93
Joined: Sun, 6. Mar 11, 19:33
x3ap

Post by 0o0o0 »

Thanks kurush. If you end up figuring it out please post it here and let us know.

I ended up starting a new game and have them all back now. As far as adding any new hotkeys does anyone have a way to do it without them overwriting any that I already have?
Aegyen
Posts: 245
Joined: Sat, 31. May 08, 19:33
x4

Post by Aegyen »

0o0o0 wrote:Thanks kurush. If you end up figuring it out please post it here and let us know.

I ended up starting a new game and have them all back now. As far as adding any new hotkeys does anyone have a way to do it without them overwriting any that I already have?
It does seem a bit hard to follow, doesn't it? :P It's NOT adding new hotkeys that gets you in trouble. It's when you remove a mod with a hotkey(s), and then install another one with hotkey(s). Then the order gets out of wack, and you end up with some overwritten.

Cycrow posted a small script to remove them all now, but... is there a way (scripting) to reinitialize the install hotkey routines? I realize many (most?) are set up using global variables, either in the setup script, or a seperate hotkey installation script. And, I haven't learned enough yet of the MSCI to see if there is a way. Can any of you scripting gurus see a way that maybe we can work together as a community to resolve this issue for the modding community as a whole?

I'm thinking something like a script that can be run when some disappear (are overwritten) that unregs all hotkeys, and then reinitializes all hotkey registrations (that exist in the game NOW) with a message before (Reinitializing, please wait..) and after (Hotkeys reinitialized, have a nice day.. :P )
User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle »

Cycrow wrote:i think your overestimating the effect its having on the majority of people.
Exactly.

The "noise" in this thread overwhelms the simple solution that I reported almost a week ago: Simply change the name of the hotkey in the setup script for any hotkey that has gone missing.

This increments the broken counter and restores the saved game to fully functional condition.

(You might have to do it for more than one hotkey.)
kurush
Posts: 4320
Joined: Sun, 6. Nov 05, 23:53
x3tc

Post by kurush »

DrBullwinkle wrote: The "noise" in this thread overwhelms the simple solution that I reported almost a week ago: Simply change the name of the hotkey in the setup script for any hotkey that has gone missing.
What do you mean by "name" here?
User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle »

Workaround for lost hotkey bug (AP versions prior to 2.1)

Use the script below.


* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Details
By "name" of the hotkey I mean:

<RetVar> = register hotkey <name> to call script <Script Name>

Or, for the Hotkey Manager:

<RetVar> = call script 'plugin.hotkeymanager.add' nameid='name' Display Text='My Hotkey' Hotkey Script='plugin.myscript.hotkey'

Change name to something else. Anything else (that is not already used by another hotkey). Then reload a saved game. This will add a second hotkey, with the broken counter incremented.

Result: Problem solved (for that saved game). :)

(You might have to do it for more than one hotkey setup script, but I only had to do it for the most-recently-added hotkey.)



* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
How the bug works

As clarified by Cycrow, the bug is (sometimes) caused when a hotkey is *removed* in AP versions 2.0a and below. The bug causes a minor corruption in the saved game, which makes new hotkeys frustrating.

The complete cure is to start a new game in AP 2.1 or above.

The above workaround is effective if you want to try to preserve a saved game that you began in AP 2.0a or lower.



* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Here is a script that I used to restore my broken hotkeys. It includes a lot of common scripts (plus a few others). You may have to add global variables from setup scripts that you use.

What it does: The script removes all of your hotkeys, plus many of the global variables that prevent hotkeys from being recreated. The result is that all of your hotkeys will be re-set. If you do this with recent versions of AP, then your game should be free of the hotkey bug forever. (Maybe :) )



How to modify for your game:
The global variables that control hotkeys are usually set in the setup script for the hotkey or script. So look in the setup script for any hotkey that has vanished in your game, find the name of the global variable, and add it to the script below. Then follow the instructions for using the script.



How to use this script:
1) Copy and paste the script into X-Studio Script Editor or Exscriptor. (Do not use a normal text or xml editor!).

2) Save as a script. Give it a name that you will remember. Tip: If the first character of the file name is an "a" then it will appear near the top of the list in the in-game Script Editor (SE).

3) Manually run the script from the script Editor (select then press "r"). It does not need any arguments, so just press Enter several times until you return to the SE list.

4) Save, then reload the save. Your hotkeys should be all blank. Re-set the hotkeys and enjoy the game. :)

Code: Select all

$id = 1536
while $id < 3000
unregister hotkey $id
inc $id
end

$hotkeys = array alloc: size=0

set global variable: name='manager.hotkeys' value=$hotkeys
set global variable: name='com.agent.hotkey1' value=[FALSE]
set global variable: name='com.logistics.hotkey1' value=[FALSE]
set global variable: name='com.logistics.hotkey2' value=[FALSE]
set global variable: name='missile.defense.mosquito.hotkey1' value=[FALSE]
set global variable: name='yalam.ship.trader.hotkey' value=null
set global variable: name='LitQB.Bounce.HotKey.Toggle' value=null
set global variable: name='GZ.TURRET.ONOFF.CONFIG' value=null
set global variable: name='plugin.advthrust.key' value=null
set global variable: name='cycrow.cheat.hotkey' value=null
set global variable: name='cheat.hotkey.destruct' value=null
set global variable: name='cheat.hotkey.destruct' value=null
set global variable: name='hotkey.scs' value=null
set global variable: name='jump.hotkey' value=null
set global variable: name='hotkey.plugin.loadout' value=null
set global variable: name='lv.ep.hk' value=null
set global variable: name='lv.ep.hk1' value=null
set global variable: name='plugin.mailo.loot.ship.loot.hotkey' value=null
set global variable: name='plugin.mailo.loot.check.loot.hotkey' value=null
set global variable: name='plugin.mailo.loot.consumable.afterburner' value=null
set global variable: name='plugin.mailo.loot.consumable.shieldboost' value=null
set global variable: name='plugin.mailo.loot.consumable.weaponboost' value=null
set global variable: name='bw.phq.upgrade.config.key' value=null
set global variable: name='raumwarentransporter.hotkey' value=null
set global variable: name='missile.defense.mosquito.hotkey1' value=null
set global variable: name='RC.scanTargetObject.key' value=null
set global variable: name='ship.hijacker.registered' value=null
set global variable: name='warp.hotkey' value=null
set global variable: name='xtlc.cs.hotkey' value=null
set global variable: name='hotkey.xai.launch.fdrone' value=null
set global variable: name='xi.hack.target.k' value=null
set global variable: name='hotkey.xai.missiledef' value=null
set global variable: name='SC.Dev.Chat.Hotkey' value=null
set global variable: name='RSwE.Hotkey' value=null
set global variable: name='wob.wse.hotkey.menu' value=null
set global variable: name='trov.hotkey' value=null
set global variable: name='globvar.terranpolicelicence.setupscriptversion' value=null
* Note: This will wipe Smart Turret configuration completely:
set global variable: name='Glen.Smart.Turret' value=null
set global variable: name='missile.defense.mosquito.hotkey1' value=null
* Note: This will wipe MARS configuration completely:
set global variable: name='GZ.MARS.CONFIG' value=null
return null


The above is based on kurush's similar script.

.
Last edited by DrBullwinkle on Sat, 26. Jan 13, 22:04, edited 6 times in total.
Aegyen
Posts: 245
Joined: Sat, 31. May 08, 19:33
x4

Post by Aegyen »

DrBullwinkle wrote:
Cycrow wrote:i think your overestimating the effect its having on the majority of people.
Exactly.

The "noise" in this thread overwhelms the simple solution that I reported almost a week ago: Simply change the name of the hotkey in the setup script for any hotkey that has gone missing.

This increments the broken counter and restores the saved game to fully functional condition.

(You might have to do it for more than one hotkey.)
I missed that too, Doc... And thank you, I do enough testing at times, so run into the hotkey thing more than I'd like to. While not elegant, it will work until it's fixed, or a more elegant solution comes along.

I see the problem with a 1 fix for all. It doesn't look like a solution (script) could be made that would work for all the 100s of combinations of modded games. And all the diffrent ways scripters put their hotkeys into the game.
kurush
Posts: 4320
Joined: Sun, 6. Nov 05, 23:53
x3tc

Post by kurush »

Aegyen wrote: I see the problem with a 1 fix for all. It doesn't look like a solution (script) could be made that would work for all the 100s of combinations of modded games. And all the diffrent ways scripters put their hotkeys into the game.
Yeah, a canned solution is almost impossible here. Dr.B's method seems to be the best. I actually think I ended up doing something similar to restore the hotkeys I lost in my game, just didn't realized it was the name change among other chaotic changes that fixed things :) It would be likely necessary to also clear any global variable the script uses to track the hotkey, otherwise it just won't get re-registered.
Ok, now it is time to finally write that missile spam hotkey I was contemplating for a long time.
Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22408
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow »

a script might be able to to work, but there would be no guarntees.

most scripts tend to use simlar names for thier global variables so you can use the reg ex commands to get a list of the various types of names used to remove them.

this wouldn't help for any scripts that use odd names thou, those your only choise is to do it manually
User avatar
apricotslice
Posts: 14163
Joined: Sun, 16. May 04, 13:01
x4

Post by apricotslice »

None of that addresses the issue of having to reassign the hotkeys to keys every time you start a new game.

That actually bothers me more than losing a hotkey.
User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle »

apricotslice wrote:None of that addresses the issue of having to reassign the hotkeys to keys every time you start a new game.
My solution does. It completely fixes the broken saved game. You will have to reassign ONE hotkey (or, possibly, a small number), and you will only have to reassign it/them once.

Try it before complaining about it. :P

.
User avatar
apricotslice
Posts: 14163
Joined: Sun, 16. May 04, 13:01
x4

Post by apricotslice »

DrBullwinkle wrote:
apricotslice wrote:None of that addresses the issue of having to reassign the hotkeys to keys every time you start a new game.
My solution does. It completely fixes the broken saved game. You will have to reassign ONE hotkey (or, possibly, a small number), and you will only have to reassign it/them once.

Try it before complaining about it. :P

.
Game start = zero save games. How does fixing a save game affect a game start ?

I repeat, every time you start a new game, all hotkey assignments are removed, including the custom saves of hotkeys.

Try it yourself.
User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle »

apricotslice wrote:every time you start a new game, all hotkey assignments are removed
As far as I know, the game has always worked that way. Is your comment relevant to this thread?
User avatar
apricotslice
Posts: 14163
Joined: Sun, 16. May 04, 13:01
x4

Post by apricotslice »

DrBullwinkle wrote:
apricotslice wrote:every time you start a new game, all hotkey assignments are removed
As far as I know, the game has always worked that way. Is your comment relevant to this thread?
AP yes. TC and before, no. In the past, hotkeys got assigned once, and you never needed to reassign them again unless you reinstalled the game.

The entire way hotkeys are done was rewritten for AP, to solve some issues that were in TC, like multiple installs of the same hotkey.

Hotkeys disappearing is only PART of the problem I originally brought up.

I want to WHOLE problem solved, not just that one bit of it.
User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle »

I'll take that as a "no".

Thank you.
User avatar
apricotslice
Posts: 14163
Joined: Sun, 16. May 04, 13:01
x4

Post by apricotslice »

Take it any way you want.

The whole hotkey system is buggered in AP.

If all your interested in is the bit that you have a workaround solution for, thats your business.

I look at the whole problem, not the bandaid for the symptom.
Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22408
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow »

the only change to hotkeys in AP was that it now checks if an existing hotkey is already registered, and overrights instead of adds a new one.
This has exposed an existing problem that was been present since X3 Reunion. Just hidden.
The hotkey system hasn't been rewritten, despite what you may think

there was no change to how the keys are assigned or stored.

are you sure u've set it to use the correct profile ? as the assigned keys are stored in the profile and it its not set, it'll load the defaults which wont include the added hotkeys.

i've started lots of TC and AP games while testings, and they both work in the same way
Ook
Posts: 39
Joined: Sun, 28. Dec 03, 12:53
x3tc

Post by Ook »

Cycrow wrote:the only change to hotkeys in AP was that it now checks if an existing hotkey is already registered, and overrights instead of adds a new one.
This has exposed an existing problem that was been present since X3 Reunion. Just hidden.
The hotkey system hasn't been rewritten, despite what you may think

there was no change to how the keys are assigned or stored.

are you sure u've set it to use the correct profile ? as the assigned keys are stored in the profile and it its not set, it'll load the defaults which wont include the added hotkeys.

i've started lots of TC and AP games while testings, and they both work in the same way
Any plans to release an update that fixes this bug?
As atm X3AP will only allow a max of 11 hotkeys here & any new script added removes the existing ones from the menu.
User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle »

Ook wrote:Any plans to release an update
Easy Way to Repair Saved Games with Broken Hotkey Counter

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”