I've tried to do this a few times in the past with only limited success. As I may have mentioned, the problems are legion:
- Backwards compatibility (eg. with macros)
- Different keystrokes for different worlds
- Some "standard" keystrokes (eg. Alt+F4 to close program) which are not really world-dependant.
- Modifying the text when you look at menu items (eg. Copy ... Ctrl+C) - what happens to that if you reassign Ctrl+C?
- A GUI dialog for adding/modifying/deleting keystrokes
- Need different keystrokes when other windows are open (eg. the notepad)
However after reading your message I think perhaps I have been overthinking the problem. :)
What you really want is a way of having custom keystrokes to do various things, you probably don't really care if the text on a menu is a little out of date.
So, in version 3.53 there is now a facility to do just that. It is done purely in the scripting interface, but I think you will agree it looks pretty simple to use:
Accelerator ("Ctrl+K", "kill")
Accelerator ("Ctrl+F", "follow")
Accelerator ("Ctrl+E", "eat meat")
-- execute a script
Accelerator ("Ctrl+M", "/DoCommand 'preferences'")
Accelerator ("Alt+F4", "") -- disable Alt+F4
What this does is let you, per world, reassign any key (or add new keystrokes) by using the fairly simple syntax above.
The text you define for each key is sent to the MUSHclient command processor, so it can be speedwalks, aliases, script commands or whatever you can normally type. The example above shows how you could make Ctrl+M bring up the preferences dialog.
To automate this process, you can define a list of keys you want to assign, and put it into your script file. You would probably put them into the OnWorldOpen function. That is, make a script function called when the world is opened, and put all your keystrokes into that.
Or, put them into a plugin. Whatever works for you.
If you want to share them between worlds, either share the same script file, or "include" the file per world. For example in Lua you might do this:
dofile "mykeystrokes.lua"
There is another new function, AcceleratorList, that lets you query what keys you have assigned. eg. in Lua:
for _, v in pairs (AcceleratorList ()) do print (v) end
-- output:
Ctrl+E = eat meat
Ctrl+F = follow
Ctrl+K = kill
Ctrl+M = /DoCommand 'preferences'
Alt+F4 =
You could build in extra functionality into a script if you wanted, for example to sort the output, filter on a particular word, and so on.