Skip to content

rq.uikit ​

since 1.7.0 changed 2.12.0 changed 2.13.0

Widgets in the look of the game's Config screen and, since 2.6.0, of its hub.

They are drawn with rq.hud from the game's own pictures: Config draws its labels into its pictures, so the kit cuts out the parts that carry no text and writes its own text on them. The kit is Lua on the public rq.hud calls. The hub's widgets write in the game's own font: grey buttons in four sizes, Rance Castle's room rows, quest rows and the quest list, the town tabs, Frostbuy's rack tiles, the sort column, the game's scroll bar and close button, a page that covers the hub, and (2.7.0) the choice menu's look. They take their pieces from the theme in use, else from themes.hub.

It works in immediate mode: call the widgets from rq.on_frame on every update they show, keep the values yourself, and pass them back in. Each widget returns the new value and whether it changed on this update. While the mouse is over a widget the game sees no mouse. Hover and click play the game's own sounds (1001 and 1002). The widgets are listed for rqmod-ctl ui in the section "kit".

The keys (2.12.0): the arrow keys move one cursor between the widgets that take a click, and Enter clicks the one under it, as the game's own screens do. The mouse and the keys share it: moving the mouse over a widget puts the cursor there, and an arrow then goes on from it; the mouse is never moved. An arrow goes to the nearest widget that way, one whose center is past the edge of the cursor's widget (the gap along the arrow plus twice the offset across it); with none, it wraps to the widget the other way that lines up best, the farthest of those, as a row of tabs wraps. With no cursor, Down and Right go to the first widget drawn, Up and Left to the last. A widget's nav changes where its arrows go. In a list (list, quest_list, options, item_list) Up and Down go through its rows, also those scrolled out of sight, and the list scrolls to follow; at the end of a list that does not wrap they go on to the nearest widget outside it. A focused slider moves by Page Up and Page Down. A held key moves again after 250 ms, then every 50 ms, as the game's. The kit takes the keys only on an update where rq.uikit.keys is called: inside page, on Config's Mods tab, and where a mod calls it. Elsewhere its widgets over the game's screens are for the mouse, and the arrows stay the game's.

Tips (2.13.0): every widget that takes a click has tip, the game's comment window (rq.uikit.comment) shown when the mouse or the keys' cursor has stayed on it 500 ms, with the game's sound 5001. Under the mouse it goes at the mouse, as the game's; from the keys, at the widget's right edge (left of it when it does not fit). It goes when the cursor leaves. A disabled widget shows its tip under the mouse too. tabs, choice and sort take tips, one for each entry; list and quest_list rows take tip.

lua
local ui = rq.uikit
local vol, mute = 0.8, false
rq.on_frame(function()
  ui.panel({ x = 12, y = 85, w = 1000, h = 595 })
  ui.col({ x = 62, y = 105, gap = 20 }, function()
    ui.row({ h = 30, align = "center" }, function()
      ui.label("Master", { w = 218 })
      vol = ui.slider(vol, { low = "Low", high = "High", id = "vol" })
      mute = ui.checkbox(mute, "Mute", { x = 640, id = "mute" })
    end)
  end)
end)

Properties ​

NameTypeDescription
themerq.UiThemeThe theme in use.
themes{config: rq.UiTheme , hub: rq.UiTheme }The built-in themes. hub came in 2.6.0.

Functions ​

NameSummary
rq.uikit.labelDraws a line of text, white with a dark edge.
rq.uikit.buttonDraws a Config button with text.
rq.uikit.checkboxDraws a checkbox with its text.
rq.uikit.choiceDraws one of several checkboxes, as the 3D tab's quality.
rq.uikit.sliderDraws the Sound tab's slider.
rq.uikit.stepperDraws a number field: the number in a framed box between - and +, and returns the new number.
rq.uikit.typingReturns the number field or text field typing on this update, by its opts.id, or nil.
rq.uikit.inputDraws a text field: the text in a framed box, and returns the text.
rq.uikit.tabsDraws Config's tabs side by side: normal, hovered and current.
rq.uikit.panelDraws a Config page or the 3D tab's dark block, and runs fn in a column inside it.
rq.uikit.listDraws rows on a dark block that scroll by the wheel.
rq.uikit.menuDraws a menu with levels: lists side by side, where an entry with items opens the next list.
rq.uikit.rowPlaces the widgets called in fn side by side.
rq.uikit.colPlaces the widgets called in fn one under the other.
rq.uikit.spaceLeaves empty space in a row or column.
rq.uikit.lastReturns where the last widget went, as for a tooltip beside it.
rq.uikit.hoveredReturns whether the mouse was over a kit widget on this update so far.
rq.uikit.commentDraws the game's comment window, its tooltip, on this update.
rq.uikit.comment_sizeReturns the size the comment window would have, without drawing it.
rq.uikit.barDraws one of the game's bars, a gauge: its CG cut to value / max of its width, as the game's T_Bar.
rq.uikit.skill_buttonDraws a skill's tile, as the game's status page draws it, and returns whether it was clicked.
rq.uikit.topRuns a function now and draws what it draws on top of every widget, as rq.hud.top does.
rq.uikit.keysLets the kit take the arrow keys, Enter, Page Up and Page Down on this update.
rq.uikit.focusedReturns the widget under the keys' cursor.
rq.uikit.focusPuts the keys' cursor on a widget, as an arrow would, or takes it away.
rq.uikit.stateReturns what the kit keeps for a widget.
rq.uikit.drawDraws a piece of the theme at any size.
rq.uikit.copy_themeReturns a deep copy of a theme, to change and pass to rq.uikit.use.
rq.uikit.useUses a theme from now on, for every mod.
rq.uikit.layersReturns a piece as layers for rq.image.compose, to make a CG of it.
rq.uikit.closeDraws the close button of the hub's windows (24 by 20).
rq.uikit.icon_buttonDraws a picture as a button, as the game's CG buttons.
rq.uikit.castle_rowDraws a room row of Rance Castle: the grey button with the room's name, the face beside it, and the NEW and heart marks.
rq.uikit.quest_rowDraws a quest row: the number, the yellow name, and the clear count in its box on the left.
rq.uikit.quest_listDraws the quest list: rows 34 apart and the game's scroll bar 15 pixels right of them.
rq.uikit.scrollbarDraws the game's scroll bar, up and down: two arrows, the track and the bar.
rq.uikit.rackDraws a Frostbuy rack tile: a dark see-through square in the shop's black and yellow lines, with yellow text.
rq.uikit.sortDraws the sort column: "SORT" over up to 16 buttons, 30 apart, the current one framed in yellow.
rq.uikit.pageDraws a page of a mod's own over the hub and runs fn in a column inside it.
rq.uikit.item_windowDraws the game's Quest Storage window holding item tiles, and returns whether it is still open.
rq.uikit.sectionDraws a heading in the quest panel's look, with an optional box under it.
rq.uikit.balloonDraws text in Frostbuy's speech balloon.
rq.uikit.optionsDraws the game's choice menu as a widget: its green base, grey rows, separators and a text panel at the top, laid out as the game lays out the menu. It is not modal and does not wait: it returns the picked row's id on the update it is clicked. Use it inside a page; rq.ui.choose opens the game's own menu instead.
rq.uikit.item_dataReads an item instance's row data from the game: its name, level line, stats line, icon, rank, kind, lock, price, place, the classes that may equip it, and whether the game lets it go.
rq.uikit.item_refreshMakes item rows and lists read an instance again on their next update.
rq.uikit.item_rowDraws a vault item row, 381 by 128, as the game draws it: the name, the icon with its rank badge, the red level bar, the stats line in the game's yellow and white, the icons of the classes that may equip it, LOCKED, and the row's buttons.
rq.uikit.item_iconDraws an item's tile, as the status page's equip slots draw it, and returns whether it was clicked.
rq.uikit.item_cardDraws the game's item card now, on the top layer, and returns its box.
rq.uikit.item_card_sizeReturns the item card's size, to place it beside a widget as the game's screens do.
rq.uikit.item_listDraws the vault's item list: rows 128 apart and the game's scroll bar beside them.
rq.uikit.item_droppedReturns the row dropped on this update on another list of a drag group (item_list's drag), and the row of the list it was dropped on, for a list whose rows are places (slots).
rq.uikit.item_storageDraws the game's storage screen: the storage's red list on the left and the vault's list right of it (437 pixels apart, as the game places them), each with its scroll bar, the vault's count and the storage's in their boxes, and the vault's filter column and SORT. Drag a row from one list to the other to move the item (rq.item.store).
rq.uikit.numberDraws a number as the game does: the vault's counters (font = "count": the game's font, 20 pixels, bold, white), or one of the game's digit fonts.
rq.uikit.filtersDraws the vault's filter column and returns what is picked: the categories (Special, Weapon, Armor, Item / Other), the classes, and Locked / Unlocked, on the column's grey with its "[FILTERING]" heads; and, while a category with sub-filters is picked, its panel of sub-filters over the list's first row.
rq.uikit.item_filterReturns the items of a list that pass a filter state, tested as the vault tests them (アイテム倉庫_一覧_種類確認, _職業確認, _装備タイプ確認, _LOCKタイプ確認).
rq.uikit.item_sortSorts a list of items in place as the vault sorts it, with the game's own comparers (compItem_*).
rq.uikit.item_sortsLists the vault's sort modes 11 to 28 with the game's names (アイテム倉庫_ソート名), for a menu.
rq.uikit.item_pickerDraws an item picker over the player's items, laid out as the vault: the list with its scroll bar, the filter column 407 pixels right and 154 down, the count of items listed in the column's box, and the store's SORT under the column (405 right and 682 down, as at 943, 682 in the game).
rq.uikit.music_listDraws the switches of the calling mod's music, as rq.music.page does, on a page of its own.

rq.uikit.label ​

lua
rq.uikit.label(text, opts) -> integer, integer, integer, integer

since 1.7.0

Draws a line of text, white with a dark edge.

