ui

The game's interface: tabs, keys, dialogues, widgets, and the host's dialogs.

Methods
14
Fields
None

Getting one

ui

Methods

MethodReturnsDescription
tabs()TabsThe interface tabs.
pressKey(number)booleanPress and release a key. true means queued.
typeText(string, boolean?)booleanType a string as key presses, sent to whatever has keyboard focus. It does not click a text field or give one focus: a box that takes keys…
dialogue()DialogueThe open dialogue.
widgets()WidgetQueryThe interface registry as a QUERY, narrowed in Rust.
messageDialog(MessageDialogSpec, (() -> ())?)numberA message box: the immediate-mode alternative to JOptionPane.showMessageDialog; in the Swing retained UI, use JOptionPane itself. Non-b…
confirmDialog(ConfirmDialogSpec, (number?, string?) -> ())numberA question with buttons: the immediate-mode alternative to JOptionPane.showConfirmDialog; in the Swing retained UI, use JOptionPane its…
inputDialog(InputDialogSpec, (string?) -> ())numberA text prompt: the immediate-mode alternative to JOptionPane.showInputDialog; in the Swing retained UI, use JOptionPane itself. Drawn o…
colorPicker(ColorPickerSpec, (Color) -> (), ((Color) -> ())?)numberA colour picker: the alternative to ColorPickerManager. Drawn over the game, non-blocking; the callbacks run in the plugin's ticks. With…
fileOpen(FileOpenSpec, (string?, string?) -> ())numberOpen a file: the alternative to JFileChooser#showOpenDialog. The plugin never sees a path. Drawn over the game, non-blocking; the callbac…
fileSave(FileSaveSpec, ((boolean, string?) -> ())?)numberSave a file: the alternative to JFileChooser#showSaveDialog. Drawn over the game, non-blocking; the callback runs in one of the plugin's…
openUrl(string, ((boolean, string?) -> ())?)number?Open an http(s) link in the browser, at once, with no confirmation. A marketplace plugin opens only an https link to oldschool.runescap…
closeDialog(number)booleanClose a dialog this plugin opened. Its callback never runs.
dialogOpen(number)booleanWhether a dialog this plugin opened is still up.

Method details

pressKey

pressKey: (Ui, number) -> boolean

Press and release a key. true means queued.

For an "Enter amount" prompt, ui:dialogue():typeAmount(n) types the amount and Enter, only while the prompt is open.

ui:pressKey(KeyEvent.VK_ESCAPE)
vk
A KeyEvent.VK_* code. Enter is KeyEvent.VK_ENTER, 10.

typeText

typeText: (Ui, string, boolean?) -> boolean

Type a string as key presses, sent to whatever has keyboard focus. It does not click a text field or give one focus: a box that takes keys only once it is clicked gets nothing until it is. true means queued, not typed: nothing checks where the keys landed.

text
What to type.
pressEnter
Whether to follow it with Enter. Defaults to false.

widgets

widgets: (Ui) -> WidgetQuery

The interface registry as a QUERY, narrowed in Rust.

Filters run in Rust before anything crosses into Luau; the terminals hand out Widget handles.

messageDialog

messageDialog: (Ui, MessageDialogSpec, (() -> ())?) -> number

A message box: the immediate-mode alternative to JOptionPane.showMessageDialog; in the Swing retained UI, use JOptionPane itself. Non-blocking: it returns at once. Drawn over the game, naming the plugin that opened it; the callback runs in one of the plugin's ticks after the user answers. With eight open, the ninth raises.

spec
What it shows.
onClose
Runs once the user dismisses it.
Returns
The dialog's id.

confirmDialog

confirmDialog: (Ui, ConfirmDialogSpec, (number?, string?) -> ()) -> number

A question with buttons: the immediate-mode alternative to JOptionPane.showConfirmDialog; in the Swing retained UI, use JOptionPane itself. Drawn over the game, non-blocking; the callback runs in one of the plugin's ticks after the user answers. With eight open, the ninth raises.

spec
What it shows.
onResult
Gets the 1-based option and its label, or nil when the window was closed.

inputDialog

inputDialog: (Ui, InputDialogSpec, (string?) -> ()) -> number

A text prompt: the immediate-mode alternative to JOptionPane.showInputDialog; in the Swing retained UI, use JOptionPane itself. Drawn over the game, non-blocking; the callback runs in one of the plugin's ticks after the user answers. With eight open, the ninth raises.

spec
What it shows.
onResult
Gets the text, or nil on cancel.

colorPicker

colorPicker: (Ui, ColorPickerSpec, (Color) -> (), ((Color) -> ())?) -> number

A colour picker: the alternative to ColorPickerManager. Drawn over the game, non-blocking; the callbacks run in the plugin's ticks. With eight open, the ninth raises.

spec
What it starts on.
onClose
Gets the final colour.
onChange
Gets the colour as it changes.

fileOpen

fileOpen: (Ui, FileOpenSpec, (string?, string?) -> ()) -> number

Open a file: the alternative to JFileChooser#showOpenDialog. The plugin never sees a path. Drawn over the game, non-blocking; the callback runs in one of the plugin's ticks after the user answers. With eight open, the ninth raises.

spec
What it offers.
onResult
Gets the bytes and base name, or nil on cancel.

fileSave

fileSave: (Ui, FileSaveSpec, ((boolean, string?) -> ())?) -> number

Save a file: the alternative to JFileChooser#showSaveDialog. Drawn over the game, non-blocking; the callback runs in one of the plugin's ticks after the user answers. With eight open, the ninth raises.

spec
What it saves.
onResult
Gets whether it was written, and why not.

openUrl

openUrl: (Ui, string, ((boolean, string?) -> ())?) -> number?

Open an http(s) link in the browser, at once, with no confirmation. A marketplace plugin opens only an https link to oldschool.runescape.wiki, runescape.wiki or runescape.com (or a subdomain of one). Any other link raises.

onDone
Gets whether the browser was asked to open it, and why not.
Returns
The dialog's id with onDone, through which the answer comes; else nil.

closeDialog

closeDialog: (Ui, number) -> boolean

Close a dialog this plugin opened. Its callback never runs.

Returns
Whether there was one to close.

dialogOpen

dialogOpen: (Ui, number) -> boolean

Whether a dialog this plugin opened is still up.