whichDialog dialog

Target dialog to add the button to.

buttonText string

Custom text.

hotkey integer

Integer value of the ASCII upper-case character for the hotkey. Example: "F" = 70.


Creates a menu button and returns a handle to it.

You must save the button handle to later compare it to the selected button in a EVENT_DIALOG_BUTTON_CLICK using GetClickedButton and GetClickedDialog.

New buttons are added to the bottom of the menu.


If the menu is already open, you must refresh the menu with DialogDisplay to show new buttons.


Line-width: With the default font (v1.32.10) there's just enough space to display Yo dawg I put this text in here. or 19 full-width characters like "@" (at character). If longer, the text becomes multi-line, up to 3 lines max. If longer than 3 full lines, the rest of string is not shown.


Hotkey (uppercase): When adding a hotkey use the uppercase, e.g. 'F' instead of 'f' as it does not work with lowercased keys. The button still gets triggered when the player presses a lowercased letter.


Duplicated hotkeys: When multiple buttons have the same hotkey, the last button has priority.


Hotkeys are layout-dependent.

In other words, the English QWERTY, the German QWERTZ and the French AZERTY layouts etc. will have some keyboard keys on different physical buttons, based on user's currently enabled layout.

The Russian keyboard layout adheres to QWERTY (as an example of a non-latin layout).


Hotkeys like "@" (ASCII 64) don't work (or maybe they have a different integer value). On a QWERTY layout you need to press SHIFT+2 to enter "@".


You can add up to 12 working buttons.


The 13th button will still render correctly, but not work when clicked/hotkey is used. The 14th button will render outside the dialog border background. The 15th button will render outside the visible area (you'll see a few pixels of it at the bottom).



return type
Source code
native DialogAddButton              takes dialog whichDialog, string buttonText, integer hotkey returns button