Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ General ➜ Macro or keyboard mapping

Macro or keyboard mapping

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Somegirl   (33 posts)  Bio
Date Tue 23 Nov 2004 09:10 AM (UTC)
Message
Does anyone remember the post that mentioned a third-party substitution for this? I can't find the post anymore.

Also, has anyone used it? How well does it work?

I have been relentlessly advertising Mushclient to IRE games users who currently play their games with the custom Java client that the have on each game's website. One of the common reasons that I'm given that they won't switch is the number of available macros.
Top

Posted by Poromenos   Greece  (1,037 posts)  Bio
Date Reply #1 on Tue 23 Nov 2004 08:59 PM (UTC)
Message
Would it be hard to make a customizable menu shortcut key function? For example, any key combination could be assigned to an existing function, like Edit:Copy or whatever, or to a macro. This would merge with the standard macro dialog.

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #2 on Thu 25 Nov 2004 04:16 AM (UTC)
Message
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.



- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #3 on Thu 25 Nov 2004 06:25 AM (UTC)

Amended on Thu 25 Nov 2004 06:30 AM (UTC) by Flannel

Message
Will you be including a keymapping plugin of somesort?
With the ability to add/list/edit/delete keymaps?

Is it possible to do it in a plugin?
Its just a script that would get executed everytime the world is opened, right? (and on script reload?)
Is Accelerator a MC function? (Nevermind, I read the function list)

Does this trump macros? Or do Macros still work (instead of? or in concert with?)

I guess if its a MC function (first time I read it, I thought it was a LUA function), then its a lot like other clients (tintin) handle their triggers/macros/aliases?

Perhaps it would be a good idea to include a GUI interface? Treat it like aliases/triggers, where its a blank table (as opposed to macros), and then add entries.
I cant imagine it'd be too hard, and would make it more consistant.

Perhaps take OUT the macros then too, since this makes them a bit moot. Or convert the macro dialog to this, or merge them somehow? Then again, you would lose the ability to replace or insert, without some scripting.

Well, I guess I got a bit tangential at the end there.

Edit: Answered my own question about it being a MC function.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

Posted by Somegirl   (33 posts)  Bio
Date Reply #4 on Thu 25 Nov 2004 09:29 AM (UTC)
Message
Nice work Nick! I'll be sending a link to this post out to my friends that have an interest. On the surface it looks great.
Top

Posted by Poromenos   Greece  (1,037 posts)  Bio
Date Reply #5 on Thu 25 Nov 2004 10:13 AM (UTC)
Message
By the way, if I reassign Ctrl+Alt+O to nothing, will MC still intercept it and just do nothing, or will it let it pass to the OS? Because I was trying to make a shortcut with a hotkey but the hotkey got captured by MC and did something in it instead of opening the application whose shortcut I had created. It worked when the focus was not on MC.

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #6 on Thu 25 Nov 2004 06:33 PM (UTC)
Message
Quote:

Will you be including a keymapping plugin of somesort?


Not initially, however one would be easy to write (hint). :)

Quote:

With the ability to add/list/edit/delete keymaps?


The script function lets you add and change them. The AcceleratorList lets you list them. At present I don't plan to have deletions. This is supposed to be something you get right and forget.

Quote:

Is it possible to do it in a plugin?


Yes.

Quote:

Its just a script that would get executed everytime the world is opened, right? (and on script reload?)


Yes.

Quote:

Is Accelerator a MC function? (Nevermind, I read the function list)


Yes.

Quote:

Does this trump macros? Or do Macros still work (instead of? or in concert with?)


Once you have added an accelerator it will override macros and built-in mappings (like Ctrl+F to find). If you don't have an accelerator defined then the macro will still work.

Quote:

I guess if its a MC function (first time I read it, I thought it was a LUA function), then its a lot like other clients (tintin) handle their triggers/macros/aliases?


Yes, I suppose.

Quote:

By the way, if I reassign Ctrl+Alt+O to nothing, will MC still intercept it and just do nothing, or will it let it pass to the OS?


At present it will send nothing. It isn't remembering the original assignment (which is a command number, not a string), so it can't replace it. I suppose it could do that, but not today.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


21,162 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.