Make F2 into a "get help on this function" key

Posted by Nick Gammon on Sat 14 Oct 2006 11:49 PM — 1 posts, 5,507 views.

Australia Forum Administrator #0
Quite often when I am scripting I want to look up the exact usage of a script function, but can't remember the accelerator key which does the Help -> Functions List operation (Ctrl+Shift+Alt+L).

If you are not using another, simpler, key (like F2) for anything else, you can easily configure that to do the same thing.

Simply go into World configuration -> Input -> Macros, find F2 in the list, and enter this as the action:


/DoCommand "FunctionList"


This assumes that you have scripting turned on, and VBscript or Lua as the script language, and that the scripting prefix is a "/" character.

Now all you have to do is position the cursor over a word in the command window (like Note) and hit F2. Then the help window for all functions that match that word will appear.

An alternative way of doing it, which doesn't rely upon the "/" technique, is to make an alias, and call that from the macro. Here is an example:


<aliases>
  <alias
   match="invokefunctionhelp"
   enabled="y"
   omit_from_command_history="y"
   omit_from_log="y"
   send_to="12"
   omit_from_output="y"
   sequence="100"
  >
  <send>DoCommand "FunctionList"</send>
  </alias>
</aliases>


The alias is "invokefunctionhelp" which is hopefully something you don't normally type. It does a "send to script" of: DoCommand "FunctionList"

Now you just have to configure the F2 macro to send "invokefunctionhelp".