Menu
menu {element} [parameters...]Also searchable as: Menu · gui · window · dialog · form
menu builds a small window of your own, the menu window, with text, buttons, edit fields, check boxes,
lists and images. The script shows it, reacts to clicks, and reads what the user typed or chose.
menu Clearmenu Window Title Loot settingsmenu Window Size 220 110menu Text lbl 10 12 Minimum gold:menu Edit gold 110 10 90 100menu Check bags 10 40 200 20 #true Also open bagsmenu Button ok 70 75 80 25 Startmenu Showset #MenuButton N/Awhile #MenuButton = N/A wait 1menu GetNum gold 100set %mingold #MenuResmenu Get bagsset %openbags #MenuResmenu Hidedisplay ok Minimum gold %mingold open bags %openbagshaltHow it works
Section titled “How it works”- Every control has a name, chosen when you create it. Names are not case-sensitive. Use a different name
for each control:
menu Getreads only the first one with a name. - Clicks put the button’s name in
#MenuButton. Closing the window, with its × or withmenu Hide, putsCLOSEDthere. - Values are read with
menu Getandmenu GetNuminto#MenuRes, and changed withmenu Set. - Positions and sizes are in pixels, from the top-left corner of the window’s inside.
- The window stays open when the script stops. Start a script with
menu Clearso it doesn’t add to an old menu.
menu Font … commands set the font, size, colours, style and alignment of the
controls created after them; controls that already exist keep theirs. menu Clear
puts every font setting back to its default: Arial 10, black on the standard button colour, left-aligned,
plain, not transparent.
Colours
Section titled “Colours”Wherever a colour is asked for, give either:
- a name:
black,white,red,green,blue,yellow,navy,gray,silver, … or a system colour such asbtnfaceorwindowtext; - a number in Windows’ order,
$BBGGRR: blue first, red last.$0000FFis red,$FF0000is blue. A web colour#0099FFbecomes$FF9900.
Building big menus quickly
Section titled “Building big menus quickly”A script runs #LPC lines (10 by default) and then pauses 50 ms, so a menu with a
hundred controls takes about half a second to appear. Put set #LPC 1000 before building it.
Commands
Section titled “Commands”| Window | |
|---|---|
| menu Show / menu Hide | Shows or hides the menu window. |
| menu HideEUO | Minimises EasyUO, leaving only the menu window. |
| menu Window Size, Title, Color, Transparent | The window’s size, title, colour and opacity. |
| menu Clear / menu Delete | Removes all controls, or one. |
| Controls | |
|---|---|
| menu Text | A label. |
| menu Button | A button. |
| menu Edit / menu Memo | A one-line / multi-line text field. |
| menu Check | A check box. |
| menu Combo / menu List | A drop-down list / a list box. |
| menu Shape | A rectangle, circle or other shape. |
| menu Image Create | An image to draw in or load a picture into: see the other menu Image commands. |
| Reading and changing | |
|---|---|
| menu Get / menu GetNum | Reads a control’s value into #MenuRes. |
| menu Set | Changes a control’s text or state. |
| menu Activate | Gives a control the keyboard focus. |
| EasyUO 1.6 only | |
|---|---|
| menu Form | Another window. |
| menu Panel | An area that holds controls. |
| menu Radio | A radio button. |
| menu GetProp / menu SetProp | Reads or changes any property of a control or window. |
| menu GetDef / menu SetDef | Reads or changes what new controls are created with, and where they go. |
| menu PushDef / menu PopDef | Saves and brings back those defaults. |
| Reforged settings | |
|---|---|
| menu Reforge Mode | Chooses the 1.5 or the 1.6 MENU system for the script. |
| menu Reforge IncludeCall | Makes the automatic choice read called files too. |
1.5 and 1.6
Section titled “1.5 and 1.6”What this page describes holds for both MENU systems, except where it speaks of names, CLOSED and the
start of a script, which follow the 1.5 rules. In the 1.6 logic a name belongs to one control, a click gives
the button’s name in lower case, menu Hide does not set CLOSED, and starting a
script destroys every menu window and creates a new, hidden one. The details, and a table of which
sub-command each system has, are on MENU: EasyUO 1.5 and 1.6.
See also
Based on the EasyUO wiki, edited for EasyUO Reforged. This text is available under the GNU Free Documentation License 1.2.
The EasyUO 1.6 behaviour on this page was researched with help from the ScriptUO community: Gaderian's tutorial New Menu Code and how to adapt old scripts and the scripts its members share at scriptuo.com.