Mojo

Buttons and Panels

Create clickable buttons with Mojo for Dark Age of Camelot (DAOC).

Mojo lets you trigger hotkeys with the mouse instead of the keyboard. You do this by making one or more panels of buttons. When you click a button, a hotkey fires.

Here’s an extremely simple example. Put this in a hotkey script:

Panel
{
  Button
  {
    DoHotkey ( F1 )
  }
}

Hotkey ( F1 )
{
  Slash ( "/say Hello world!" )
}

When you load that script, Mojo puts this panel with a single hotkey on your screen:

Every time you click that button, hotkey F1 fires, assuming you’ve defined a Hotkey(F1) in your script. I wrote both the panel and hotkey in the example above. They don't have to be near each other in the script or in any particular order.

Hotkeys and scripts are explained in the multiboxing section of this website, but you don’t need to be a multiboxer to use them.

The panel in the picture above doesn’t look like much, does it? That’s because I showed you the simplest possible example so you’d see how easy this can be.

Mojo gives you complete control over the number of panels, number of buttons, shapes of buttons, shapes of panels, colors, sizes, pictures on buttons, text on buttons, quantities of rows, quantities of columns, etc.

To hide panels or make them visible again, put TogglePanels in a hotkey.

Here are some more examples to give you an idea of what you can do:

Keywords Used in Panels

The only required keywords are Panel, Button, and DoHotkey, as shown in the first example above. Everything else is optional. When you write a script, always start with something as simple as possible, get it working, and then add complexity one step at a time.

And always remember: if something doesn’t work, look for red error messages on Geeky Stuff. Error messages are your friends! Don’t be afraid of them – read them! They tell you what’s wrong and how to fix it.

Panel. Used in a script to create a group of buttons.

Button. Used inside a panel to create a button. A panel can have as many buttons as you like.

ButtonSize. Optional. Specifies the size of each button inside the panel. In any given panel, all the buttons have the same size. If you omit this, Mojo uses a default size of 70 x 50 pixels.

Position. Optional. Specifies the place on the screen where Mojo puts the panel when you load the script which creates it. If you omit this, Mojo puts the panel in the center of the screen. You can drag panels to new positions after they first appear.

QtyColumns. Optional. Specifies the number of columns. Use this if you want the buttons in a panel to be ordered from top to bottom. Mojo will figure out the number of rows automatically. You can specify either QtyColumns or QuantityRows but not both. If you omit both, Mojo defaults to one column.

QtyRows. Optional. Specifies the number of rows. Use this if you want the buttons in a panel to be ordered from left to right. Mojo will figure out the number of columns automatically. You can specify either QtyColumns or QuantityRows but not both. If you omit both, Mojo defaults to one column.

Label. Optional. The name of the panel. If you specify this. Mojo adds a title bar to the top of the panel to contain the label. If you omit this, Mojo displays a narrow blank strip instead of a title bar so you can drag the panel with the mouse. Label can also be used inside buttons.

BackgroundColor. Optional. Use this in a panel to set the color of all the buttons. If you omit this, Mojo defaults to light gray. Write the color as a six-digit hex number prefixed with #. For example, #FFFFFF is white and #990000 is dull red. You can also use this keyword inside buttons to set their color individually and override the panel setting. If you specify a Picture or Tile, the background color is not used.

TextColor. Optional. Use this in a panel to set the test color of all the buttons. If you omit this, Mojo defaults to black. Write the color as a six-digit hex number prefixed with #. For example, #FFFFFF is white and #990000 is dull red. You can also use this keyword inside buttons to set their label colors individually and override the panel setting. If you specify a Picture or Tile, the text color is not used.

FontWeight. Optional. Use this in a panel to set the font weight of all buttons in the panel. Can be 'bold' or 'regular'. If you omit this, Mojo defaults to regular. You can also use this keyword inside buttons to set their font weight individually and override the panel setting.

Resizable. Optional. To make the panel resizable, specify "yes" or "true". Resizable means you can make the panel larger or smaller by dragging the edges or corners with the mouse. If you omit this, the panel is not resizable.

Keywords Used in Buttons

DoHotkey. Specifies the trigger (key combination) of the hotkey that fires when this button is clicked.

Picture. Optional. Displays a picture on the button instead of text. Specify the path of an image file (gif, bmp, jpg, tiff, or png). Mojo takes the entire picture from the file and, if necessary, stretches or shrinks it to fit the button. If you want to display a piece of the image instead of the whole thing, use Tile instead of Picture. If you specify a Picture, no text is shown on the button.

Tile. Optional. Displays a picture on the button instead of text. The difference between this keyword and Picture is that Picture displays the entire image file on the button, but Tile displays a section (a tile) of the image file. This is useful if you want to make buttons with the game’s icons. See Panel Example 4 for instructions. If you specify a Tile, no text is shown on the button.

Label. Optional. Use Label to specify the text. If you omit Picture, Tile, and Label, Mojo shows the hotkey trigger (key combination) by default. If you specify a Picture or Tile, the label is not shown.

BackgroundColor. Optional. Use this in a button to set its color. This overrides the BackgroundColor set by the Panel. Write the color as a six-digit hex number prefixed with #. For example, #FFFFFF is white and #990000 is dull red. If you specify a Picture or Tile, the background color is not used.

TextColor. Optional. Use this in a button to set the color of its text. This overrides the TextColor set by the Panel. Write the color as a six-digit hex number prefixed with #. For example, #FFFFFF is white and #990000 is dull red. If you specify a Picture or Tile, the text color is not used.

FontWeight. Optional. Use this in a button to set the font weight of the label. Can be 'bold' or 'regular'. Overrides the font weight set in the panel. If you specify a Picture or Tile, the font weight is not used.

More pages about buttons and panels

This page was first published on March 4, 2020 and last modified on March 5, 2020

Comments