Introduction to Buttons

Combining the concepts of aliases, triggers, and variables are Buttons. Buttons not only make it easier for novice users to use these features, but provides significant functionality to power users that is not found in text-based clients such as TINTIN. Buttons can be clicked to execute a command, their caption can display the value of a variable, and they can act as a toggle to turn a feature (like triggers) on and off easily.


To define a button, right click on the button you wish to edit, or select Make Button from the Action menu. There are several types of buttons including: push buttons and toggle buttons. A push button is clicked to execute a command and releases as soon as you release the mouse. A toggle button changes between being off (up) or on (down). The type of button is controlled by the Variable field. If you assign the name of a variable to this field, the button will be a toggle button, and the variable will contain the state of the button (0 for up/off, 1 for down/on). A Multistate button can have multiple captions and commands, and looks like a pull-down menu button. A menu button is similar to a multistate button, but simply points to a special menu class where the menu commands are defined, rather than defining the multiple commands within the button itself.

In the Off Caption, enter the text you wish to display on the face of the button when the button is in its normal, off position. The next field is for the caption to be displayed when the button is pressed in, or on (this field is grayed out if the button is not a toggle button). If you leave the On Caption blank, it will use the same value as the Off Caption. You should limit captions to about 10 characters so that they fit on the button face. The value of the caption fields are evaluated, so you can put an expression containing variables and the result will be displayed on the button.

We'll skip the Value field for a moment, and move to the On Command field. Enter the command you wish to execute when the button is pressed (from Off state to On state). In the Off Command field, enter the command you wish to execute when then button is released (from On state to Off state).

The Value field is used to externally control the state of the button. You can do this with just the variable (e.g. if you assign 1 to the variable in the Variable field, the button will activate itself, if you assign 0 to this variable the button will deactivate itself). However, the Value field allows greater control as to whether the button is pressed or not. If the expression in the Value field is true, the button is in the On state (pressed). If the expression in the Value field is false, the button is in the Off state (released).

So, how about an example? In the Introduction to Triggers we created an autosplit trigger. We can make this trigger much more user friendly by using it with a button. Select Make Button from the Action menu. In the Off Caption field, enter the text AutoSplit. In the On Command field enter emote is auto-splitting;#t+ autosplit. In the Off Command field enter emote stops auto-splitting;#t- autosplit. In the Variable field, enter autosplit. Click OK to save the button definition. Now you have a button labeled AutoSplit, and it is currently off. Click the button. The command emote is auto-splitting is sent to the MUD (telling your group members what you are doing), and the autosplit trigger is enabled. The semi-colon (or Separator character) allows you to specify more than one command on the same line. Note that the button now appears in the On state (is pressed in). This gives you the visual clue that your AutoSplit function is enabled so that you don't forget. Click the button again. The text emote stops autosplitting is sent to the MUD, and the autosplit trigger is disabled. The button now appears in the Off position. Now you don't have to waste two keys on the keyboard to turn your autosplit trigger on and off, and in addition you have a nice visual clue as to whether your trigger is active or not. Try to beat this in a text-based MUD client!

Advanced Settings

In the advanced settings tab you can control many attributes of your buttons. You can set the color of the button, change the size or location, and assign a graphic (BMP file format) to the button. There are over 100 predefined images built into zMUD that you can access by clicking the down-arrow button on the right-side of the bitmap field. Buttons can have their icon to the left of the caption, or on top of the caption. Buttons can also be displayed using "Explorer" style which means they don't normally display a bevel around the edge of the button until the user moves the mouse over the button. This allows you to create button bars that can be very complex.

You can also assign a variable name to a button to keep track of the button state. A button that is off has a value of zero, and a button that is pushed in has a value of one. In addition to setting the value of the variable to the current button state, you can control the button by setting this variable in a script. For example, if you have the variable named "State" assigned to the button, and then do "state=1" the button will get pushed in.

The Value field is similar to the Variable field, but specifies a full expression used to determine the state of the button. For example, the expression "@Name = "Zugg"" can be used. The button will be pressed in whenever the variable @Name has the value of "Zugg". Clicking the button will have no effect...the button is now controlled by this expression value.

Multi-State Buttons

In addition to toggle buttons and push buttons, you can create "multi-state" buttons. These buttons have a menu associated with them. When you click on the button, the menu appears and you can select an item from the menu. Each item in the menu can correspond to a command, a new caption for the button, and/or a new color for the button.

In the Create Button dialog, select the Multi-state button radio option, and then enter the number of states (menu items) you want your button to have. In addition to the different menu items, the button has a main caption state which specifies the default caption, command, and color for the button. Select the state you wish to change in the pulldown box, and then enter the caption for this state, along with the command you want to execute.

Multi-state buttons can also set variables just like toggle buttons. The default state has a value of zero, with the selectable menu items starting with a value of one.

Instead of defining the states and commands of a button directly, you can point to an existing menu class. Simply select the Menu button type, and enter the name of the menu class into the Command Script field for the button. Using this method, you can share common menu definitions between buttons and popup menus. See the Menus topic for more details.

Contents Introduction to Triggers Introduction to Multiplaying