I've been working with some basic accelerators for a while now, and they're being... uncooperative. Since I'm working on a laptop, I don't really have a NumPad to use for my basic directions. Instead, I set things (using scripted accelerators) like CTRL+8 to north, CTRL+K to south, etc.
The problem is that I can't use accelerators for any key combination that has another hotkey. For example, CTRL+I sets an indent on the command line instead of executing "look," like my accelerators tells me it -should-. I know that my coding is correct, because combinations that don't have other associations work just fine.
Is there a setting somewhere that's conflicting with my accelerators, or what?
I think what is happening is that you first set the CTRL+I accelerator and then unset it somewhere with Accelerator("Ctrl+i" ,""). By default, CTRL+I in Mushclient opens the Immediate execution window, and to get it to indent the command line you'd need to do what I described.
So try looking for some place where that accelerator is reset.
And Nick: I think resetting an accelerator doesn't remove it from AcceleratorList() for some reason.
I understand what you mean, but... I don't have a long enough script for any accelerators to be reset. Seriously, This is the only script (I'm trying out Lua, BTW) I have:
Accelerator ("Ctrl+8", "north")
Accelerator ("Ctrl+9", "northeast")
Accelerator ("Ctrl+O", "east")
Accelerator ("Ctrl+L", "southeast")
Accelerator ("Ctrl+K", "south")
Accelerator ("Ctrl+J", "southwest")
Accelerator ("Ctrl+U", "west")
Accelerator ("Ctrl+7", "northwest")
Accelerator ("Ctrl+Alt+7", "up")
Accelerator ("Ctrl+Alt+U", "down")
Accelerator ("Ctrl+Alt+9", "in")
Accelerator ("Ctrl+Alt+O", "out")
That's it. Nothing after that. There's no chance for it to be reset, unless it's embedded somewhere besides the script. And if I put in a test macro that sends a note or something, it works fine as long as it's not for a key combination that has a default usage.
Hm, I've made a new discovery, after a little bit of fiddling. Whichever accelerator is the last one listed works, but the others don't. So if I delete a few lines of accelerators, the bottom one will work. This is true for any key combination, whether it has a default or not.
Is there an endline character or something that I'm leaving out? Why is it only the last line of the script that works?
You mean that in the list you posted only Accelerator ("Ctrl+Alt+O", "out") works?
Yeah, that's exactly what I mean. And if I deleted that line, then the "in" keybinding would work. And if I deleted the bottom set, then the "northwest" one would work.
Okay, I keep exploring options and trying to figure this out, and here's another piece of information that might help someone help me. ^.^
This problem seems to be a difference between versions. I'm running 3.78, but I had a working script in version 3.70 a few months back. I imported the old script to the new version, and I'm having exactly the same problem. Is there a significant difference between these two versions that would cause a problem like the one I'm having?
There was a change in 3.75 to allow empty accelerators to reset back to the default behaviour.
However I tested your script above and all of the accelerators worked, not just the last one. This was in version 3.80, but accelerators were not changed since 3.75 that I can recall (nor in the release notes).
Quote:
For example, CTRL+I sets an indent on the command line instead of executing "look,"
The default behaviour for Ctrl+I is to open the immediate window, not indent the command line.
Anyway, I tested with setting an accelerator for Ctrl+I and that worked fine.
That's bizarre. I definitely trust you, Nick, and thanks for checking into it. I'll leave this alone for now, unless I come across an explanation or something. Hm.
Thanks for alerting me to a possible problem. I actually tested it on a laptop too. :)
Possibly there are some laptop keyboard remapping functions that are interfering with MUSHclient?
According to this thread
http://www.gammon.com.au/forum/bbshowpost.php?id=5287 the problem might be windows ME. Also on my Win98 computer, only the last accelerator works.