Using Accelerator

Posted by Lmclarke on Mon 16 Sep 2019 03:36 PM — 3 posts, 14,243 views.

#0
Hey there. I'm attempting to map CTRL+UP to cycle through the command history, doing exactly what just tapping UP does in MUSHclient natively. I'm unable to find if it's possible to do that, however - the information I can locate on Accelerator tend to be command strings like "heal" or "eat food."

Is it possible to do this with Accelerator? If so, may I ask how?

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<muclient>
<plugin
   name="Accelerators"
   author="Nick Gammon"
   id="bcd4c85623b51c11ec643123"
   language="Lua"
   purpose="Add custom keystrokes"
   date_written="2007-04-17 16:16:25"
   requires="3.80"
   version="1.0"
   >
</plugin>
<script>
<![CDATA[
function OnPluginInstall ()

  Accelerator ("ctrl+up", ???)

  -- add more here ...

  -- list them
  for _, v in ipairs (AcceleratorList ()) do Note (v) end

end -- function OnPluginInstall
]]>
</script>
</muclient>
Amended on Mon 16 Sep 2019 03:38 PM by Lmclarke
Australia Forum Administrator #1
See:

Template:function=AcceleratorTo
AcceleratorTo

The documentation for the AcceleratorTo script function is available online. It is also in the MUSHclient help file.



Template:function=DoCommand
DoCommand

The documentation for the DoCommand script function is available online. It is also in the MUSHclient help file.



So your accelerator line should look like this:


AcceleratorTo ("Ctrl+Up", 'DoCommand ("PreviousCommand")', sendto.script)


That maps Ctrl+Up to "do" the command "PreviousCommand" which is the message that maps the menu item Input -> Previous Command to the command handler for that.
#2
Ah, thank you! Much appreciated.