Command bindings

GgrTF's core provides few macros for defining "bindings", which are a way to create commands that look like normal MUD commands but are actually intercepted by TinyFugue and executed appropriately. These bindings can be used to easily define shorthands for casting spells, using skills, executing macros, etc. GgrTF bindings offer an easy way to define skill/spell commands with automatic party reporting (or without it). Simply put, bindings are similar to BatMUD "command" aliases, but client-side and with extra abilities (but also with some limitations.)

In GgrTF, there are optional pre-defined bindings, which can be enabled at your consideration. These pre-defined bindings are defined in the relevant modules, and can be enabled at load-time with a setting ("opt_bindings"). See below section for enabling bindings.

Now, you might be asking why would anyone need bindings? Indeed, you can already use BatMUD's command aliases for such things, but the number of command aliases in BatMUD is limited and if you run out of space, you have to remove some less used ones. Sometimes you have to redefine lots just because you are reincarnating... and you can not execute macros with command aliases.

There are many benefits to using bindings, but they do have some drawbacks:

Defining bindings

Now we know the limitations of this system - let's see how to define some basic command bindings!

/prdefgbind -s"cere"    -c"/ceremony" -n
/prdefcbind -s"nf"      -c"Neutralize Field" -n
/prdefsbind -s"fire"    -c"Fire Building" -n

Above we have have listed all three (3) classes of binding defination macros supported by GgrTF. First defines a generic command binding to execute "/ceremony" macro when user commands "cere". Second binding defines a spell casting command to cast "Neutralize Field" when user commands "nf". And the third binding defines a skill usage command to use "Fire Building". So basically we have three types of bindings:

  • /prdefgbind: Defines a generic binding, in which the action ("-c" parameter) can be almost anything, like a TF macro, or BatMUD command.

  • /prdefcbind: Defines a casting binding, the action is the name of the spell to be casted.

  • /prdefsbind: Defines a skill usage binding, action argument being name of the skill to be executed.

Each of these defination macros require at least two arguments: the name for the binding command ("-s" option) and the action ("-c" option). There are other optional arguments, which affect aspects of the command binding to be defined. The argument options and their meanings are listed below:

Table 4.5. Arguments common to all binding defination macros

Option Description
-s"name" Specifies the name of the command binding. This is basically the string you type to use the command, after which come the optional arguments.
-n Tells GgrTF that the binding does NOT accept arguments. Anything following the command binding invocation is ignored. This also affects the possible reporting output of the binding.

Table 4.6. Arguments specific to generic bindings (/prdefgbind)

Option Description
-c"action" Specifies the action, aka what the binding does. For generic bindings, the action is a literal, so it can be a TF macro or BatMUD command.

Table 4.7. Arguments specific to spell casting and skill usage bindings (/prdefcbind and /prdefsbind)

Option Description
-c"action" Specifies name of the spell to be cast or skill to be used.
-d"message" This option overrides the default message string used for reporting (see also option "-q" below).
-q Makes the binding "quiet", suppresses any reporting. By default, spell casting binding reports the action on party report-channel, but specifying this option disables it.

More examples, now with short explanations:

Table 4.8. Binding defination examples

Definition Description
/prdefgbind -s"repu" -c"/showrep" -n Generic binding, which executes /showrep macro and takes no arguments.
/prdefsbind -s"er" -c"Enrage" -n Skill binding for barbarian "Enrage" skill. Also takes no arguments.
/prdefcbind -s"shelter" -c"Shelter" -n -d"Sheltering ..." Spell casting binding, for casting conjurer spell "Shelter". Takes no arguments and uses specific reporting string (default would be "Shelter ...", but since it sounds bit stupid we want to use "Sheltering ..." instead.)
/prdefcbind -s"dmp" -c"Dispel Magical Protection" Another spell casting binding for a conjurer spell, which takes (and requires) a player's name as argument.
/prdefcbind -s"sl" -c"Star Light" -q Yet another spell casting bind, this time for druid spell "Star Light". Since this is a blasting spell, it is not really useful to report that we are casting it, so we suppress any reporting. Argument is accepted.

As of now, you should be able to define bindings of your own. You can define them in your .tfrc or make another file for them.

Enabling bindings

A special variable called "opt_bindings" controls whether the various /prdef*bind macros will actually define any binding at all. If this variable is set to value "on", bindings will be defined, otherwise not.

This is also the way how pre-defined GgrTF bindings are made optional. By defining "opt_bindings" before loading GgrTF modules, user can choose to enable or disable the default bindings, even "per-module" by changing the value of opt_bindings before each module loading in .tfrc.

It should be noted, that "opt_bindings" is a saveable setting, that gets stored by /gsave and restored by ggrtf-pre.tf Please refer to setup- and state saving- sections for more information.

Bindings listing

All defined GgrTF bindings can be listed via the /binds command. Below is represented an commented example of such output.

,----------------.
| GgrTF Bindings |
+----------------+----------------------------------------------------.
| pprots         | G | /pprots                                  |   ? |
| rpouch         | G | /rpouch                                  |   ? |
| ad             | C | Aura Detection                           | Yes |
| invis          | C | Invisibility                             | Yes |
| float          | C | Floating                                 | Yes |
| ww             | C | Water Walking                            | Yes |
| seeinvis       | C | See Invisible                            | Yes |
| seemagic       | C | See Magic                                | Yes |
| cere           | G | /ceremony                                |   ? |
| curses         | G | /curses                                  |   ? |
| prots          | G | /prots                                   |   ? |
`---------------------------------------------------------------------'
  • 1st column lists the binded command name

  • 2nd column shows the type of the binding: "G" = general (for example a macro invocation); "C" = cast/spell; "K" = skill.

  • 3rd column is the performed action, which has varying meaning depending on the binding type. For skill and spell bindings, corresponding skill/spell name is shown. Generic bindings show the actual command executed.

  • 4th and last column shows whether the binding produces any report output; for generic bindings this is not applicable and shows question mark ("?") instead.