Hud
constHud:object
Defined in: client/api.d.ts:1102
The game’s own HUD messages, shown to the player at this machine. Nothing here is replicated: a message everyone should see is sent to everyone, and each client shows it. Every message call returns false while there is no HUD, which is the case in the main menu and across a level load.
The screen-effect verbs – addScreenEffect and its siblings – put full-screen post effects on this player’s own picture. They are drawn by the game’s renderer rather than the HUD, so they need no HUD and hiding HUD elements leaves them alone.
Type Declaration
Section titled “Type Declaration”addScreenEffect()
Section titled “addScreenEffect()”addScreenEffect(
effect,params?,options?):number
Puts a full-screen effect on this player’s own picture – a colour grade, a blur, ghosting or the game’s blood overlay, for intoxication, injury, poison, dreams or a place that should feel wrong – owned by the calling resource. These are the game’s own post-processing passes, driven with the parameters this build actually reads; they are not part of the HUD and showing or hiding HUD elements does not touch them.
This is presentation, not state. Nothing is replicated, nobody else sees it, and none of it makes a player drunk or hurt: whatever decides that – usually the server – keeps it, and a client script asks for the picture to match. Weather and time of day are shared world state and are not touched.
Effects from every resource combine rather than overwrite each other, on top of the game’s own grade – which already desaturates the screen as health runs low – rather than in its place: brightness, contrast and saturation multiply, the colour cast and the hue shift add, and blur, ghosting and blood each draw the strongest one asked for. The result does not depend on which resource asked first, and removing one effect leaves the game’s grade and every other effect as they were.
An effect belongs to the resource that created it: only that resource can change or remove it, and it goes when the resource stops, when the session ends or when the level changes. A cinematic that resets the game’s post-processing clears the screen until the effect next changes. Up to 64 effects are kept across every resource.
Parameters
Section titled “Parameters”effect
Section titled “effect”"colorGrade" | "blur" | "ghosting" | "screenBlood"
Which effect, as screenEffects names it.
params?
Section titled “params?”Values for the effect’s own parameters, each clamped into its range. A parameter left out takes its default; one the effect does not take is an error.
amount?
Section titled “amount?”number
brightness?
Section titled “brightness?”number
contrast?
Section titled “contrast?”number
number
darkness?
Section titled “darkness?”number
number
magenta?
Section titled “magenta?”number
saturation?
Section titled “saturation?”number
yellow?
Section titled “yellow?”number
options?
Section titled “options?”fadeInMs brings it up from nothing; fadeOutMs is how long it takes to go, when its duration runs out or when removeScreenEffect is called without a fade of its own; durationMs ends it on its own after that long, before its fade-out – 0, the default, keeps it until it is removed. Fades are up to a minute.
durationMs?
Section titled “durationMs?”number
fadeInMs?
Section titled “fadeInMs?”number
fadeOutMs?
Section titled “fadeOutMs?”number
Returns
Section titled “Returns”number
A handle for updateScreenEffect, removeScreenEffect and isScreenEffectActive, or 0 when 64 effects are already on screen.
clearNotifications()
Section titled “clearNotifications()”clearNotifications():
boolean
Empties the queue of notifications waiting to be shown. It is the only piece of the HUD’s own state reachable from here; everything else is one-shot.
Returns
Section titled “Returns”boolean
True when the HUD took it.
hideCodexActionHint()
Section titled “hideCodexActionHint()”hideCodexActionHint():
boolean
Takes down the codex action hint.
Returns
Section titled “Returns”boolean
True when the HUD took it.
hideCurrentTutorial()
Section titled “hideCurrentTutorial()”hideCurrentTutorial():
boolean
Takes down whichever tutorial is showing, whatever it is.
Returns
Section titled “Returns”boolean
True when the HUD took it.
hideInfoText()
Section titled “hideInfoText()”hideInfoText():
boolean
Takes the info text down before its time is up.
Returns
Section titled “Returns”boolean
True when the HUD took it.
hideTutorial()
Section titled “hideTutorial()”hideTutorial(
name):boolean
Takes one named tutorial down.
Parameters
Section titled “Parameters”string
The tutorial’s own name in the game’s tables.
Returns
Section titled “Returns”boolean
True when the HUD took it.
isElementVisible()
Section titled “isElementVisible()”isElementVisible(
element):boolean
Whether multiplayer permits the element to show. True when no resource suppresses it; native gameplay rules can still hide it. This is not a pixel-visibility query.
Parameters
Section titled “Parameters”element
Section titled “element”string
The element, by the game’s own name for it, as setElementVisible takes it.
Returns
Section titled “Returns”boolean
True while multiplayer allows the element to show.
isInDialogue()
Section titled “isInDialogue()”isInDialogue():
boolean
Whether this player is in a conversation right now – one a server resource opened through Dialogue, or one the game started by itself. Both count, because a resource that acts during the game’s own dialogue is as wrong as one that acts during ours. The game’s half is read from its own dialogue manager, so it is true for real NPC conversations as well.
Returns
Section titled “Returns”boolean
True while a conversation owns the screen.
isMonologueEnabled()
Section titled “isMonologueEnabled()”isMonologueEnabled():
boolean
Whether the game voices and subtitles the local character’s monologue.
Returns
Section titled “Returns”boolean
False while multiplayer suppresses it, which is the default.
isScreenEffectActive()
Section titled “isScreenEffectActive()”isScreenEffectActive(
handle):boolean
Whether an effect is still on screen, fading out included.
Parameters
Section titled “Parameters”handle
Section titled “handle”number
What addScreenEffect returned.
Returns
Section titled “Returns”boolean
False once it has been removed and faded, has run its duration out, or was dropped by its resource stopping, the session ending or the level changing.
removeAllScreenEffects()
Section titled “removeAllScreenEffects()”removeAllScreenEffects():
number
Takes every effect the calling resource owns off the screen at once. Other resources’ effects stay.
Returns
Section titled “Returns”number
How many were removed.
removeScreenEffect()
Section titled “removeScreenEffect()”removeScreenEffect(
handle,options?):boolean
Takes an effect off the screen. An effect already fading out carries on from where it is.
Parameters
Section titled “Parameters”handle
Section titled “handle”number
What addScreenEffect returned.
options?
Section titled “options?”How long it takes to fade out. Left out, it fades over the fadeOutMs it was created with; 0 takes it off at once.
fadeOutMs?
Section titled “fadeOutMs?”number
Returns
Section titled “Returns”boolean
False when the handle is gone or belongs to another resource.
screenEffects()
Section titled “screenEffects()”screenEffects():
ScreenEffect[]
Every effect addScreenEffect accepts, with each parameter’s range, default and neutral value.
Returns
Section titled “Returns”The effects, in a fixed order.
setElementVisible()
Section titled “setElementVisible()”setElementVisible(
element,visible):boolean
Retains a visibility request for one HUD element, including before the HUD is ready. Hidden clips are suppressed before each HUD render, across movie and level reloads. Turning an element on releases multiplayer suppression; the current native HUD rules still apply. Suppression is released when its owning resource stops or the session ends. No console variables are changed.
Parameters
Section titled “Parameters”element
Section titled “element”string
The element, by the game’s own name for it: Stats is the health, stamina and nourishment bars along the bottom. One of Compass, Stats, QAMWeapon, QAMFood, Subtitles, InfoText, GameLog, Hints, DialogLeft, DialogRight, Cursor, Crime, Wanted, PopUpBackground, TutorialMessage, FancyEvent, SkillCheck, ItemTransfer, Buffs, CommonEvent, DiceCursor, Trespassing, RatioStrips, ShootingContest, Bubbles, TutorialInDialog, DiceContainer, Vignette, compared exactly.
visible
Section titled “visible”boolean
False hides the element, true lets the game show it again.
Returns
Section titled “Returns”boolean
True when the request is retained; application waits for the native HUD when it is not ready yet.
setMonologueEnabled()
Section titled “setMonologueEnabled()”setMonologueEnabled(
enabled):void
The local character’s own monologue – photo-mode comments, the sharpening remark – is spoken in Henry’s voice and captioned with his name whoever is playing, so multiplayer suppresses it and raises each line as monologueSuppressed. Releasing it lasts until the session ends.
Parameters
Section titled “Parameters”enabled
Section titled “enabled”boolean
True lets the game voice and subtitle it again; false suppresses it.
Returns
Section titled “Returns”void
showComboLearned()
Section titled “showComboLearned()”showComboLearned(
iconName,name):boolean
Shows the combo-learned toast.
Parameters
Section titled “Parameters”iconName
Section titled “iconName”string
Icon from the game’s own atlas, by name.
string
Line beside the icon, as written.
Returns
Section titled “Returns”boolean
True when the HUD took it.
showInfoText()
Section titled “showInfoText()”showInfoText(
message,durationMs?,priority?):boolean
Shows the single line of info text above the HUD.
Parameters
Section titled “Parameters”message
Section titled “message”string
Text to show, as written.
durationMs?
Section titled “durationMs?”number
How long to hold it, in real milliseconds; defaults to 3000.
priority?
Section titled “priority?”number
What an already-showing message does to this one; defaults to 0.
Returns
Section titled “Returns”boolean
True when the HUD took it.
showNotification()
Section titled “showNotification()”showNotification(
message):boolean
Shows the plain notification: one line, no icon, no payload.
Parameters
Section titled “Parameters”message
Section titled “message”string
Text to show, as written.
Returns
Section titled “Returns”boolean
True when the HUD took it.
showPerkGained()
Section titled “showPerkGained()”showPerkGained(
iconName,name):boolean
Shows the perk-gained toast, which is the one the game plays when a perk is earned.
Parameters
Section titled “Parameters”iconName
Section titled “iconName”string
Icon from the game’s own atlas, by name.
string
Line beside the icon, as written.
Returns
Section titled “Returns”boolean
True when the HUD took it.
showPerkUsed()
Section titled “showPerkUsed()”showPerkUsed(
iconName,name):boolean
Shows the perk-used toast: an icon and a line.
Parameters
Section titled “Parameters”iconName
Section titled “iconName”string
Icon from the game’s own atlas, by name – perk_alchemist, say. It is not text and is not translated.
string
Line beside the icon, as written.
Returns
Section titled “Returns”boolean
True when the HUD took it.
showRandomEventResult()
Section titled “showRandomEventResult()”showRandomEventResult(
type,result,name):boolean
Shows the random-event result panel.
Parameters
Section titled “Parameters”number
Which result the HUD draws it as.
result
Section titled “result”string
Result line, as written.
string
Name of what it was, as written.
Returns
Section titled “Returns”boolean
True when the HUD took it.
showReputationChanged()
Section titled “showReputationChanged()”showReputationChanged(
eventId,message):boolean
Shows the reputation-change message.
Parameters
Section titled “Parameters”eventId
Section titled “eventId”number
Which reputation event the HUD draws it as.
message
Section titled “message”string
Line to show, as written.
Returns
Section titled “Returns”boolean
True when the HUD took it.
showTutorial()
Section titled “showTutorial()”showTutorial(
name):boolean
Shows one of the game’s tutorials. This drives the HUD slot directly, which is past whatever the mod suppresses at the source.
Parameters
Section titled “Parameters”string
The tutorial’s own name in the game’s tables, such as OB_O20_Inventory. Not text.
Returns
Section titled “Returns”boolean
True when the HUD took it.
showXpGain()
Section titled “showXpGain()”showXpGain(
stat,statName,type?):boolean
Shows the experience-gain toast.
Parameters
Section titled “Parameters”string
The stat’s own unique name – str, say. It is an identifier, not text, and is not translated.
statName
Section titled “statName”string
What to call it on screen, as written.
number
Which XP bar the HUD draws it against; defaults to 0.
Returns
Section titled “Returns”boolean
True when the HUD took it.
updateScreenEffect()
Section titled “updateScreenEffect()”updateScreenEffect(
handle,params,options?):boolean
Changes an effect while it is on screen – a drunkenness that deepens with every drink, a wound that worsens.
Parameters
Section titled “Parameters”handle
Section titled “handle”number
What addScreenEffect returned.
params
Section titled “params”New values for some of the effect’s parameters. The others keep theirs.
amount?
Section titled “amount?”number
brightness?
Section titled “brightness?”number
contrast?
Section titled “contrast?”number
number
darkness?
Section titled “darkness?”number
number
magenta?
Section titled “magenta?”number
saturation?
Section titled “saturation?”number
yellow?
Section titled “yellow?”number
options?
Section titled “options?”fadeMs moves the parameters to their new values over that long, from wherever they are now; 0, the default, moves them at once.
fadeMs?
Section titled “fadeMs?”number
Returns
Section titled “Returns”boolean
False when the handle is gone or belongs to another resource.
worldToScreen()
Section titled “worldToScreen()”worldToScreen(
point):ScreenPoint|null
Projects a world point through the camera this frame is drawn with, so a resource can pin its own overlay to the world.
Parameters
Section titled “Parameters”World position to project.
Returns
Section titled “Returns”ScreenPoint | null
Its screen position, or null when the point is behind the camera or there is no view to place it in.