Scripts, Text & Audio

Interface mods

Restyle or replace the game's screens - the HUD, menus, dialogs and inventory - with a skin of colours, fonts and nine-slice images and Lua screen scripts, reloaded live while the game runs.

A mod can restyle the game's screens, or replace them with its own drawing. It needs no devkit module: interface mods are plain files, edited in any text editor and reloaded while the game runs.

A mod's ui/ folder may hold:

mods/<my-mod>/
  mod.toml
  ui/
    skin.toml        colours, fonts and nine-slice images over the port's interface kit
    hud.lua          scripts: each registers the screens it replaces
    menu.lua
    images/*.png     anything the scripts or the skin draw
    art/*.svg        vector art (ui.svg / ui.svg_slice), sharp at any resolution
    fonts/*.ttf

Mods load in the launcher's load order: a later mod's skin values and screens win over an earlier one's.

Note Interface mods work in Return to Norrath. Online loads only the built-in interfaces: the Remastered Interface and NorrathUI.

Choosing the interface

Options > Display > Interface picks what the game draws: Original (the PS2's), Remastered Interface (the original's art in HD, with its Widescreen layout setting) or NorrathUI. The chosen one's settings show under the row. 3-D inventory items (the inventory's items as turning 3-D models) is its own row and works with all three. A change applies when the game starts. Folder mods' ui/ scripts load on top of whichever is chosen.

Start from the example

interface/examples/fantasy/ beside the game is a complete restyle (HUD, menus, inventory) in an ornate gold-and-leather look, with its skin, images and a _style.lua kit of ornaments. To start:

  1. Copy its files into your mod's ui/ folder.
  2. Turn the mod on in the launcher and start the game.
  3. Change a script, and press F10 in the game: every mod's ui/ is reloaded, so you see the change without restarting.

NorrathUI (addons/norrath-ui/ beside the game, chosen with Options > Display > Interface) is a larger one to read: every frame is SVG, the HUD's parts are windows the player moves and resizes in an Edit mode, and the inventory is a paper doll with the 3-D hero. Its player plate rims the level badge with the experience earned, shows health and energy as numbers and a percent, and the carried weight and ammunition beside the name; tooltips are laid out in sections (the numbers, the properties, the gem slots, the value); the emote wheel, the Planar Gateway's map, the shop, the stash and the save screens are its own. Every spell and passive of the game's trees has its own square emblem in art/skills/<name>.svg; NUI.skill_icon(name) gives the one for a skill's skill name. Its _nui_00_core.lua and _nui_10_windows.lua are a kit any mod may copy.

NorrathUI's settings, under the Interface row and on its page in the game's Extra Settings (changed live):

Setting Choices
Hotbar Keyboard and mouse (shown while you play with them; a controller keeps the spell wheel), Always, Off
HUD window opacity 30% to 100%
Damage numbers On, Off
Level-up ring On, Off: the ring round your portrait while a level waits to be spent
HUD scale 60% to 160%: every HUD window, on top of each window's own scale

Its scripts read them with ui.setting(key).

UI Editor. NorrathUI's pause menu has a UI Editor: drag a HUD window to move it, turn the mouse wheel over it to scale it, and pick one to hide it or put it back where it was. Its panel holds the settings above, so they can be tried while the HUD is in view; Reset all puts every window back. The windows are the party frames, hotbar, potions, gold, notices, prompt, boss bar, bust, the achievement toast and the online chat. It needs a mouse.

Online. On Return to Norrath Online, NorrathUI adds three things the original's lobby doesn't have:

  • Friends (the Friends button, or Triangle on a chat tab): every friend with a status dot and where they are, in the lobby, waiting in a game or playing one. From here you can whisper a friend (Cross), join their game (Square; not a private one) or remove them (Triangle). Your own status (Online, Away, Busy, Looking for Group) and a short note sit on the right, beside adding or ignoring a player by name. A chat line tells you when a friend comes online or goes offline.
  • Players, the lobby's panel at the right (L1 / R1 reaches it): everyone online, with you and your party first, then your friends. Cross whispers, Triangle invites to your party (or removes a member, or leaves), and Square adds a friend or joins a friend's game.
  • Parties: whoever invites leads. When the leader hosts or joins a game, the whole party goes in with them, so make sure the game has room. /p followed by a message talks to the party in the lobby chat. A party lasts until its members leave or log out.

Errors go to rtanative.log (lines starting interface:). A screen whose script fails is dropped, and the game draws its own, until the scripts are reloaded.

skin.toml

The skin restyles the port's own interface kit without a script:

[palette]                  # any of: gold gold_dim parchment muted dim ember green red plate plate_lit stone ink
gold = "#f2c86a"
parchment = "#e6d9b8"
ember = "#e87a2e"

[fonts.body]               # a TrueType font the scripts can use by name ("body"); "med" and "small" are the game's
file = "fonts/Cinzel.ttf"

[nineslice.plate]          # the kit's pieces drawn from images: plate, frame, button, row, progress, rule
image = "images/plate.png"
border = [16, 16, 16, 16]  # left, top, right, bottom, in image pixels

Colours are #rrggbb or #rrggbbaa. A nine-slice keeps its corners, stretches its edges and middle.

srgb = true (at the top of the file, before any table) shows this mod's colours and images as authored. Without it, the interface draws them lighter than they are, most of all the dark tones. Turn it on for a new mod; it is off by default so that older mods keep the look they were made with. It applies to the mod's own scripts, palette and images, including the disc textures and icons they draw.

pointer = "art/cursor.svg" gives the mod its own mouse pointer in the menus, the inventory and the shops, in place of the game's hand: an SVG or an image in the mod's ui folder, its tip at the picture's top left corner. pointer_size is its height in design pixels (32 by default; it scales with the interface). The pointer is drawn over everything the interface draws. NorrathUI's skin.toml shows both.

Screens

A script registers a function per screen it replaces. The game calls it every frame the screen is shown, with a table of that screen's data, and skips its own drawing.

-- ui/hud.lua: a plain health and energy readout in place of the status cluster
ui.screen("hud.status", function(s)
  local x, y = 16, 14
  ui.plate(x, y, x + 260, y + 70)
  ui.text("med", 20, x + 12, y + 8, s.name .. "  (" .. s.level .. ")", "parchment")
  ui.progress(x + 12, y + 36, x + 248, y + 46, s.health / s.max_health)
  ui.progress(x + 12, y + 52, x + 248, y + 60, s.energy / s.max_energy)
end)

The screens:

Screen Data Actions
hud.status name level health max_health heal_pool energy max_energy energy_pool xp (0..1, <0 hidden) level_up hit casting player colour players remote compact bottom speaking muted (speaking: the player is talking on voice chat; muted: this machine muted them in the pause menu's Players; bottom: players 5-8's row along the bottom of the screen, with Expanded Players; compact is always false, kept for older scripts); weight weight_limit (the carried weight and the limit, whatever the settings) show_weight (Always Show Carryweight is on) ammo_kind ("arrows", "thrown" or "": the ranged weapon's) ammo (how many are left) counts_hidden (a medal arena hides the counts) local (a player of this machine). With a script for it, the game draws no ammunition or weight counters: the plate shows them -
hud.messages gold {total alpha}, info {text alpha}, potions [{kind count alpha}] (count < 0: none left), prompt {text alpha}, bust {icon text value max}, boss {name fraction flash}, help {title body can_close}, damage [{x y amount crit style alpha}] (crit: a critical hit, drawn yellow; player is the same flag, kept for old scripts; style plain / resisted / immune); absent parts are nil -
hud.dialog speaker text choices [..] selected age jumpgate (the gate menu: choices the visited gates) current (this level's gate row) fade (the box's fade in / out, 0-1) voice (the line's voice is playing) player (another machine's player in the dialog, "" none) affirm back (the "OK" and "Back" words) choose(i) (offline, not the gate menu: 0 the line - all of it first, then "OK"; i pick answer i and answer)
hud.wheel icons [8 image names or ""] selected bound [8 slots: Quick Spell 1-8, 0 unbound] labels [8: Quick Spells 3-8's key or Menu Mapping glyphs, "" none; 1-2 ""] name details (Detailed Tooltips: energy and first number, "" off) alpha names [8] skills [8] (a disc skill's own name, for an icon of the mod's; "" a variant or scripted skill) emblems [8] (a scripted or designed skill's ui_icon) column (the player's HUD column, 1-4) players (local players) assign (the inventory's assigning wheel) assign_icon -
hud.emote the emote wheel (hold Square / E, weapons sheathed): alpha (0 to 1 as it opens) slot (the highlighted one, 0 none) slots [8: {name glyph icon usable}] (clockwise from the top; icon an image path, "" none: draw glyph; usable: this hero can do it) page pages (the pages offered, the shoulder buttons turn them) page_name -
hud.loot Loot Tooltips' card for the item on the ground under the prompt: item {name icon count unique magic usable price tip} (tip as the inventory's) dock ("right", "left" or "above" the prompt: the setting's choice) offset_x offset_y scale -
hud.letterbox - -
hud.chat the online chat, every frame of a network game: open (the panel, while typing), show (Options' chat text on), lines [{channel from text stamp admin age player color}] (channel "game" / "global" / "whisper" / "system"; color {r g b} a game line's speaker's colour; age seconds), tab (1 All, 2 Game, 3 Global, 4 Whispers), scroll (rows back from the newest), channel and whisper_to (where the line goes), typing, unread (whispers waiting), covered (the inventory or a shop is open), settings {size fade fade_time lines history width timestamps hint backdrop text_opacity panel_opacity} (Chat Settings). The bubbles over the heroes stay the game's set_tab(i), scroll_to(n)
hud.hotbar slots [8: {empty icon name skill emblem key cost}] (Quick Spell 1-8: what each casts now, skill its own name for an icon of the mod's ("firestorm", "Slam"; empty for a variant or scripted skill, which keeps icon), emblem a scripted or designed skill's own ui_icon picture ("" none), its key or button, its energy, -1 none, 999 all), energy, lockout (seconds before the next cast), keyboard (the keyboard and mouse are this player's input now), player. Only for a script: the game draws no hotbar -
hud.minimap mode ("corner" or "full"), x0 y0 x1 y1 (where the map is drawn this frame, design units: wherever the Minimap Extra Setting puts it, eased as it moves), alpha, north {x y} (which way north points on screen, a unit vector). Only for a script: the game draws the map itself; this is for a frame, a compass or labels round it -
inventory tab tabs [6] gold weight {carried capacity} hero {name level class} pointer {x y} (a pad's, design units) hover message items [{name count equipped usable slot category icon model width height col line cols rows (the item's place and span in the original's 9-column grid) unique magic price details potion locked no_equip tip}] (no_equip: a potion or figurine, used rather than equipped; locked: the player locked it with the Item Locking mod - it can't be dropped or sold; false with the mod off; tip: the tooltip's contents as fields, below); equipment [{slot name icon count unique magic details category page tip locked}] (every worn item, slot as below); tab 4 stats {xp next health max_health energy max_energy armor attack damage_min damage_max strength intelligence dexterity stamina resists [5] points selected} and more_stats [{label value kind}] (the More Stats page's lines, kind heading / stat / line); tab 5 quests [{title body}]; keyboard (the keyboard and mouse are in use, else a pad), pressed (the pad's Cross was pressed this frame on the item under the cursor: the paper doll takes it off), pierced_ear (the second earring slot, 15, is open), locking (the Item Locking mod is on: R3 locks the hovered item), box {title body ok} (the game's message box is up - a quest item that can't be dropped, a refused equip, a locked item: the game holds the pad until Cross closes it, so draw it; absent otherwise); tab 6 skills {points width pages [titles] assign assign_slot keys [8] wheel [8] nodes [{name skill emblem rank max need_level passive x y page icon selected why too_low learnable requires [rows] facts [{label value}] description current next castable wheel buttons [n] granted_by spell_icon}] tree art item_skills has_item_skills} (skill: the skill's own name, as the hotbar's; emblem: the row's ui_icon picture, else a scripted or designed skill's own ui_icon, "" none; x / y: the row's ui_x / ui_y, else its x / y, on a page width wide; requires: the rows its connector hangs from (1-based); facts: Detailed Tooltips' numbers, empty when off; current / next: this rank's and the next rank's text; spell_icon: the spell's quick-slot icon, as the wheel shows it ("" for a feat) - the picture for a node with no emblem, icon or emblem of the interface's own, such as an Item Skill a mod designed; castable: a learned spell that can go on the wheel; wheel: its wheel slot, 0 none; buttons: the quick-spell buttons (hotbar keys, 1-8) that cast it; keys: those buttons' key labels; wheel: the wheel's 8 icons; assign: the pad's spell-assign mode is on, assign_slot the d-pad's slot; item_skills: the page shows Item Skills, the spells the worn items grant, in place of the class's tree - one page, no points to spend, three nodes to a row on a page 320 wide, each with granted_by, the item that grants it ("" on the class's tree); has_item_skills: a worn item grants one) set_tab(k), hover(i) (say which item the pointer is over - every frame), use(i) (✕: equip / remove / drink), drop(i) (△), move(i, steps) (move item i steps places along the page's order, back when negative: the pad's L2 + R2 + D-pad Left / Right, for a drag and drop), lock(i) (Item Locking: lock or unlock item i, as the Map button / R3 does; nothing with the mod off), select(i) (a stat or skill node), confirm() (spend a point), on tab 6 hover(i) names the skill node pointed at (a click or ✕ learns it, □ starts the pad's wheel assign), assign(i, slot) (put node i's spell on wheel slot 1-8), bind(i, button) (put it on hotbar key 1-8), set_item_skills(on) (show Item Skills, true, or the class's tree, false; △ on tab 6 swaps them too, outside the spell-assign mode), tree_frame(ox, oy, scale, miny, node, top, bottom) (say where the layout lands: the devkit's Skill Tree Designer places nodes on it), close(), box_ok() (close the message box, as Cross does), unequip(i) (take off equipment[i]), hero_view(x0, y0, x1, y1) (draw the 3-D hero in this rectangle instead of the original's place, without its stage; call it every frame it should hold, and leave the rectangle undrawn so the hero shows through), turn(f) (turn the hero by f of a full turn); ui.item_model(i, x0, y0, x1, y1, spin) draws item i's 3-D model (when model is true) with the game's renderer, over everything the script draws
shop page pages [3] gold weight {carried capacity} hero {name level} pointer {x y} keeper (the shop's own picture, an image path), stock [...] and pack [...] (each item {name count icon model model_index col line cols rows unique magic details price equipped usable affordable sellable locked tip}: price the buying price in the stock, the selling price in the pack), box {title text} (the game's message: not enough gold, can't carry, can't sell), confirm {name price} (selling a worn item asks first). Offline, one player's shop (the shared screen's two panels keep the game's) hover(side, i) (what the pointer is over, every frame: 1 the stock, 2 the pack, 0 nothing; the pad's Square buys or sells it, Cross equips), buy(i), sell(i), equip(i) (a pack item on or off), answer(yes) (the confirm question), set_page(k), dismiss() (the box), close(); ui.item_model(model_index, ...)
stash picking locked count note {text bad}; picking a hero: heroes [...] (each {name class level where}), cursor; trading: hero {name class level}, tab tabs [4] (Weapons, Armor, Misc, Gold), focus (1 the hero, 2 the stash), hero_items [...] and stash_items [...] (each {name kind count icon worn quest missing unique magic col line cols rows tip}: missing an item whose mod is off; tip as the inventory's, without the hero's own damage), cursor {hero stash}, gold {hero stash amount deposit_max withdraw_max} on the Gold page, confirm ("all" or "one": moving a worn item asks first). The launcher's Hero Stash, drawn only when NorrathUI is the chosen interface (the launcher runs no other mod's scripts); the pointer is ui.mouse() pick(i), set_tab(k), hover(side, i), move(side, i [, one]) (to the other side; one moves one of a stack), sort(side), answer(yes), gold_side(side) (1 deposit, 2 withdraw), gold_step(n), gold_all(), gold_clear(), gold_move(), back()
menu.front menu.options menu.pause menu.confirm kind screen title rows [{label slider tick greyed swatch}] cursor prompt hint [..] message panel [..] list_id achievements [..] (achievements: on the Achievements page, as menu.achievements has them; else empty; screen: which list, such as main, options, load, difficulty, pause; greyed: the row can't be chosen now; swatch: a colour row's {r, g, b, a} from 0 to 1); menu.confirm also hold (-1: Yes is pressed; else Yes is held - deleting an online hero, 10 seconds - and this is how far, 0 to 1) hold_seconds select(i) moves the cursor to row i, accept(), back(); hold_yes() (a hold box: call it every frame the mouse holds Yes down)
menu.achievements The Achievements page, as menu.pause plus achievements [{id name label description unlocked hidden progress have goal stat mod icon}] (one per row, in order; name is "???" while a hidden one is locked; icon as ui.image takes it, "" none) as menu.pause
hud.achievement An achievement's pop-up: id name description mod icon title age seconds alpha queued (title and seconds from the mod's style for this interface; queued: pop-ups waiting after it) -
menu.missions the Planar Gateway's realm map: rows [{title description medal_title medal_description bonus_title bonus_description art available locked done medal_open bonus_open medal_tier has_medal has_bonus medal_rewards}] (art the plane's picture, "lump:MSEL.LMP/..."; available the cursor can reach it; done its shard is won; medal_tier 0 none, 1-3 bronze to gold; medal_rewards the medal arena's three rewards, bronze, silver and gold (the words its medal screen shows, "" none; empty for a mod's map); has_medal / has_bonus the plane has that choice, medal_open / bonus_open it can be chosen now) row prev_row t (0 to 1: the scroll from prev_row to row) sub (0 the mission, 1 the medal arena, 2 the bonus) age evil prompt. The pad and keyboard move as on the original's map point(row, sub) (the pointer is on that choice of the selected row), pick(row, sub) (a click: another row scrolls there, the selected row's open choice is chosen), back()
menu.saves the Save Game / Load Game browser: mode (save / load) state (select, overwrite, other_heroes, delete, result, load_failed, empty, closing) fade (0 to 1) title rows [{number file location level finished date time current players difficulty play_time heroes [{name level class race code}] new}] (new: save mode's "Create New Save Game" row; play_time in seconds, -1 unknown) cursor count limit question (the overwrite / delete question) body (a result's words) ok wait (seconds before an other-heroes overwrite can be confirmed) hold (0 to 1: how far the delete question's confirm has been held; a save is deleted after 10 seconds held) hold_seconds prompts [{glyph label action}] (the answers this state takes: action names one of the actions) current_note players_label difficulty_label select(i), accept(), delete() (asks first), confirm() (yes to the question; on the delete question call it every frame the button is held), back()
menu.vars the Developer Tools' Vars... editor: title columns (the header) rows (15 rows of 7 texts: the name, then the cells; the last two rows are Good/Evil and Difficulty, one value each) row column (the cell picked, from 1; a row's name is column 1) difficulty (the one shown and edited) current_difficulty max_difficulty difficulty_name prompts [{glyph label action}] select(row, column), modify() (the cell picked; on Difficulty a step up), clear(), back() (another difficulty picked: the game switches to it), step(-1 / 1) (the Difficulty row)
menu.readout the Developer Tools' readout over the pause list: lines (position, build, difficulty and level) x y z build difficulty level -
menu.creation character creation (the 3-D hero stays the game's; a late joiner's card keeps the game's panel): step (1 / 6 the carousel, 2 appearance, 3 attributes, 4 name, 5 class, 8 an imported hero) player players black (0 to 1) cursor rows slider (appearance: 0 to 1 each) base value points stats [{name short description}] name grid grid_cursor space done race {code name sex male cls class_name description strengths weaknesses bonus [{stat amount}]} class {name description strengths weaknesses} (step 5) import {name level_line attack damage stats} race_list [{name sex original current}] race_list_cursor (Square's list of mod races) warn {title body} class_choice can_import first_stop last_stop import_stop imported mod_races titles {...} prompts [{glyph label action}] import_prompt name_help select(i) (a row, a class, a race in the list), accept(), back(), left(), right(), triangle() (Import), races() / square() (the race list; on the name step Delete), shift(), letter(i) (a letter of the grid, #grid + 1 Space, + 2 Done), slide(row, to) (an appearance slider toward 0..1, called each frame it is dragged)
menu.online the online screens: kind ("form", "lobby" or "room"), form (1 log in, 2 make an account, 3 host a game, 4 search, 5 the character choice, 0 another form), title status help message modal modal_prompt (help the pad buttons' legend in the game's glyphs; message a notice over the screen, modal a question), rows (a form's rows, "Label: value", and the buttons), cursor; the lobby's games [{number name description host players playing hardcore}], game_cursor, empty_text, focus (0 the games, 1 Public Chat, 2 Private Chat); the chat's chat [{text kind red}] (kind "system" / "private" / "chat"; red an Administrator's name in the line), chat_title typing typing_focus scroll; the room's members [{name detail portrait here owner admin team}], seats description room_start room_chat room_panel room_host room_tab; the on-screen keyboard's keyboard keys [70] key key_help [2]; chat_config {open focus title name help modal values [3] labels [4] text friends [{name online mood where note joinable}] ignoring channels sel [3] status_on mood note} (with a server that says where friends are, status_on is true and the window is the Friends window: focus 5 is My Status, mood an index into moods, note the player's note); moods (the status names: Online, Away, Busy, Looking for Group); the lobby's Players panel and party (a server with parties): party_on, players [{name me admin friend party leader mood where note joinable}] (this player, the party, friends, then everyone), player_cursor (focus 3 is the panel), in_party party_leader, invite (a party invitation's leader: Cross joins, Circle declines); the chat's kind may be "party"; the character choice's heroes [{text note portrait dim}] hero_top hero_rows; developer (the Developer Tools: population may show). The game keeps the typing, the cursor and every press; the script registers the game's own mouse targets with ui.target (below) -
hud.result a round's result box: kind ("medal_won", "medal_failed" or "game_over", Hardcore's), title, body, medals [{tier text}] (the medal round's tiers, 1 bronze to 3 gold, and their lines), prompt (the button line, the game's glyphs) -
menu.credits the end credits: lines [{head text}] (head: a heading line), y (how far the scroll has gone, in the original's 448-unit screen), line_h (19), won (after the final battle, else from the Options), time, prompt, back. The game keeps the scroll and its end -
menu.loading the loading screen: picture (the level's, "lump:<lump>/shot.tex", "" none), title (the level's name), time (seconds shown) -

Worn slots (equipment[].slot): 0 main hand, 1 off hand, 2 two-handed, 3 shield, 4 chest, 5 and 6 rings, 7 neck, 8 quiver, 9 gloves, 10 boots, 11 helmet, 12 leggings, 14 and 15 earrings, 16 ranged, 17 torch, 18 left hip, 19 right hip, 20 lower back, 21 cloak, 22 shoulders.

The game keeps driving the cursor from the pad and keyboard: a script draws where cursor says, and may call select, accept or back from its own mouse widgets. Actions are valid during the call that received them.

menu.pause also carries screen, the page's name ("pause", "options", "proximity_loot"...). On the pause menu's Proximity Loot page (the items and gold lying near the hero, one row each, nearest first) it carries loot, one entry per row: an item as hud.loot's item (name icon count unique magic usable price tip, tip the tooltip's parts as the inventory's), a gold pile {gold name}, and an empty table for the "Nothing nearby" and Back rows. Draw the tooltip of loot[cursor] beside your list, as NorrathUI does:

ui.screen("menu.pause", function(c)
  -- ... the list ...
  if c.screen == "proximity_loot" and c.loot then
    local it = c.loot[c.cursor]
    if it and it.tip then NUI.item_tip(x1 + 16, (y0 + y1) / 2, it, nil, "Value", nil, { 0, 0.5 }) end
  end
end)

In network games the inventory and shop scripts run too: their actions go to the other machines as the game's own inventory and shop do.

An item's tip (inventory, shop, stash, hud.loot) is the game's tooltip as fields, for a script to lay out: damage ("18-24") blunt own_damage and own (Detailed Tooltips: the hero's damage with it, "better" or "worse" than worn) attack armor armor_vs and armor_better (against the worn piece) weight slots used (gem slots) item_level value, and lines [{text failed better description}] (the properties, one a line; failed a requirement not met, better an improvement, description a component's or potion's words).

The ui library

Coordinates are design units: the screen is 720 tall and as wide as the window's aspect makes it (ui.size() returns the width and height), with the origin top-left. Everything scales with the window.

  • Colours are numbers from ui.color(r, g, b [, a]), palette names ("gold"), or "#rrggbb[aa]"; ui.alpha(c, a) fades one.
  • Fonts are "med", "small" (the game's) or a skin font's name; sizes are in units.
  • The game's prompts carry the controller's glyphs in its own fonts ({ Circle, | Triangle, } Square, ~ Cross). On keyboard and mouse the game draws the bound keys' caps instead; a script that wants the same asks ui.prompt(button) for each glyph (NorrathUI's NUI.glyph and NUI.prompt_text show how).
  • Image paths are relative to the mod's ui/ folder ("images/icon.png"; an SVG with ui.svg), a texture of the disc's as "lump:ICONS.LMP/busy.tex", an item icon as the inventory names them ("icon:<stem>/<id>"), or a file the game ships beside it as "exe:interface/emotes/icons/wave.png". A disc texture stored whole rather than as two fields (the mouse pointer) takes #whole after its name.
ui.screen(name, fn)   ui.on(event, fn)   ui.has_screen(name)
ui.size() -> w, h     ui.scale()         ui.time()   ui.dt()
ui.color(r,g,b[,a])   ui.alpha(c, a)     ui.palette(name)   ui.glyph("cross"|"circle"|"square"|"triangle"|"left"|"right"|"up"|"down"|"l1"|"r1"|...)
ui.prompt(button) -> art, text          the button as the player sees it: art a prompt picture for ui.image("prompt:" .. art) (a key cap on keyboard and mouse - the bound key, or where the keyboard has a key of its own that key: the name grid's Delete is Backspace, and its Shift has none - an Xbox / Switch button), or text a key's name with no picture; both nil: the font's glyph (ui.glyph)
ui.rect(x0,y0,x1,y1,c[,rounding])        ui.rect_outline(x0,y0,x1,y1,c[,rounding[,thickness]])
ui.gradient(x0,y0,x1,y1,tl,tr,br,bl)     ui.circle(cx,cy,r,c[,filled[,thickness]])   ui.line(x0,y0,x1,y1,c[,thickness])
ui.triangle(x0,y0,x1,y1,x2,y2,c)
ui.text(font,size,x,y,text,c[,"left"|"center"|"right"[,shadow]]) -> w, h
ui.text_wrapped(font,size,x,y,width,text,c[,shadow]) -> height    ui.measure(font,size,text[,wrap]) -> w, h
ui.plate(x0,y0,x1,y1[,rounding[,c]])     ui.frame(x0,y0,x1,y1[,inset[,lit[,thickness]]])   ui.rule(x,y,width[,c[,diamond]])
ui.glow(cx,cy,radius,c)   ui.progress(x0,y0,x1,y1,fraction)   ui.light(cx,cy,r,c)   ui.switch(x,y,size,on[,lit])
ui.image(path,x0,y0,x1,y1[,tint[,round]]) ui.nineslice(path,x0,y0,x1,y1,left,top,right,bottom[,scale[,tint]])   ui.image_size(path) -> w, h      ui.clip(x0,y0,x1,y1)   ui.unclip()
ui.button(id,x0,y0,x1,y1,label[,{size=,primary=,disabled=,badge=}]) -> clicked
ui.row(id,x0,y0,x1,y1[,selected]) -> clicked, hovered    ui.hot(x0,y0,x1,y1)   ui.clicked(x0,y0,x1,y1[,"right"])
ui.svg(path,x0,y0,x1,y1[,tint[,round]])  an SVG, drawn sharp at its size on screen; round (image or SVG): the corners' radius, half the size cuts a circle
ui.svg_slice(path,x0,y0,x1,y1,left,top,right,bottom[,tint[,scale]])   an SVG nine-sliced; borders in SVG units, scale = units per SVG unit
ui.svg_size(path) -> w, h
ui.hit(id,x0,y0,x1,y1) -> clicked, hovered   the mouse over a rectangle the script draws itself (ui.row draws a plate)
ui.target(group,index,x0,y0,x1,y1) -> hovered   a target of the game's own menu mouse (menu.online): the game reads the click as on its own window. group "list" (a form's row, a game, a hero; index from 0), "form_button" (0 Cross, 1 Triangle, 2 Circle; on the character choice Triangle deletes the chosen hero), "tab" (the lobby's chat tabs 1-2, the room's 0-2, a room seat 10 + seat, 3 opens the Friends window; in the Friends window 100 + n a focus row, 120 + i a friend, 160 + i an ignored player, 200 + i a channel, 110 Whisper, 111 Join Game, 112 Remove, 113 Add Friend, 114 Ignore, 115 / 116 the status back / on, 117 Close, 118 Stop Ignoring, 119 Join Channel; the lobby's Players panel 300 + i a player, 290 Whisper, 291 its party action, 292 its friend action, 293 Leave Party, 294 / 295 an invitation's Join / Decline), "confirm", "message", "grid"
ui.menu_pointer() -> on                  the menus' mouse pointer is in use
ui.mouse() -> x, y, left, right          ui.keys() -> {dx, dy, accept, back, page_up, page_down}
ui.key(name) -> pressed, held            a key by name ("E", "F5", "Escape", "Enter", "Tab"; "Shift", "Ctrl", "Alt" give held only)
ui.wheel() -> notches                    the mouse wheel this frame, up positive
ui.capture([on])                         on: the keyboard and mouse go to the scripts, not the game (an edit mode); renew every frame
ui.store(key[,value]) -> value           the mod's own saved settings (a string, number or boolean; nil clears), kept between runs
ui.setting(key[,value[,save]]) -> value  a setting of the mod's in the game's Options (a built-in interface's: NorrathUI's): a toggle a boolean, a choice its number from 1, a slider its value; nil if none. With a value it sets it (live), and `save` keeps it in the settings file
ui.zoom(z[,ox,oy])                       draw the rest of this screen's call `z` times bigger about (ox, oy) (0.25-4; the mouse and ui.hit follow): a HUD window's scale
ui.layer("under" | "over")   draw under the game's own overlay (its 3-D item models, parts a script keeps) or over it (the default, reset every screen)
ui.log(...)      rta.text(key)  (the game's GTEXT)      rta.log(...)

The scripts run in a sandbox: string, table, math, utf8 and coroutine are there; io, os, require and load are not.

Notes

  • Split screen: scripted HUD parts are drawn over the whole window, once per player (the player field says which). The original's per-pane placement is up to the script.
  • The launcher's own screens aren't moddable (they run before mods are chosen). The one exception is the Hero Stash, which NorrathUI, a built-in interface, restyles when it is the chosen interface.
  • Events: ui.on("achievement", fn) hears each achievement unlocked, with {id name mod}.
  • tools/ui_mock in the source builds rta-ui-mock, which draws a mod's screens from JSON scenes and saves each as a PNG, so you can check a screen without playing to it.
  • Not yet scriptable: the minimap itself (hud.minimap frames it), the spectator and stop-countdown overlays, the compass and crosshair, and events such as level start or a hero being hit.
  • Publishing a mod includes its ui/ folder.