UseKeymap name:Keymap

Temporarily enable a secondary keymap. The next keypress will be processed according to the specified keymap instead of the normal keymap for the current place. This way, you can create multi-keystroke commands.

For example,

 CreateKeymap CtrlXMap
 Bind CtrlXMap 'C-s' := 'SaveGame'

will create a keymap CtrlXMap in which CtrlS invokes the SaveGame command. You can now bind that keymap to a key:

 Bind ControlScreen 'C-x' := 'UseKeymap CtrlXMap'

Now, the key sequence CtrlX CtrlS will save the game from any control screen.

Only one UseKeymap command can be active at a time. A second command will cancel the first.

This command does not wait for the keystroke to actually occur; it immediately proceeds execution of the script. The secondary keymap is used when PCC is waiting for input next time. As a reminder of the temporarily changed keybindings, a pop-up message will occur after little idle time, or when a key is pressed which is not bound in the keymap. As a quick way out, ESC cancels the secondary keymap, unless ESC is bound in it.

It is recommended that you only bind direct invocations of UseKeymap to keys. In particular, the keymap debugger can then help you to look at these alternate keymaps. Although it is possible to call UseKeymap from subroutines, you should avoid that if you can. In particular, you should not call any complicated user-interface command after UseKeymap; this will not always do what you want.

Since: PCC 1.1.10, PCC2 1.99.22

This is a testing version.
It may be incomplete, and have more bugs (or features) than the public live version at planetscentral.com.