ParameterTypeDescription
textstringThe text.
opts (optional)rq.UiPlace |{size?: number, color?: integer[], dim?: boolean, align?: string, valign?: string}size (default the theme's, 17), color {r, g, b}, dim for the theme's dim color, align, valign (default "center").
ReturnsTypeDescription
xintegerLeft edge.
yintegerTop edge.
wintegerWidth.
hintegerHeight.

rq.uikit.button ​

lua
rq.uikit.button(text, opts) -> boolean

since 1.7.0 changed 2.6.0

Draws a Config button with text.

The button is at least 150 wide (or the text's width) and 40 high. When hovered, the game's cover pulses over it every 2 seconds. A click counts when the button is let go over the same button it went down on.

With opts.style, or a theme with button_style, it is one of the hub's grey buttons instead: "large" (Rance Castle's rooms, 206x30), "choice" (the choice menu's, 340x27), "choice_tall" (340x60) or "short" (the footer's Vault and Trivia, 98x26). Its size is the style's unless opts.w or h is given, and a long text gets smaller until it fits, as the game's labels do.

Raises an error for a style no theme has.

lua
if rq.uikit.button("Reset", { id = "reset" }) then reset() end
if rq.uikit.button("Open the shop", { style = "large", x = 120, y = 300 }) then open = true end
ParameterTypeDescription
textstringThe text.
opts (optional)rq.UiPlace |{disabled?: boolean, style?: "large"|"choice"|"choice_tall"|"short"|string}Place, disabled to grey it out, and style.
ReturnsTypeDescription
clickedbooleantrue on the update it is clicked.

Changed in 2.6.0: Added opts.style and the theme's button_style.

rq.uikit.checkbox ​

lua
rq.uikit.checkbox(value, text, opts) -> boolean, boolean

since 1.7.0

Draws a checkbox with its text.

The text is 42 pixels right of the box, and the game's yellow bar covers the row when hovered.

ParameterTypeDescription
valuebooleanWhether it is checked.
text (optional)stringThe text beside it.
opts (optional)rq.UiPlace |{disabled?: boolean}Place (w is the bar's width), and disabled.
ReturnsTypeDescription
valuebooleanThe new value.
changedbooleantrue on the update it was clicked.

rq.uikit.choice ​

lua
rq.uikit.choice(list, index, opts) -> integer|nil, boolean

since 1.7.0

Draws one of several checkboxes, as the 3D tab's quality.

ParameterTypeDescription
liststring[]The texts.
index (optional)integerThe checked one; nil for none.
opts (optional)rq.UiPlace |{dir?: "col"|"row", gap?: integer, disabled?: boolean, tips?: (string| rq.UiTip )[]}dir (default "col"), gap in pixels (default 20), disabled, tips (2.13.0: one for each checkbox).
ReturnsTypeDescription
indexinteger|nilThe checked one.
changedbooleantrue on the update it changed.

rq.uikit.slider ​

lua
rq.uikit.slider(value, opts) -> number, boolean, boolean

since 1.7.0 changed 1.8.0 changed 2.12.0 changed 2.44.0

Draws the Sound tab's slider.

Drag the knob or click the track; the drag goes on while the button is down, also off the track. The wheel over it moves it by step, or by a twentieth, and the game does not get that wheel step. Under the keys' cursor, Page Down raises it and Page Up lowers it by step, or a twentieth (5%), as Config's sliders: on the press, then on every update after 250 ms.

opts.band draws a part of the track lighter, such as a range a mod recommends; it does not limit the value. The third value it returns tells a drag that goes on from a value that is final: a page that acts on the value (a question, a write to a file) can wait for the knob's release.

lua
local v, changed, held = rq.uikit.slider(zoom, { min = 5, max = 250, step = 0.5, band = { 60, 150 } })
if changed and not held then save(v) end -- a wheel step, a click; a drag saves at its release
ParameterTypeDescription
valuenumberThe value.
opts (optional)rq.UiPlace |{min?: number, max?: number, step?: number, low?: string, high?: string, band?: number[], label?: string, disabled?: boolean}w: the track's width (default 200). min (default 0), max (default 1), step, low and high (texts at the ends), band ({from, to}: that part of the track drawn lighter), label (its name in rqmod-ctl ui), disabled.
ReturnsTypeDescription
valuenumberThe new value.
changedbooleantrue on the update it changed.
heldbooleantrue while the knob is dragged: the value may still change. Since 2.44.0.

Changed in 1.8.0: Added opts.label.

Changed in 2.12.0: Page Up and Page Down.

Changed in 2.44.0: opts.band, and a third value, held.

rq.uikit.stepper ​

lua
rq.uikit.stepper(value, opts) -> integer, boolean

since 2.22.0 changed 2.49.0

Draws a number field: the number in a framed box between - and +, and returns the new number.

  • - and + change it by step, by big with Shift held. Held, they repeat: 400 ms after the press, then every 80 ms.
  • The wheel over the field changes it by step, and the game does not get that wheel step.
  • Under the keys' cursor, Page Up raises it and Page Down lowers it by step.
  • MIN and MAX (ends) put it at min or max with one click. h makes the field smaller, as a cart's lines want it (24 in Frostbuy Bulk Buy).
  • Typing. A click on the number, or Enter under the keys' cursor, types into it. The digits are read from the keys, 0 to 9 and the keypad's (with the keypad's minus while min is below 0), not from the system's text input, so rqmod-ctl type and key can type it. Backspace takes the last digit. Enter keeps the number, put inside min and max; so does a click elsewhere or the keys' cursor moving on. Esc puts the old number back. While it types, these keys are hidden from the game, and Enter, Esc and Backspace stay hidden until let go: Esc there does not close Config or rq.uikit.page.

A typed number counts as one change, when it is kept. The field is listed for rqmod-ctl ui as stepper-<id> with the number as value and selected true while it types; its buttons are button-<id>-dec and button-<id>-inc, and button-<id>-min and button-<id>-max with ends.

Raises an error for a value, min, max, step or big that is not a whole number, a max below min, a step or big below 1, a w that is not a whole number, an h that is not a whole number from 18 to 30, or another ends.

lua
rq.config.page{
  id = "my-mod",
  title = "My Mod",
  draw = function(ui)
    local n, changed = ui.stepper(count, { id = "count", label = "Count", min = 1, max = 99 })
    if changed then
      count = n
      rq.store.global.set("count", n)
    end
  end,
}

-- A cart's line: small, with MAX.
line.n = rq.uikit.stepper(line.n, { id = "n-" .. line.no, x = 82, y = 262, h = 24, ends = "max", max = 99 })
ParameterTypeDescription
valueintegerThe number shown; it is put inside min and max.
opts (optional)rq.UiStepperOptsmin, max, step, big, label, disabled, h, ends; place (w: the box's width, default to fit max), id, tip, nav.
ReturnsTypeDescription
valueintegerThe new number.
changedbooleantrue on the update it changed.

Changed in 2.49.0: h and ends (MIN and MAX).

rq.uikit.typing ​

lua
rq.uikit.typing() -> string|nil

since 2.22.0 changed 2.29.0

Returns the number field or text field typing on this update, by its opts.id, or nil.

While one types, the keys it reads are its own; a page of a mod's own that reads Esc, digits or letters itself can leave them alone while this is not nil.

ReturnsTypeDescription
idstring|nilThe field's opts.id (else the kit's id), or nil.

Changed in 2.29.0: Text fields (rq.uikit.input) too.

rq.uikit.input ​

lua
rq.uikit.input(value, opts) -> string, boolean, "enter"|"esc"|"away"|nil

since 2.29.0

Draws a text field: the text in a framed box, and returns the text.

  • Typing. A click on the box, or Enter under the keys' cursor, types into it; with focus it types as soon as it shows. It types through the HUD's text input (rq.hud.text_begin): the system's keyboard and input methods, a blinking caret, Backspace, Delete, Left, Right, Home, End, Ctrl+V to paste, and only characters the game's font can draw. The text slides in the box to keep the caret in sight.
  • Ending. Enter keeps the text; so does a click outside the box. Esc puts back the text it started with. A field that is not drawn for an update stops, with what it typed kept as it was. One field types at a time, a number field (rq.uikit.stepper) included: a press on another stops the first.
  • Keys. While it types, every key is hidden from the game, Ctrl (its message skip) included, and the arrows move the caret, not the keys' cursor. Enter, Esc and Backspace stay hidden until let go: Esc there does not close Config or rq.uikit.page.

The return values: while it types, the text so far; changed is true on the update a typing ends with a new text kept; ended says how a typing ended on this update. Keep the text yourself and pass it back each update.

The field is listed for rqmod-ctl ui as input-<id> with the text as value (none while it is empty, as for every control; its first 159 bytes, cut between characters) and selected true while it types. Agents type into it with rqmod-ctl type "<text>" (or rq.input.type) and edit with rqmod-ctl key and hold.

Raises an error for a text that is not a string, opts that are not a table, a max outside 1 to 255, a w that is not a whole number, or a label or placeholder that is not a string.

lua
local name = "Rance"
local open = true
rq.on_frame(function()
  if not open then return end
  open = rq.uikit.page({ id = "rename", title = "Rename" }, function()
    local text, changed = rq.uikit.input(name, { id = "name", label = "Name", max = 20, placeholder = "A name" })
    name = text
    if changed then rq.log("new name:", name) end
  end)
end)
ParameterTypeDescription
valuestringThe text shown, in UTF-8.
opts (optional)rq.UiInputOptsw (the box), max, label, placeholder, focus, disabled; place, id, tip, nav.
ReturnsTypeDescription
valuestringThe text: as typed so far while it types, the one kept or put back when it ends.
changedbooleantrue on the update a typing ended with a text other than the one it started with.
ended"enter"|"esc"|"away"|nilHow a typing ended on this update: Enter, Esc, or a click elsewhere (also a stop by a disabled field, another field, or rq.hud.text_end); nil otherwise.

See also: rq.uikit.stepper, rq.hud.text_begin

rq.uikit.tabs ​

lua
rq.uikit.tabs(list, index, opts) -> integer, boolean

since 1.7.0 changed 2.6.0

Draws Config's tabs side by side: normal, hovered and current.

With opts.style = "town" (or a theme's tabs_style) they are the hub's town tabs instead, 248 by 45 and 8 apart, the current one orange.

ParameterTypeDescription
liststring[]The tab texts.
indexintegerThe current tab.
opts (optional)rq.UiPlace |{style?: "town"|string, gap?: integer, tips?: (string| rq.UiTip )[]}Place; w is each tab's width (default 120, or the style's). style, and gap between styled tabs. tips (2.13.0): one for each tab.
ReturnsTypeDescription
indexintegerThe current tab.
changedbooleantrue on the update it changed.

Changed in 2.6.0: Added opts.style.

rq.uikit.panel ​

lua
rq.uikit.panel(opts, fn) -> integer, integer, integer, integer

since 1.7.0

Draws a Config page or the 3D tab's dark block, and runs fn in a column inside it.

A page lower than the game's keeps its top colors; it is not squashed.

Raises an error without w and h.

ParameterTypeDescription
optsrq.UiPlace |{style?: "page"|"block", pad?: integer, gap?: integer, title?: string}w and h are needed. style (default "page"), pad (default 12), gap, title.
fn (optional)fun(x: integer, y: integer, w: integer, h: integer)The widgets inside.
ReturnsTypeDescription
xintegerLeft edge.
yintegerTop edge.
wintegerWidth.
hintegerHeight.

rq.uikit.list ​

lua
rq.uikit.list(items, index, opts) -> integer|nil, boolean

since 1.7.0 changed 2.5.0 changed 2.6.0

Draws rows on a dark block that scroll by the wheel.

A bar shows when the rows do not fit. The list stays inside a clip of your own (rq.hud.clip_push). With a theme that has scroll (the hub theme), the bar is the game's scroll bar, with arrows, when the list is at least 100 high.

Raises an error without w and h.

ParameterTypeDescription
items(string|{text: string, disabled?: boolean, tip?: string| rq.UiTip })[]The rows; tip since 2.13.0.
index (optional)integerThe chosen row; nil for none.
optsrq.UiPlace |{row_h?: integer, block?: boolean}w and h are needed. row_h (default 30), block = false leaves out the dark block.
ReturnsTypeDescription
indexinteger|nilThe chosen row.
changedbooleantrue on the update it changed.

Changed in 2.5.0: Stays inside a clip of your own; before, its clip replaced yours.

Changed in 2.6.0: The game's scroll bar with a theme that has scroll.

rq.uikit.menu ​

lua
rq.uikit.menu(tree, path, opts) -> integer[], boolean, string|rq.UiMenuItem|nil

since 1.7.0

Draws a menu with levels: lists side by side, where an entry with items opens the next list.

A new pick on a level drops the levels after it.

Raises an error without h.

ParameterTypeDescription
treerq.UiMenuItem []The first level.
path (optional)integer[]The index picked at each level.
optsrq.UiPlace |{gap?: integer}h is needed. w is each list's width (default 200), gap (default 10).
ReturnsTypeDescription
pathinteger[]The path; a new table when it changed.
changedbooleantrue on the update it changed.
itemstring| rq.UiMenuItem |nilThe entry at the path's end.

rq.uikit.row ​

lua
rq.uikit.row(opts, fn) -> integer, integer, integer, integer

since 1.7.0

Places the widgets called in fn side by side.

ParameterTypeDescription
optsrq.UiBox |fun()The box, or fn itself.
fn (optional)fun(x: integer, y: integer, w?: integer, h?: integer)The widgets.
ReturnsTypeDescription
xintegerLeft edge.
yintegerTop edge.
wintegerThe width the widgets cover.
hintegerThe height they cover.

rq.uikit.col ​

lua
rq.uikit.col(opts, fn) -> integer, integer, integer, integer

since 1.7.0

Places the widgets called in fn one under the other.

ParameterTypeDescription
optsrq.UiBox |fun()The box, or fn itself.
fn (optional)fun(x: integer, y: integer, w?: integer, h?: integer)The widgets.
ReturnsTypeDescription
xintegerLeft edge.
yintegerTop edge.
wintegerThe width the widgets cover.
hintegerThe height they cover.

rq.uikit.space ​

lua
rq.uikit.space(w, h)

since 1.7.0

Leaves empty space in a row or column.

ParameterTypeDescription
wintegerWidth, in pixels.
hintegerHeight, in pixels.

rq.uikit.last ​

lua
rq.uikit.last() -> integer, integer, integer, integer

since 1.7.0

Returns where the last widget went, as for a tooltip beside it.

ReturnsTypeDescription
xintegerLeft edge.
yintegerTop edge.
wintegerWidth.
hintegerHeight.

rq.uikit.hovered ​

lua
rq.uikit.hovered() -> boolean

since 1.7.0

Returns whether the mouse was over a kit widget on this update so far.

ReturnsTypeDescription
hoveredbooleantrue when a widget drawn so far is under the mouse.

rq.uikit.comment ​

lua
rq.uikit.comment(text, opts) -> integer|nil, integer|nil, integer|nil, integer|nil

since 2.13.0

Draws the game's comment window, its tooltip, on this update.

It is the game's own look (T_Comment): a paper window with three thin borders, a shadow, a header, the text in the game's font and red sub lines under it, laid out as the game lays its own out, to the pixel. The text wraps at 520 pixels, as the game's, and shows 20 lines at most. It is drawn on the top layer (rq.uikit.top), over every widget. Call it on every update it should show; it does not wait. For a tip that waits for the mouse, give a widget tip.

Without x and y it goes at the mouse, 11 right and 20 under it; past the screen's right edge it goes left of the mouse, and past the bottom it ends at 736, as the game's. A given x past the right edge ends at 1024. It takes no clicks and covers no game control: rqmod-ctl lists it in the section "kit" with the type "comment" and its text as value.

Raises an error when the text, header or sub is not a string, style is unknown or opts is not a table.

lua
rq.on_frame(function()
  if hovering_my_icon then
    rq.uikit.comment("Doubles the gold from quests.", { header = "Golden Touch", sub = "Not in the tutorial." })
  end
end)
ParameterTypeDescription
textstring|nilThe text. \n breaks a line.
opts (optional)rq.UiCommentOptsheader, sub, style, x, y, game, id.
ReturnsTypeDescription
xinteger|nilThe window's left edge, or nil when there is nothing to show (no text, header or sub).
yinteger|nilIts top edge.
winteger|nilIts width, without the 5-pixel shadow.
hinteger|nilIts height, without the shadow.

See also: rq.uikit.comment_size

rq.uikit.comment_size ​

lua
rq.uikit.comment_size(text, opts) -> integer|nil, integer|nil

since 2.13.0

Returns the size the comment window would have, without drawing it.

Raises an error as comment does.

ParameterTypeDescription
textstring|nilThe text.
opts (optional)rq.UiCommentOptsheader, sub, style, game.
ReturnsTypeDescription
winteger|nilThe width without the 5-pixel shadow; nil when there is nothing to show.
hinteger|nilThe height without the shadow.

rq.uikit.bar ​

lua
rq.uikit.bar(value, max, opts) -> number

since 2.14.0

Draws one of the game's bars, a gauge: its CG cut to value / max of its width, as the game's T_Bar.

With dir = "up" it is cut to that part of its height and fills from the bottom. A value above 0 shows at least 1 pixel. A value is kept between 0 and max; a max under 1 draws nothing. With anim the value shown moves from the old value to a new one over that many ms.

Only the bar: the frames round the game's bars are parts of each screen's background. It takes no click and is not on the keys' cursor; tip shows under the mouse. It is listed for rqmod-ctl ui with the type "bar" and the value it shows, and never covers a game control.

Raises an error for a value or max that is not a number, an unknown style or dir, a CG that is not there, no style, cg or color, or an anim that is not a whole number of 0 or more.

lua
rq.on_frame(function()
  local c = rq.chara.get(1)
  rq.uikit.bar(c.hp, c.hp_max, { style = "hp", x = 74, y = 394, id = "hp", anim = 250 })
  rq.uikit.bar(fuel, 100, { color = { 255, 200, 0 }, x = 400, y = 600, w = 120, h = 6, tip = "Fuel" })
end)
ParameterTypeDescription
valuenumberThe value.
maxnumberThe value of a full bar.
opts (optional)rq.UiBarOptsstyle, cg or color; dir, anim; place, id, tip.
ReturnsTypeDescription
shownnumberThe value the bar shows on this update (moving with anim).

rq.uikit.skill_button ​

lua
rq.uikit.skill_button(skill, opts) -> boolean

since 2.15.0

Draws a skill's tile, as the game's status page draws it, and returns whether it was clicked.

The tile is the CG of the skill's panel color, the game's own pick (スキルボタン_CG番号), 142 by 24. The name is in the game's font, fitted as the game fits it: 18 pixels, else 16, 14 or 12 until the name and the rank marks fit, then squeezed. Under the mouse it shows the CG's hovered look and the game's yellow frame; Enter and the keys' cursor work as on every widget.

Its tip is the game's comment for the skill, its name and スキル_説明文1, right of the tile as the status page shows it; give a tip of your own, or false for none. With skill nil and slot it draws the empty slot (CG 10121) with its number.

It is listed for rqmod-ctl ui with the type "skill" and the skill number as value; an empty slot with the type "slot", which takes no click.

Raises an error for a skill that is not a whole number above 0 or has no tile (no long tile, with long), no slot without a skill, or a rank, chara, count or count_max that is not a whole number.

lua
rq.on_frame(function()
  if not open then return end
  open = rq.uikit.page({ id = "skills", title = "Skills" }, function(x, y)
    for i, skill in ipairs(my_skills) do
      if rq.uikit.skill_button(skill, { x = x + 20, y = y + i * 26, chara = chara, id = skill }) then
        pick(skill)
      end
    end
    rq.uikit.skill_button(nil, { x = x + 200, y = y + 26, slot = 1 })
  end)
end)
ParameterTypeDescription
skillinteger|nilA skill number, or nil for an empty slot.
opts (optional)rq.UiSkillOptsrank or chara, long, count, count_max, disabled, slot; place, id, tip, nav.
ReturnsTypeDescription
clickedbooleantrue on the update it is clicked.

rq.uikit.top ​

lua
rq.uikit.top(fn) -> any

since 2.11.0

Runs a function now and draws what it draws on top of every widget, as rq.hud.top does.

For a widget's floating part: its tooltip, its comment, an icon it drags. Widgets inside fn draw as usual, but clicks are still decided in call order.

Raises an error when fn is not a function, and the error fn raises.

lua
if rq.uikit.hovered() then
  rq.uikit.top(function() rq.uikit.label("Sells for 120 G", { x = mx + 16, y = my }) end)
end
ParameterTypeDescription
fnfun()The widgets and draws for the top layer.
ReturnsTypeDescription
any... What fn returns.

See also: rq.hud.top

rq.uikit.keys ​

lua
rq.uikit.keys(opts)

since 2.12.0

Lets the kit take the arrow keys, Enter, Page Up and Page Down on this update.

They move the keys' cursor between widgets (see rq.uikit) and are hidden from the game (rq.hud.block_keys); other keys still reach it. Call it on every update the keys should be the kit's; page calls it, and so do Config's Mods tab, options and item_list with keys.

With edge, an arrow that finds no widget that way calls edge(dir) and the cursor does not wrap: a mod hands the cursor to something else there, as Config's Mods tab gives it back to the game's tab row on Up.

Raises an error when opts is not a table or edge not a function.

lua
rq.on_frame(function()
  if not open then return end
  rq.uikit.keys()
  if rq.uikit.button("One", { id = "one", x = 100, y = 200 }) then pick(1) end
  if rq.uikit.button("Two", { id = "two", x = 300, y = 200 }) then pick(2) end
end)
ParameterTypeDescription
opts (optional){edge?: fun(dir: "up"|"down"|"left"|"right")}edge: called when an arrow finds nothing that way.

See also: rq.uikit.focus

rq.uikit.focused ​

lua
rq.uikit.focused() -> any|nil

since 2.12.0

Returns the widget under the keys' cursor.

It is the widget the arrows reached or the mouse last moved over. A list row is its list's id with the row's number, such as "pages.3" for row 3 of a list with id = "pages".

ReturnsTypeDescription
idany|nilThe widget's id (or the kit's own id for one without), or nil for no cursor.

rq.uikit.focus ​

lua
rq.uikit.focus(id)

since 2.12.0

Puts the keys' cursor on a widget, as an arrow would, or takes it away.

It also calls rq.uikit.keys for this update. A widget not drawn on the last update gets the cursor when it shows.

lua
rq.uikit.focus("start")  -- the page opens with the cursor on its Start button
ParameterTypeDescription
idany|nilThe widget's id, or a list row's (see focused); nil takes the cursor away.

rq.uikit.state ​

lua
rq.uikit.state(id) -> table

since 1.7.0

Returns what the kit keeps for a widget.

lua
local top = rq.uikit.state("list:options").top  -- the list's scroll, in pixels
ParameterTypeDescription
idstringThe widget's kind and id, such as "list:options".
ReturnsTypeDescription
statetableThe kept state, made empty on first use.

rq.uikit.draw ​

lua
rq.uikit.draw(piece, x, y, w, h, opts)

since 1.7.0

Draws a piece of the theme at any size.

Raises an error for a name the theme has no piece for.

ParameterTypeDescription
piecestring| rq.UiPieceA piece name in the theme, or a piece.
xintegerLeft edge, in game pixels.
yintegerTop edge, in game pixels.
w (optional)integerWidth. Default: the piece's own.
h (optional)integerHeight. Default: the piece's own.
opts (optional)rq.HudCgOptsalpha and tint, as in rq.hud.cg.

rq.uikit.copy_theme ​

lua
rq.uikit.copy_theme(theme) -> rq.UiTheme

since 1.7.0

Returns a deep copy of a theme, to change and pass to rq.uikit.use.

A piece in the copy may point at a CG from rq.image.add.

ParameterTypeDescription
theme (optional)rq.UiThemeThe theme to copy. Default: Config's.
ReturnsTypeDescription
copyrq.UiThemeThe copy.

rq.uikit.use ​

lua
rq.uikit.use(theme)

since 1.7.0

Uses a theme from now on, for every mod.

Set it back when your HUD closes.

Raises an error when theme is not a table.

ParameterTypeDescription
themerq.UiThemeThe theme.

rq.uikit.layers ​

lua
rq.uikit.layers(piece, x, y, w, h) -> rq.ImageLayer[]

since 1.8.0

Returns a piece as layers for rq.image.compose, to make a CG of it.

The Mods tab of Config is made this way: Other 2's tab with its label cut away and new text on it.

ParameterTypeDescription
piecestring| rq.UiPieceA piece name in the theme, or a piece.
x (optional)integerLeft edge in the new CG. Default 0.
y (optional)integerTop edge in the new CG. Default 0.
w (optional)integerWidth. Default: the piece's own.
h (optional)integerHeight. Default: the piece's own.
ReturnsTypeDescription
layersrq.ImageLayer []The layers.

rq.uikit.close ​

lua
rq.uikit.close(opts) -> boolean

since 2.6.0

Draws the close button of the hub's windows (24 by 20).

ParameterTypeDescription
opts (optional)rq.UiPlace |{disabled?: boolean}Place, and disabled.
ReturnsTypeDescription
clickedbooleantrue on the update it is clicked.

rq.uikit.icon_button ​

lua
rq.uikit.icon_button(icon, opts) -> boolean

since 2.47.0

Draws a picture as a button, as the game's CG buttons.

The CG is shrunk to fit the box (never grown) and centered in it. Under the mouse or the keys' cursor the box gets the item tile's yellow frame; while held the picture moves 1 pixel right and down; while disabled it is grey and cannot be clicked. With a label, a text tip is the game's comment window with the label as its title. Agents see it as button-<id>, or button-<label> without an id.

Raises an error for an icon that is not a CG number, opts that is not a table, or a label that is not text.

lua
local ICON = rq.image.add("mymod:bag", "icons/bag.png", { fit = "contain", w = 24, h = 24 })
rq.on_frame(function()
  if rq.uikit.icon_button(ICON, { x = 700, y = 120, w = 28, h = 28, id = "bag", label = "My Bag",
      tip = "Opens the bag." }) then
    rq.log("bag")
  end
end)
ParameterTypeDescription
iconintegerA CG number, such as one from rq.image.add.
opts (optional)rq.UiPlace |{label?: string, disabled?: boolean}Place (w and h default to the CG's size), label (for agents and the tip's title; default "button") and disabled.
ReturnsTypeDescription
clickedbooleantrue on the update it is clicked.

rq.uikit.castle_row ​

lua
rq.uikit.castle_row(opts) -> boolean

since 2.6.0

Draws a room row of Rance Castle: the grey button with the room's name, the face beside it, and the NEW and heart marks.

The row is 270 by 36; the button is at +3,+3 and 206 by 30, and a long name gets smaller until it fits. The face is any CG, drawn at 24 by 29 in its frame; without one the frame is black.

Raises an error for a mark that is not "heart" or "run".

lua
if rq.uikit.castle_row({ x = 145, y = 82, text = "Lab", face = 12345, new = true, id = "lab" }) then
  page_open = true
end
ParameterTypeDescription
optsrq.UiPlace |{text?: string, face?: integer, new?: boolean, mark?: "heart"|"run", disabled?: boolean}text, face (a CG number), new, mark ("heart", or "run" for MORU RUN), disabled.
ReturnsTypeDescription
clickedbooleantrue on the update its button is clicked.

rq.uikit.quest_row ​

lua
rq.uikit.quest_row(opts) -> boolean

since 2.6.0

Draws a quest row: the number, the yellow name, and the clear count in its box on the left.

The row is 228 by 30. A number is written with three digits ("077"); a long name gets smaller until it fits. mark past 9 shows "★", as the game does; 0 shows nothing. The box for the count is 38 pixels left of the row; box = false leaves it out.

ParameterTypeDescription
optsrq.UiPlace |{no?: integer|string, name?: string, mark?: integer|string, box?: boolean, current?: boolean, disabled?: boolean}no, name, mark (the clear count, or a text), box, current (covered in see-through cyan, as the game marks a quest it locks), disabled.
ReturnsTypeDescription
clickedbooleantrue on the update it is clicked.

rq.uikit.quest_list ​

lua
rq.uikit.quest_list(rows, index, opts) -> integer|nil, boolean

since 2.6.0

Draws the quest list: rows 34 apart and the game's scroll bar 15 pixels right of them.

13 rows show by default, as on the Quests screen. The wheel over the rows scrolls a row at a time; the bar's arrows, its track and a drag of the bar scroll it too. A click on a row makes it the current one. The scroll is kept by opts.id (rq.uikit.state("questlist:<id>").top).

lua
local rows, pick = {}, nil
for i, q in ipairs(my_quests) do rows[i] = { no = q.no, name = q.name, mark = q.clears } end
rq.on_frame(function()
  pick = rq.uikit.quest_list(rows, pick, { x = 330, y = 130, id = "mine" })
end)
ParameterTypeDescription
rows{no?: integer|string, name?: string, mark?: integer|string, disabled?: boolean, tip?: string| rq.UiTip }[]The rows; tip since 2.13.0.
index (optional)integerThe current row; nil for none.
opts (optional)rq.UiPlace |{shown?: integer}Place, id, and shown (rows at once, default 13).
ReturnsTypeDescription
indexinteger|nilThe current row.
changedbooleantrue on the update it changed.

rq.uikit.scrollbar ​

lua
rq.uikit.scrollbar(top, count, shown, opts) -> integer, boolean

since 2.6.0 changed 2.10.0

Draws the game's scroll bar, up and down: two arrows, the track and the bar.

top, count and shown are in any unit: rows, or pixels with opts.step. The bar is shown / count of the track, at least 10 pixels, as the game sizes it. The arrows move by step, a click on the track by shown toward the click, and a drag of the bar goes where the bar goes. The wheel over the bar, or over opts.wheel, moves by step, and the game does not get it.

As the game's bar (T_ScrollBar), an arrow or the track moves on the press. Held, it waits 250 ms and then moves again on every update while the button stays down, wherever the mouse goes; the track stops once the bar reaches the mouse.

Raises an error without h, or with an h that leaves no room between the arrows.

ParameterTypeDescription
topintegerThe first shown.
countintegerHow many there are.
shownintegerHow many show at once.
optsrq.UiPlace |{step?: integer, wheel?: integer[], label?: string, disabled?: boolean}h is needed (with the two 40 high arrows). step (default 1), wheel = {x, y, w, h}, label, disabled.
ReturnsTypeDescription
topintegerThe new first shown.
changedbooleantrue on the update it changed.

Changed in 2.10.0: Moves on the press, and again while held.

rq.uikit.rack ​

lua
rq.uikit.rack(text, opts) -> boolean

since 2.6.0

Draws a Frostbuy rack tile: a dark see-through square in the shop's black and yellow lines, with yellow text.

The shop's own racks are painted into its picture, so the tile is drawn from shapes and the game's font; its lettering is close to the painted one, not the same. "\n" starts a new line, and all lines take the size that fits the widest. Under the mouse the game's cover pulses over it.

lua
if rq.uikit.rack("MOD\nRACK", { x = 560, y = 123 }) then shop_open = true end
ParameterTypeDescription
textstringThe text.
opts (optional)rq.UiPlace |{disabled?: boolean}Place (w and h default 104 by 106), and disabled.
ReturnsTypeDescription
clickedbooleantrue on the update it is clicked.

rq.uikit.sort ​

lua
rq.uikit.sort(list, index, opts) -> integer|nil, boolean, integer|nil

since 2.6.0 changed 2.10.0

Draws the sort column: "SORT" over up to 16 buttons, 30 apart, the current one framed in yellow.

The game's column is see-through, on the Quests screen's parchment; the kit puts that parchment under it unless opts.back = false. A long label gets smaller until it fits. The current button cannot be clicked, unless again names it: a store's SORT is this column with two buttons, and its second one opens the sort menu each time.

ParameterTypeDescription
liststring[]The labels.
index (optional)integerThe current one; nil for none.
opts (optional)rq.UiPlace |{back?: boolean, again?: boolean|integer, disabled?: boolean, tips?: (string| rq.UiTip )[]}Place, back, again (true, or the index of the button that can be clicked while current), disabled, tips (2.13.0: one for each button).
ReturnsTypeDescription
indexinteger|nilThe current one.
changedbooleantrue on the update it changed.
clickedinteger|nilThe index of the button clicked on this update, current or not.

Changed in 2.10.0: again, and the button clicked.

rq.uikit.page ​

lua
rq.uikit.page(opts, fn) -> boolean

since 2.6.0 changed 2.7.0 changed 2.12.0 changed 2.22.0 changed 2.29.0 changed 2.32.0

Draws a page of a mod's own over the hub and runs fn in a column inside it.

The page covers the hub under the town tabs and above the footer (0, 56, 1024 by 536). The game shows dimmed under it and gets no mouse and no keys (rq.hud.capture_mouse, rq.hud.block_keys), so it is modal. With title the title sits on the current town tab's piece at the top left, and the box fn gets starts at the tab's bottom edge (the tab is 45 high at 8 under the page's top), so the tab touches the first thing under it, as the hub's current tab touches its screen. The page closes by its close button at the top right, a right click, or Esc; the right click and Esc close when let go, so the game does not get them. Keep the page's state yourself: draw it while it is open, and stop when it returns false. It does not open by itself; open it from a button of your own or a key.

A choice menu from rq.ui.choose shows over the page. While it does, the page leaves the mouse and the keys to the menu, and the right click, Space or Esc that ends the menu does not close the page.

The arrow keys and Enter move the keys' cursor between the page's widgets (rq.uikit.keys). Esc while a number field or a text field types (rq.uikit.stepper, rq.uikit.input) puts the field's number or text back and does not close the page; while a text field types, the arrows move its caret.

With style = "parchment" the page is Trivia's paper (CG 20001) instead: 700 by 536 at 162, 56 by default, the vine strip down each side kept and the middle cut for a lower page, the title in the paper's brown text at the top left and the close button inside the vines at the top right. The game under it is not dimmed. Labels inside are the paper's brown (label and dim of the theme changed while fn runs); the other widgets keep their look.

8 pixels higher than before, so the tab touches what it titles.

lua
local open = false
rq.on_frame(function()
  if not open then return end
  open = rq.uikit.page({ id = "mine", title = "My Page" }, function(x, y, w, h)
    rq.uikit.button("Do it", { style = "large" })
  end)
end)

-- Trivia's paper, drawn the same way:
open = rq.uikit.page({ id = "lore", title = "Lore", style = "parchment" }, function()
  rq.uikit.label("Long ago, a castle stood here.")
end)
ParameterTypeDescription
opts (optional)rq.UiPlace |{title?: string, pad?: integer, gap?: integer, style?: "hub"|"parchment"}x, y, w, h (the hub's area by default, or the paper's), id (keeps its state), title, pad (default 16; not used by the parchment), gap between widgets, style ("hub" by default; "parchment" since 2.32.0).
fn (optional)fun(x: integer, y: integer, w: integer, h: integer)The widgets inside, in a column at the box under the title, clipped to it.
ReturnsTypeDescription
openbooleanfalse on the update it closes.

Changed in 2.7.0: Stays open, under it, while the game's choice menu shows over it.

Changed in 2.12.0: The arrow keys and Enter move between its widgets.

Changed in 2.22.0: Esc that ends a number field's typing does not close it.

Changed in 2.29.0: The same for a text field's. With a title, the box starts at the tab's bottom edge,

Changed in 2.32.0: style = "parchment".

rq.uikit.item_window ​

lua
rq.uikit.item_window(items, opts) -> boolean, integer|nil

since 2.32.0 changed 2.47.0

Draws the game's Quest Storage window holding item tiles, and returns whether it is still open.

The window is the Quest Storage's own (CG 11335, T_StoreQuest): 542 wide, a grey band 34 high with the close button at its right, and the tiles in the yellow frame under it, five to a row, 106 apart, from the window's x + 9, y + 39. A window of n rows is 42 + 106 × n high (146 for one row); the rows are cut from the game's CG, not stretched. Each tile is rq.uikit.item_icon, with the game's item card as its tip. With more items than fit, the band gets the page arrows (< and >) and the page's number, and the window shows a page at a time.

It is modal, as rq.uikit.page: the game gets no mouse and no keys while it shows. It closes by its close button, a right click, or Esc, when let go. Keep its state yourself: draw it while it is open, and stop when it returns false. Agents see the window as page-<id>, its close button as button-close-<id>, each tile as item-<id>-<n> and the arrows as button-<id>-prev and button-<id>-next.

lua
local open = false
rq.gamebutton.add({ group = "map", id = "bag", label = "My Bag", icon = 11329,
  on_click = function() open = true end })
rq.on_frame(function()
  if not open then return end
  local list = {}
  for i, row in ipairs(rq.items()) do
    if i > 30 then break end
    list[#list + 1] = row.id
  end
  local clicked
  open, clicked = rq.uikit.item_window(list, { id = "bag", title = "My Bag" })
  if clicked then rq.log("picked", list[clicked]) end
end)
ParameterTypeDescription
items(integer| rq.UiItemRow | rq.UiItemWindowEntry )[]The tiles, in order.
opts (optional)rq.UiItemWindowOptsid, title, rows, x, y, empty, cell, capacity.
ReturnsTypeDescription
openbooleanfalse on the update it closes.
clickedinteger|nilThe place in items of the tile clicked on this update.

Changed in 2.47.0: capacity: the cells past it are locked.

rq.uikit.section ​

lua
rq.uikit.section(text, opts) -> integer, integer, integer, integer

since 2.32.0

Draws a heading in the quest panel's look, with an optional box under it.

The heading is the band of the quest panel's headings (CG 11014, T_QuestComment): a ★ at the left, the band fading from black to dark green, the gold stripes of its slanted right end, 26 high and 575 wide by default (any width from 100). The text is the game's font in the heading's gold, made smaller and tighter to fit. With box, the panel's see-through dark red box (4 pixel round corners) follows, 29 under the heading's top and 32 in, box high; draw what goes in it at the box's place it returns. The theme's section.body is the panel's own text style for it.

lua
local x, y, w, h = rq.uikit.section("Rewards", { x = 420, y = 100, w = 560, box = 90 })
rq.hud.text(x + 12, y + 8, "300 gold", rq.uikit.themes.hub.section.body)
ParameterTypeDescription
textstringThe heading.
opts (optional)rq.UiPlace |{box?: integer}Place (default 575 wide), id, box (the box's height in pixels, 8 or more).
ReturnsTypeDescription
xintegerThe box's left edge, or the text's without a box.
yintegerThe box's top edge, or the heading's.
wintegerThe box's width, or the room for text in the heading.
hintegerThe box's height, or the heading's (26).

rq.uikit.balloon ​

lua
rq.uikit.balloon(text, opts) -> integer, integer, integer, integer

since 2.32.0

Draws text in Frostbuy's speech balloon.

The balloon is the shop's (CG 11110, T_ShopMessage): see-through cream with 12 pixel round corners, 384 wide by default, and a tail under it pointing down. The text is the shop's (the game's font, size 28, dark brown), wrapped to the width, lines 25 apart; the balloon grows to hold them (94 high at least, the shop's). tail_x moves the tail along the bottom; tail = false leaves it out. The tail is not mirrored, so it always leans as the shop's does.

lua
rq.uikit.balloon("Welcome! Take a look around.", { x = 20, y = 87 })
rq.uikit.balloon("Over here!", { x = 600, y = 200, w = 260, tail_x = 200 })
ParameterTypeDescription
textstringThe text; \n, @ and $ start a line, as in the game's own texts.
opts (optional)rq.UiPlace |{tail?: boolean, tail_x?: integer}Place (default 384 wide; h sets the body's height), id, tail (default true), tail_x (the tail's left edge from the balloon's, in pixels; default 140).
ReturnsTypeDescription
xintegerThe body's left edge.
yintegerThe body's top edge.
wintegerThe body's width.
hintegerThe body's height, without the tail.

rq.uikit.options ​

lua
rq.uikit.options(items, opts) -> any|nil

since 2.7.0 changed 2.9.0 changed 2.10.0 changed 2.11.0 changed 2.12.0 changed 2.13.0

Draws the game's choice menu as a widget: its green base, grey rows, separators and a text panel at the top, laid out as the game lays out the menu. It is not modal and does not wait: it returns the picked row's id on the update it is clicked. Use it inside a page; rq.ui.choose opens the game's own menu instead.

The list is 380 wide. With fewer than 3 rows to pick it draws the tall buttons, as the game does. message goes in the text panel at the top, in up to 3 lines of 346 pixels. A long row text gets smaller until it fits.

Its rows are on the kit's keys cursor (see rq.uikit): Up and Down go through the rows that can be picked, wrapping round as the game's menu does, and Enter picks the cursor's row, framed in yellow as under the mouse. With keys the widget takes the keys itself (rq.uikit.keys), and Esc picks Return; the arrows, Enter and Esc are hidden from the game while it shows.

The list grows to h (default and at most 762 pixels, the game's base). Past it, the rows under the message scroll inside the base, with the game's scroll bar right of it (22 pixels more): the wheel over the list and the bar move them a row at a time, and the keys' cursor stays in sight. The message stays at the top. Only the rows wholly in sight are listed for rqmod-ctl.

Raises an error without a list, with a row without text, or with an h that is not a whole number.

lua
local pick = rq.uikit.options({ "Attack", "Defense", "-", { id = "hp", text = "HP" } },
  { id = "sortby", message = "Sort by", back = true })
if pick == 0 then open = false elseif pick then sort_by(pick) end
ParameterTypeDescription
items(string| rq.UiOptionRow )[]The rows: a text, "-" for a separator, or a table.
opts (optional)rq.UiPlace |{message?: string, back?: string|boolean, keys?: boolean, h?: integer}Place and id (keeps the scroll); message (the text panel at the top); back (a Return row, true or its text; picking it gives 0); keys (the arrow keys, Enter and Esc); h (the most height, default 762).
ReturnsTypeDescription
idany|nilThe picked row's id on the update it is clicked or Enter picks it (0 for Return); nil otherwise.

Changed in 2.9.0: keys.

Changed in 2.10.0: h, and rows past it scroll.

Changed in 2.11.0: A row's comment box is drawn on the top layer, over widgets drawn later.

Changed in 2.12.0: The rows are on the kit's keys cursor; Left and Right leave the list.

Changed in 2.13.0: A row's comment is the game's comment window, after 500 ms, as the game's menu shows it.

See also: rq.ui.choose

rq.uikit.item_data ​

lua
rq.uikit.item_data(ii) -> rq.UiItemRow|nil

since 2.8.0 changed 2.9.0

Reads an item instance's row data from the game: its name, level line, stats line, icon, rank, kind, lock, price, place, the classes that may equip it, and whether the game lets it go.

The vault's widgets read it for you; call it to read an item once, or to change a field before drawing the row.

Raises an error when ii is not a whole number.

lua
local row = rq.uikit.item_data(ii)
if row then rq.log(row.name, row.place) end
ParameterTypeDescription
iiintegerThe instance.
ReturnsTypeDescription
rowrq.UiItemRow |nilThe row data; nil when there is no such instance.

Changed in 2.9.0: discard.

rq.uikit.item_refresh ​

lua
rq.uikit.item_refresh(ii)

since 2.8.0 changed 2.9.0

Makes item rows and lists read an instance again on their next update.

Lists keep each instance's data for a second, so a change, such as a lock, shows within a second by itself. Call this after your own change to show it at once. rq.item.lock, sell, donate and store call it for you, and pickers list their items again.

ParameterTypeDescription
ii (optional)integerThe instance; nil for all of them.

Changed in 2.9.0: Pickers and item_storage list again too.

rq.uikit.item_row ​

lua
rq.uikit.item_row(row, opts) -> boolean, "lock"|"unlock"|"sell"|"donate"|nil

since 2.8.0 changed 2.9.0 changed 2.49.0

Draws a vault item row, 381 by 128, as the game draws it: the name, the icon with its rank badge, the red level bar, the stats line in the game's yellow and white, the icons of the classes that may equip it, LOCKED, and the row's buttons.

The background is cut from the vault's panel (style = "vault"), the storage's red one ("storage"), the shop's green one with the price in its GOLD box ("shop"), or a character's brown equip list ("equip"). The name is centered and gets smaller until it fits, down to 12 pixels; past that it wraps in two lines of 12 pixels, as the game's does. The stats line wraps at 264 pixels as the game's does, in 3 lines under a level bar and 4 without.

buttons adds the vault's LOCK (UNDO LOCK on a locked item), SELL and DONATE buttons at their places; a click on one is not a click on the row. A locked row has no SELL or DONATE, as in the vault. With keys on the current row, L, S and D press its LOCK, SELL and DONATE, as in the vault. The buttons only say which was clicked: call rq.item.lock, sell or donate to do it. The row is listed for rqmod-ctl as row-<id>, its buttons as button-<id>-lock, -unlock, -sell, -donate.

mark makes the row one of several to tick: a tick box at the icon's top right, ticked for true or a count, and the count as "×n" at the icon's bottom right. The cyan cover then shows the mark, not current, and so does selected in rqmod-ctl ui. A click on the box is a click on the row.

Raises an error without a row, for an ii with no instance, with another style, or for a mark other than true, false or a count of 0 or more.

lua
local clicked, button = rq.uikit.item_row(ii, { x = 538, y = 0, id = "mine", buttons = { lock = true } })
if button == "lock" then rq.item.lock(ii) elseif button == "unlock" then rq.item.lock(ii, false) end
ParameterTypeDescription
rowinteger| rq.UiItemRowAn instance, or row data (from item_data, or made up).
opts (optional)rq.UiPlace |{style?: "vault"|"storage"|"shop"|"equip", buttons?: {lock?: boolean, sell?: boolean, donate?: boolean}, current?: boolean, disabled?: boolean, keys?: boolean, mark?: boolean|integer}Place and id; style (default "vault"); buttons; current (covered in see-through cyan, as the game marks the row it works on); disabled (greyed out, no buttons, no clicks); keys (L, S and D press the buttons while the row is current); mark (since 2.49.0: false for an empty tick box, true or a count for a ticked one).
ReturnsTypeDescription
clickedbooleantrue on the update the row is clicked.
button"lock"|"unlock"|"sell"|"donate"|nilThe button clicked on this update.

Changed in 2.9.0: The shop and equip styles, two-line names, keys, no SELL or DONATE on a locked row.

Changed in 2.49.0: mark.

rq.uikit.item_icon ​

lua
rq.uikit.item_icon(item, opts) -> boolean, "remove"|nil

since 2.21.0 changed 2.22.1

Draws an item's tile, as the status page's equip slots draw it, and returns whether it was clicked.

The tile is the item's icon, 100 by 100, with its rank badge (CG 11420 + rank) at its bottom left (T_ItemIcon). Under the mouse or the keys' cursor, and while current, it gets the game's frame (216, 255, 0) at 102. With item nil it draws nothing, as the game leaves an empty slot to its page's picture, but it still takes the frame, the click and a tip.

Its tip is the game's item card (rq.uikit.item_card), left of the tile at its y (right of it when there is no room), after 500 ms from the mouse and at once from the keys, as the status page shows it. Give a tip of your own (the comment window), or false for none.

With remove, REMOVE shows beside the tile; a click on it, or D on the tile from the keys, returns "remove". The tile only says so: take the item off yourself. An item that cannot be taken off (rq.item.get(ii).locked, the game's 外せません) gets no REMOVE and no D, as on the status page.

For an item the player must not see yet, pass a row table with the icon you want shown (as rq.loot.list's cg, the game's "?") and judged = false: the tile and the card draw the row's icon, never the instance's.

It is listed for rqmod-ctl ui with the type "item", the name as label and the ii as value (item-<id>), REMOVE as button-<id>-remove, and its card as the type "card", which takes no click.

Raises an error for an ii with no instance, an item that is not an ii, a table or nil, or a size that is not a whole number above 0.

lua
local SLOTS = { 1, 11, 17 } -- weapon, armor, held item
rq.on_frame(function()
  if not open then return end
  open = rq.uikit.page({ id = "gear", title = "Gear" }, function(x, y)
    for i, kind in ipairs(SLOTS) do
      local ii = rq.ain.call("キャラ_装備取得", chara, kind)
      local _, act = rq.uikit.item_icon(ii > 0 and ii or nil, { x = x + 20, y = y + (i - 1) * 116, id = "slot" .. i, remove = true })
      if act == "remove" then take_off(chara, kind) end
    end
  end)
end)
ParameterTypeDescription
iteminteger| rq.UiItemRow |nilAn instance, row data, or nil for an empty slot.
opts (optional)rq.UiItemIconOptssize, current, disabled, remove, judged; place, id, tip, nav.
ReturnsTypeDescription
clickedbooleantrue on the update the tile is clicked.
action"remove"|nil"remove" on the update REMOVE is pressed.

Changed in 2.22.1: No REMOVE on an item that cannot be taken off.

rq.uikit.item_card ​

lua
rq.uikit.item_card(item, opts) -> integer, integer, integer, integer

since 2.21.0

Draws the game's item card now, on the top layer, and returns its box.

The card is the game's T_ItemComment: CG 10402, 393 by 139, with the item's row on it (the name, the icon with its rank, the kind, the stats line, the level bar, LOCKED, the classes), as the status page shows it beside an equip slot. With judged = false it is the game's card for an item not identified: CG 10403 (UNIDENTIFIED) over it and the icon alone.

It goes at the mouse + 11, + 20 unless x and y are given. Past the screen's right edge it goes to the left of the mouse, and past y 736 it goes up to end at 736, as the game keeps its card on the screen. Call it on every update it should show; rq.uikit.item_icon shows it as its tip.

It is listed for rqmod-ctl ui with the type "card", which takes no click.

Raises an error for an ii with no instance, or an item that is not an ii or a table.

lua
rq.on_frame(function()
  if hovered_ii then rq.uikit.item_card(hovered_ii) end
end)
ParameterTypeDescription
iteminteger| rq.UiItemRowAn instance, or row data.
opts (optional){x?: integer, y?: integer, judged?: boolean, id?: string|integer}x and y (default at the mouse); judged (default true); id for rqmod-ctl ui.
ReturnsTypeDescription
xinteger
yinteger
winteger393.
hinteger139.

rq.uikit.item_card_size ​

lua
rq.uikit.item_card_size() -> integer, integer

since 2.21.0

Returns the item card's size, to place it beside a widget as the game's screens do.

ReturnsTypeDescription
winteger393.
hinteger139.

rq.uikit.item_list ​

lua
rq.uikit.item_list(rows, index, opts) -> integer|nil, boolean, "lock"|"unlock"|"sell"|"donate"|nil, integer|nil, boolean

since 2.8.0 changed 2.9.0 changed 2.11.0 changed 2.12.0 changed 2.49.0

Draws the vault's item list: rows 128 apart and the game's scroll bar beside them.

6 rows show by default, as in the vault. The wheel over the rows scrolls a row at a time; the bar's arrows, its track and a drag of the bar scroll it too. A click on a row makes it the current one and chooses it. Rows given as instances are read from the game and kept for a second (item_refresh). The scroll is kept by opts.id (rq.uikit.state("itemlist:<id>").top).

With keys, the list takes the keys (rq.uikit.keys) and its rows are the kit's keys cursor: Up and Down move the current row, also on to a widget outside at the list's ends; Page Up and Page Down move six rows, Home and End to the first and last, scrolling to keep it shown; a held key repeats after 250 ms, every 50 ms. Enter chooses the current row, and L, S and D press its buttons. Those keys are hidden from the game while the list shows (rq.hud.block_keys).

With drag, a row pressed and moved more than 6 pixels is dragged: its icon follows the mouse on the top layer (rq.hud.top), over every widget and clip, and a list of the same group under it lights up. Let go over another list of the group and rq.uikit.item_dropped(group) returns the row on that update; nothing moves by itself. item_storage is the game's storage screen built on this.

With marks, the rows are to tick, as a shop cart's: each row gets item_row's mark, looked up in marks by the row's instance (or, for a row table without one, its index in the list): true or a count ticks it, anything else leaves it unticked. The cyan cover shows the ticked rows. A click still makes a row current and chooses it; the list changes no mark, the caller does.

Raises an error without a list, or when drag is not a name or marks not a table.

lua
local list = rq.uikit.item_sort(rq.uikit.item_filter(my_iis, { type = 1 }), 11)
rq.on_frame(function()
  pick = rq.uikit.item_list(list, pick, { x = 538, y = 0, id = "weapons" })
end)

-- Rows to tick: the caller ticks or unticks the row a click chooses.
local ticked = {}
rq.on_frame(function()
  local i, _, _, _, chosen = rq.uikit.item_list(list, nil, { x = 538, y = 0, id = "cart", marks = ticked })
  if chosen then ticked[list[i]] = not ticked[list[i]] or nil end
end)
ParameterTypeDescription
rows(integer| rq.UiItemRow )[]The rows: instances or row data.
index (optional)integerThe current row; nil for none.
opts (optional)rq.UiPlace |{shown?: integer, style?: "vault"|"storage"|"shop"|"equip", buttons?: {lock?: boolean, sell?: boolean, donate?: boolean}, bar?: {y: integer, h: integer}, keys?: boolean, drag?: string, marks?: table<integer, boolean|integer>}Place and id; shown (rows at once, default 6); style and buttons for each row; bar (where the scroll bar runs, default beside the rows); keys (the keys above); drag (a group name: rows can be dragged to another list of the group); marks (since 2.49.0: the ticked rows, by instance or index, to true or a count).
ReturnsTypeDescription
indexinteger|nilThe current row.
changedbooleantrue on the update it changed.
button"lock"|"unlock"|"sell"|"donate"|nilA row button clicked on this update.
atinteger|nilThe index of that button's row.
chosenbooleantrue on the update a row is clicked or Enter is pressed (2.9.0).

Changed in 2.9.0: keys, drag, and the fifth return.

Changed in 2.11.0: The dragged icon is drawn once, on the top layer.

Changed in 2.12.0: keys uses the kit's keys cursor; it repeats after 250 ms, every 50 ms (was 400 and 80).

Changed in 2.49.0: marks.

rq.uikit.item_dropped ​

lua
rq.uikit.item_dropped(group) -> integer|rq.UiItemRow|nil, string|nil, string|nil, integer|nil, integer|nil

since 2.9.0 changed 2.44.0

Returns the row dropped on this update on another list of a drag group (item_list's drag), and the row of the list it was dropped on, for a list whose rows are places (slots).

Raises an error when group is not a name.

lua
rq.on_frame(function()
  a_pick = rq.uikit.item_list(a, a_pick, { x = 101, y = 0, id = "a", drag = "mine" })
  b_pick = rq.uikit.item_list(b, b_pick, { x = 538, y = 0, id = "b", drag = "mine" })
  local row, from, to, _, at = rq.uikit.item_dropped("mine")
  if row then move(row, from, to, at) end -- at: the row of `to` under the mouse
end)
ParameterTypeDescription
group (optional)stringThe group; nil for any.
ReturnsTypeDescription
rowinteger| rq.UiItemRow |nilThe row as its list holds it; nil when nothing was dropped.
fromstring|nilThe id of the list it came from.
tostring|nilThe id of the list it was dropped on.
indexinteger|nilIts index in the list it came from.
atinteger|nilThe index of the row it was dropped on in the list to; nil past its last row. Since 2.44.0.

Changed in 2.44.0: The fifth value, at.

rq.uikit.item_storage ​

lua
rq.uikit.item_storage(opts) -> integer|nil, "vault"|"storage"|nil

since 2.9.0 changed 2.10.0

Draws the game's storage screen: the storage's red list on the left and the vault's list right of it (437 pixels apart, as the game places them), each with its scroll bar, the vault's count and the storage's in their boxes, and the vault's filter column and SORT. Drag a row from one list to the other to move the item (rq.item.store).

As on the game's screen, the filters and the sort apply to both lists, and each count is of its list as filtered. While a category's sub-filters show over the vault list's first row, that list starts a row lower. The sort starts at the stores' saved mode, as item_picker's. The lists are read again after a move, a filter or a sort, and every 2 seconds. The lists are listed for rqmod-ctl as row-<id>-storage-<n> and row-<id>-vault-<n>; the filters and SORT as in item_picker. rq.uikit.state("storage:<id>") has filter and sort.

lua
rq.on_frame(function()
  if not open then return end
  rq.hud.capture_mouse()
  local ii, where = rq.uikit.item_storage({ id = "mine" })
  if ii then rq.log("moved", ii, "to the", where) end
end)
ParameterTypeDescription
opts (optional)rq.UiPlace |{shown?: integer}Place (the storage list's top left, default 101, 0) and id; shown (rows, default 6).
ReturnsTypeDescription
iiinteger|nilThe instance moved on this update.
where"vault"|"storage"|nilWhere it went.

Changed in 2.10.0: The filter column and SORT, for both lists.

rq.uikit.number ​

lua
rq.uikit.number(value, opts) -> integer, integer, integer, integer

since 2.8.0 changed 2.9.0 changed 2.14.0 changed 2.15.0

Draws a number as the game does: the vault's counters (font = "count": the game's font, 20 pixels, bold, white), or one of the game's digit fonts.

A digit font is a CG cut across into 10 equal cells, 0 to 9, as the game's T_NumberCg. By name:

fontCGWhere the game uses it
"gold"11103The vault's and the shop's gold, 16 by 23
"hp"10096HP in battle, skill uses on the mini cards
"level"10122Levels and maximums on the cards, skill uses on the status page
"level_max"10124A level at its maximum, on the cards (red)
"status"10321The status page's points, EXP and gold; the level up; the results
"small"10210Skill uses on the mini-mini cards
"world"10507The world level on the title
"gallery"12252The CG mode's page numbers

Any other CG number works as a font too, a mod image from rq.image.add included. With hyphen its CG has an 11th cell, a "-", and a negative number gets it; without, a negative number draws as 0, as the game's.

Raises an error for a number that is not whole, an unknown font name, a CG that is not there, or another align.

lua
rq.uikit.number(#list, { x = 957, y = 31, w = 39 })
rq.uikit.number(price, { x = 758, y = 2, font = "gold", w = 118, align = "right", gap = 1 }) -- the shop's
rq.uikit.number(level, { x = 300, y = 200, font = level >= max and "level_max" or "level" })
ParameterTypeDescription
valueintegerThe number.
opts (optional)rq.UiPlace |{font?: "count"|"gold"|"hp"|"level"|"level_max"|"status"|"small"|"world"|"gallery"|integer, digits?: integer, align?: "left"|"center"|"right", gap?: integer, hyphen?: boolean, tint?: integer[]}Place (w with align places it in that width, default centered); font (default "count"; a name or a CG number); digits (pads with zeros to that many); gap (pixels between digits, default 0); hyphen (the CG has an 11th cell, "-"); tint (2.15.0: multiplies a digit font's colors, as rq.hud.cg's).
ReturnsTypeDescription
xintegerThe left edge of what was drawn.
yintegerIts top edge.
wintegerIts width, in pixels.
hintegerIts height.

Changed in 2.9.0: align and gap.

Changed in 2.14.0: The game's digit fonts by name or CG number, hyphen, and it returns its place.

Changed in 2.15.0: tint.

rq.uikit.filters ​

lua
rq.uikit.filters(state, opts) -> rq.UiFilterState, boolean

since 2.8.0 changed 2.9.0 changed 2.44.0

Draws the vault's filter column and returns what is picked: the categories (Special, Weapon, Armor, Item / Other), the classes, and Locked / Unlocked, on the column's grey with its "[FILTERING]" heads; and, while a category with sub-filters is picked, its panel of sub-filters over the list's first row.

style picks the column as each screen paints it: the vault's ("vault"), the shop's without Locked / Unlocked ("shop"), or a character's equip list with Equippable / Unequippable under Locked / Unlocked ("equip"; put the character in state.chara).

Each group works as the vault's: a click picks one, a second click on it clears it; with none picked all are lit, with one picked only it is. Picking another category clears the sub-filter. The state table is changed in place. The buttons are listed for rqmod-ctl as filter-<id>-special, -weapon, -armor, -item, -class-1 to -class-8, -locked, -unlocked, -equippable, -unequippable, and the sub-filters by their names (filter-<id>-swords, -rank-a, -others).

With opts.type the category stays picked: the others are drawn dim and take no click, for a list of one kind (item_picker's type). The sub-filters of that category work as usual.

Raises an error when the state is not a table of whole numbers, with another style, or with a type that is not a category.

lua
local state = {}
rq.on_frame(function()
  local _, changed = rq.uikit.filters(state, { x = 945, y = 154, id = "mine" })
  if changed then list = rq.uikit.item_filter(all, state) end
end)
ParameterTypeDescription
state (optional)rq.UiFilterStateThe state; a new one when nil.
opts (optional)rq.UiPlace |{style?: "vault"|"shop"|"equip", back?: boolean, classes?: boolean, lock?: boolean, equip?: boolean, sub?: false|{x: integer, y: integer}, type?: integer}Place (the categories' top left, 945, 154 in the vault, the shop and the equip list) and id; style (default "vault"); back (the column's grey, default true); classes, lock and equip (false leaves them out); sub (where the sub-filters' panel goes, default 407 left and 153 up, over the list's first row; false leaves it out); type (a category kept picked: 21, 1, 11 or 17; since 2.44.0).
ReturnsTypeDescription
staterq.UiFilterStateThe state.
changedbooleantrue on the update it changed.

Changed in 2.9.0: style, and Equippable / Unequippable.

Changed in 2.44.0: type.

rq.uikit.item_filter ​

lua
rq.uikit.item_filter(list, state) -> table

since 2.8.0 changed 2.9.0

Returns the items of a list that pass a filter state, tested as the vault tests them (アイテム倉庫_一覧_種類確認, _職業確認, _装備タイプ確認, _LOCKタイプ確認).

Raises an error without a list, or when the state is not a table of whole numbers.

lua
local swords = rq.uikit.item_filter(rq.items(), { type = 1, sub = 2 })
ParameterTypeDescription
list(integer| rq.UiItemRow | rq.Item )[]Instances, row data or rq.items() entries.
state (optional)rq.UiFilterStateThe filter; nil keeps all.
ReturnsTypeDescription
listtableA new list of the entries that pass, in their order.

Changed in 2.9.0: equip and chara.

rq.uikit.item_sort ​

lua
rq.uikit.item_sort(list, mode) -> table

since 2.8.0

Sorts a list of items in place as the vault sorts it, with the game's own comparers (compItem_*).

Mode 1 is the vault's default, by item number. Modes 11 to 28 are its "Default Sort" menu: 11 Attack, 12 Magic, 13 Accuracy, 14 Critical, 15 Stun, 16 Speed, 17 Defense, 18 Resistance, 19 Evasion, 20 Resilience, 21 HP, 22 to 26 the five damage reductions (fire, ice, electric, light, darkness), 27 low and 28 high enhancement rank. Ties keep the item-number order. It calls the game for each pair, so sort when the list changes, not on every update.

Raises an error without a list or with another mode.

ParameterTypeDescription
list(integer| rq.UiItemRow | rq.Item )[]Instances, row data or rq.items() entries.
mode (optional)integerThe mode; default 1.
ReturnsTypeDescription
listtableThe same list.

See also: rq.uikit.item_sorts

rq.uikit.item_sorts ​

lua
rq.uikit.item_sorts() -> {mode: integer, name: string}[]

since 2.8.0

Lists the vault's sort modes 11 to 28 with the game's names (アイテム倉庫_ソート名), for a menu.

lua
local rows = {}
for _, s in ipairs(rq.uikit.item_sorts()) do rows[#rows + 1] = { id = s.mode, text = s.name } end
rq.ui.choose(rows, function(mode) if mode ~= 0 then sort_by(mode) end end)
ReturnsTypeDescription
modes{mode: integer, name: string}[]The modes, in the menu's order.

rq.uikit.item_picker ​

lua
rq.uikit.item_picker(opts) -> integer|nil, integer|nil

since 2.8.0 changed 2.9.0 changed 2.10.0 changed 2.44.0 changed 2.49.0

Draws an item picker over the player's items, laid out as the vault: the list with its scroll bar, the filter column 407 pixels right and 154 down, the count of items listed in the column's box, and the store's SORT under the column (405 right and 682 down, as at 943, 682 in the game).

SORT is the game's: "Default Sort" sorts by item number, and the second button, which shows the mode's short name, opens the game's sort menu (rq.ui.choose, modes 11 to 28) each time it is clicked. The mode in use is framed. The sort starts at the stores' saved mode (アイテムソートモード), and a new one is saved, as the game's stores do, so the vault opens sorted the same way. A new sort goes back to the top of the list.

It lists the items in the vault, the storage, both, the shop's stock or the quest storage, filtered and sorted, and reads them again when the filters or the sort change, after an rq.item change, and every 2 seconds. The rows and the filter column take the look of the place: the shop's green rows with their prices and its column without Locked, the storage's red rows. With chara the rows are a character's equip list and the column gets Equippable / Unequippable for them. The quest storage keeps the game's order unless a sort is picked. While a category's sub-filters show, the list starts a row lower, as the vault's does. Clicking a row (or Enter, with keys) returns its instance; the picker moves nothing. The filters, the sort, the scroll and the pick are kept by opts.id (rq.uikit.state("picker:<id>") has filter, sort, list and ii).

For a list of some items only: opts.only keeps the items it returns true for, opts.type keeps one category picked in the column (21 for special items: the rank buttons over the list and Locked / Unlocked still filter), and opts.first puts rows before the rest, in its order and unsorted, filtered as the rest (an item worn now, as a row table with its own level words). opts.drag lets the rows be dragged onto another list of that group (item_list's drag, item_dropped). With shown under 6 the SORT sits at the list's own foot. The current instance is one the list shows: an item used up, sold or filtered out is no longer current. opts.marks ticks rows by instance, as item_list's: a picker to tick several items, the caller adding or taking an item on each pick.

Raises an error with another place, when chara is not a whole number, when only is not a function, first not a list, drag not a name, type not a category, or marks not a table.

(button-<id>-sort is now tab-<id>-sort-default-sort and the mode's tab); the saved sort mode. current instance cleared when the list no longer shows it.

lua
local picking = true
rq.on_frame(function()
  if not picking then return end
  rq.hud.capture_mouse() -- the game under it gets no clicks
  local ii = rq.uikit.item_picker({ x = 538, y = 0, id = "gift" }) -- where the vault's list is
  if ii then
    picking = false
    give(ii)
  end
end)

-- Special items only, unlocked ones, the worn one first.
local ii = rq.uikit.item_picker({ x = 538, y = 0, id = "special", type = 21,
  only = function(ii) return not rq.uikit.item_data(ii).locked end, first = { worn_row } })
ParameterTypeDescription
opts (optional)rq.UiPlace |{where?: "vault"|"storage"|"both"|"shop"|"quest", chara?: integer, shown?: integer, style?: "vault"|"storage"|"shop"|"equip", sort?: integer, keys?: boolean, only?: fun(ii: integer): boolean, type?: integer, first?: (integer| rq.UiItemRow )[], drag?: string, marks?: table<integer, boolean|integer>}Place and id; where (default "vault"); chara (a character's roster slot: their equip list); shown (rows, default 6); style of the rows (default from where); sort (the first sort mode, default the stores' saved one; a mode under 10 is 1, as in the game); keys (the list's keys); since 2.44.0: only (keeps the items it returns true for), type (a category kept picked: 21, 1, 11 or 17), first (rows before the rest), drag (a drag group); since 2.49.0: marks (the ticked rows, by instance, to true or a count).
ReturnsTypeDescription
pickedinteger|nilThe instance picked on this update.
currentinteger|nilThe instance picked last, while the list shows it.

Changed in 2.9.0: The shop and quest places, chara, keys; a click on the current row picks it again.

Changed in 2.10.0: The game's SORT at the bottom right, in place of the sort button under the column

Changed in 2.44.0: only, type, first and drag; the SORT at the foot of a shorter list; the

Changed in 2.49.0: marks.

rq.uikit.music_list ​

lua
rq.uikit.music_list(opts)

since 2.27.0

Draws the switches of the calling mod's music, as rq.music.page does, on a page of its own.

Call it on every update the page shows, from the page's draw. It takes about 470 high: a row of all on and off, 8 rows, and the arrows when there are more.

Raises an error for options that are not a table, or a moment with no key.

lua
rq.config.page({ id = "my-pack", title = "My Pack", draw = function(ui, box)
  rq.uikit.music_list({ w = box.w, moments = { { key = "boss", name = "Boss fights" } } })
end })
ParameterTypeDescription
optsrq.MusicListOptsPlace and moments.

See also: rq.music.page