[SCRIPT] Remove Hotkeys - v2

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

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

Post Reply
User avatar
Graxster
Posts: 817
Joined: Sat, 14. Oct 06, 01:01
x3tc

[SCRIPT] Remove Hotkeys - v2

Post by Graxster » Tue, 25. Nov 08, 01:14

Remove Hotkeys

This is a powerful tool that will allow you to remove hotkey entries that you no longer use or want, and that the author of the script didn't provide uninstall scripts for. It uses the new menu system to display a list of possible hotkeys. You then select a name from the list that you think is the correct one for your hotkey. Making a mistake will not break your game, but if you do make a mistake, you should re-load your last save and try again. The proper steps to take:
  • Look at your hotkeys in Controls > Interface and decide which you want to remove.
  • Run the script.
  • Select a name that appears to be the correct name.
  • Go to Controls > Interface and see if the hotkey is now gone.
  • If it's gone, save your game. If it's not gone, re-load your last save and try again.
If you follow those instructions, it's perfectly safe to use. 8)

You've been warned!

The reason I'm warning you: There's no scripting command, "Get such-and-such hotkey" or even "Get global variable; Is global variable a hotkey or something else?". Also, they're not always named "hotkey" or "key" either. So I have to display all the global variables. If you select the wrong one, it will set the value of that global variable to "null". Take a look at what you'll see:

[ external image ]

I'm putting up 2 different versions for download. One requires Cycrow's Community Configuration Menu, the other (for those that don't use/want the CCM) can be run from the script editor. Sorry, no SPK version this time. Enjoy!

-Grax

---------------------------------------------------------------------------------------------

Update: Should now display only hotkeys (or pretty close to that)

Update - Version 2: Now works correctly (left out a file, lol). Added Emergency Hotkey Removal.

WARNING: I can not be held responsible for you deciding to use the Emergency Hotkey Removal tool. :D
Selecting this option should remove ALL hotkeys, regardless of whether they were registered correctly or not.

---------------------------------------------------------------------------------------------

RAR Archive - Requires Cycrow's CCM

[ external image ]

RAR Archive - run from script editor

[ external image ]
Last edited by Graxster on Wed, 26. Nov 08, 04:36, edited 3 times in total.

angrysquirrel
Posts: 267
Joined: Tue, 18. Nov 03, 00:46
x3

Post by angrysquirrel » Tue, 25. Nov 08, 01:35

dude that's a great tool! I remember having multiple hotkeys of same item in x3 when I reinstalled the script multiple times. That is why I like this tool Finally some way to fix the problem. :) Where do I put the script files though? In the scripts directory? (just want to make sure).

jimhsu77479
Posts: 168
Joined: Sun, 25. Nov 07, 22:39
x4

Post by jimhsu77479 » Tue, 25. Nov 08, 01:38

Wow I needed this yesterday ... was manually going through 50 extra hotkeys and guessing which ones were extra.

User avatar
Graxster
Posts: 817
Joined: Sat, 14. Oct 06, 01:01
x3tc

Post by Graxster » Tue, 25. Nov 08, 05:14

Yes, put it in the scripts directory.

-G

rubberman
Posts: 120
Joined: Wed, 6. Nov 02, 20:31
x4

Post by rubberman » Tue, 25. Nov 08, 20:41

Something odd here the menu appears blank in game, both versions attempted

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

Post by Cycrow » Tue, 25. Nov 08, 20:46

i have a few suggestions

1. Add the ability to filter certain ones. Ie, filter something like *key*. Make an option to turn it off or on. Then you can get most of them without all the extras

2. Remove the ones you definatly know are not keys, ie, any page ones. so you dont need to list them all

ThisIsHarsh
Posts: 1135
Joined: Sun, 19. Oct 08, 18:46
x3tc

Post by ThisIsHarsh » Tue, 25. Nov 08, 22:10

Yeah also, hotkeys are numbers, so no need to show any globals that do not reference numbers.

Here is my script to unregister all hotkeys *not* assigned to a global variable (i.e. added without realising you need to store a global to remove them later :roll: ), maybe you can find bits of it useful:

Code: Select all


001   $global.arr =  get global variables: regular expression='.*'
002   
003   $id = 2000
004   
005   while $id
006   |$found = [FALSE]
007   |$global.idx =  size of array $global.arr
008   |
009   |while $global.idx
010   ||dec $global.idx = 
011   ||$global = $global.arr[$global.idx]
012   ||$global.value = get global variable: name=$global
013   ||if $global.value == $id
014   |||$found = [TRUE]
015   |||break
016   ||end
017   |end
018   |
019   |skip if $found
020   ||unregister hotkey $id
021   |
022   |dec $id = 
023   end
024   
025   return null

bounty_hunter66
Posts: 550
Joined: Tue, 15. Aug 06, 13:36
x4

Post by bounty_hunter66 » Tue, 25. Nov 08, 23:30

No hotkeys are shown up in that menu despite i have alot of hotkeys

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

Post by Cycrow » Tue, 25. Nov 08, 23:35

bounty_hunter66 wrote:No hotkeys are shown up in that menu despite i have alot of hotkeys
just do you know, the script doesn't display what hotkeys you have, it display what hotkeys scripts have properly registered, ie, they have stored thier global varible of the key.

if the script fails to do this and you end up with lots of hotkeys for the same, then this wont help you

User avatar
Graxster
Posts: 817
Joined: Sat, 14. Oct 06, 01:01
x3tc

Post by Graxster » Wed, 26. Nov 08, 00:12

I tried that, but apparently either the script engine is wacky, or it doesn't agree with me. I tried:

Code: Select all

$name= get global variable name: $text
skip if not is datatype [DATATYPE_INT] $name
.. (add to menu)
Now, to me, DATATYPE_INT means "datatype integer", which is any number, right? Now although all the hotkey $names were coming back as numbers (verified by writing to logbook), using the above filter results in nothing being added to the menu.

:?

-Grax

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

Post by Cycrow » Wed, 26. Nov 08, 00:20

u sure thats how the command appears, as it should look like

is datatyp [ $name ] == DATATYP_INT

User avatar
Graxster
Posts: 817
Joined: Sat, 14. Oct 06, 01:01
x3tc

Post by Graxster » Wed, 26. Nov 08, 00:50

Yeah, that was me being a dumba$$, rofl. Thanks! I knew that too! Too much scripting, not enough gaming! 8)

-G

Edit: Thanks guys, got it narrowed down now. Should be less confusing now.

Edit 2: Sorry ppl, if it wasn't working or appeared blank, please re-download. I forgot to include a file. Should be working now.

Post Reply

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