Difference between revisions of "Button (MenuMate)"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Speedo
(created)
 
imported>Speedo
(finished)
Line 1: Line 1:
{{Unfinished}}
A component of [[:Category:MenuMate|MenuMate]].
__NOTOC__


A component of [[:Category:MenuMate|MenuMate]].
Buttons provide the core functionality to a menu.  They must be contained within a dialog element.


Buttons provide the core functionality to a menu.  They must be contained within a
__TOC__


==button==
==button==
Line 29: Line 28:
</button>
</button>
</pre>
</pre>
==exitbutton==
A button which closes the active menu.  Is completely identical to a plain button aside from its name.


==togglebutton==
==togglebutton==
A button which toggles a variable between true (1) and false (0).
A button which toggles a variable between true (1) and false (0). Uses text and may use a script as described for [[Button_(MenuMate)#button|button]].  Optionally, you may modify the format string based on the state of the button.  Include the text '''[STATE]''' in the format string - it will automatically be replaced with text you specify (see below).
 
===Makeup===
The togglebutton takes additional information as attributes of its main element:
*'''targetvar''' - The name of the variable which will be modified by this button.
*'''truetext''' - The text which will replace '''[STATE]''' in the format string if the button's variable is currently 1.  Optional, defaults to "true".
*'''falsetext''' - Text which replaces '''[STATE]''' in the format string if the button's variable is currently 0.  Optional, defaults to "false".
 
===Example===
<pre>
<togglebutton targetvar="myDebugVar" truetext="On" falsetext="Off">
  <text format="Show Debug Information: [STATE]"/>
</togglebutton>
</pre>
 
==counterbutton==
A button which modifies a variable by a certain amount when clicked.  Uses text and may use a script as described for [[Button_(MenuMate)#button|button]].  As with togglebutton, you may include '''[STATE]''' in the format string - it will be replaced with the value of the target variable.
 
===Makeup===
The counterbutton takes additional information as attributes of its main element:
*'''targetvar''' - The name of the variable to be modified by the button.
*'''amount''' - The amount by which the target variable will be modified on each click.
*'''minvar''' - The name of a variable holding a minimum allowed value for the target variable.  Optional.
*'''maxvar''' - The name of a varaible holding a maximum allowed value for the target variable.  Optional.
 
===Example===
 
<pre>
<counterbutton targetvar="myVariable" amount="10" minvar="minimumValue" maxvar="maximumValue">
  <text format="Click to increase myVariable by 10"/>
</counterbutton
</pre>
 
==linkbutton==
A button which display another dialog from within the active menu.  Uses text and may use a script as described for [[Button_(MenuMate)#button|button]].
 
===Makeup===
The linkbutton takes one additional attribute on its main element:
*'''target''' - The now of the dialog to be displayed when this button is pressed.  Must match that dialog's definition in the [[Menu_(MenuMate)|menu]] element.
 
===Example===
<pre>
<linkbutton target="mainmenu">
  <text format="Go to main menu"/>
</linkbutton>
</pre>


[[Category:MenuMate]]
[[Category:MenuMate]]

Revision as of 20:47, 29 November 2008

A component of MenuMate.

Buttons provide the core functionality to a menu. They must be contained within a dialog element.

button

A plain button. Its only functionality is via its result script. All other types of buttons use the same formatting for text and script as the basic button.

Makeup

Text

To define the text of a button, use a text element. These are identical to the text elements used in a dialog.

Script

A result script that will be run when the button is clicked. The scripts contained within these face the same limitations as the console and scripts used by RunBatchScript.

IMPORTANT: Due to XML limitations, you must manually insert a newline character after each line of a multiple line script using the unicode code point &#10;.

Example

<button>
  <text format="Hello world!"/>

  <script>
    Message "Hello world!" &#10;
    PrintC "Hello world!"
  </script>
</button>

exitbutton

A button which closes the active menu. Is completely identical to a plain button aside from its name.

togglebutton

A button which toggles a variable between true (1) and false (0). Uses text and may use a script as described for button. Optionally, you may modify the format string based on the state of the button. Include the text [STATE] in the format string - it will automatically be replaced with text you specify (see below).

Makeup

The togglebutton takes additional information as attributes of its main element:

  • targetvar - The name of the variable which will be modified by this button.
  • truetext - The text which will replace [STATE] in the format string if the button's variable is currently 1. Optional, defaults to "true".
  • falsetext - Text which replaces [STATE] in the format string if the button's variable is currently 0. Optional, defaults to "false".

Example

<togglebutton targetvar="myDebugVar" truetext="On" falsetext="Off">
  <text format="Show Debug Information: [STATE]"/>
</togglebutton>

counterbutton

A button which modifies a variable by a certain amount when clicked. Uses text and may use a script as described for button. As with togglebutton, you may include [STATE] in the format string - it will be replaced with the value of the target variable.

Makeup

The counterbutton takes additional information as attributes of its main element:

  • targetvar - The name of the variable to be modified by the button.
  • amount - The amount by which the target variable will be modified on each click.
  • minvar - The name of a variable holding a minimum allowed value for the target variable. Optional.
  • maxvar - The name of a varaible holding a maximum allowed value for the target variable. Optional.

Example

<counterbutton targetvar="myVariable" amount="10" minvar="minimumValue" maxvar="maximumValue">
  <text format="Click to increase myVariable by 10"/>
</counterbutton

linkbutton

A button which display another dialog from within the active menu. Uses text and may use a script as described for button.

Makeup

The linkbutton takes one additional attribute on its main element:

  • target - The now of the dialog to be displayed when this button is pressed. Must match that dialog's definition in the menu element.

Example

<linkbutton target="mainmenu">
  <text format="Go to main menu"/>
</linkbutton>