Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ClassicUO/classicuo-web/llms.txt

Use this file to discover all available pages before exploring further.

The Journal class provides access to the in-game text journal — the stream of messages that appear in the chat/system area. It is available globally as journal. Use it to detect when specific messages appear, coordinate skill use around system responses, and drive reactive logic in your scripts. Common uses include:
  • Checking if the journal contains a specific string right now
  • Waiting for a system or NPC message to appear before continuing
  • Branching on which of several possible messages appears first
Journal entries persist between calls. Use journal.clear() before a sequence that needs to detect fresh messages — otherwise an old matching entry could trigger a false positive.

Methods

clear()

clear(): void
Clears the entire journal history. Any subsequent calls to containsText or waitForText will only match messages that arrive after the clear.
player.say('Hello there');
journal.waitForText('Hello there'); // Succeeds immediately (text already there)
journal.clear();
journal.waitForText('Hello there'); // Times out — journal is now empty

containsText()

containsText(text: string, author?: string): boolean
Checks right now whether the journal contains a specific string. Returns true if found, false otherwise.
text
string
required
The substring to search for in journal entries.
author
string
Optional author/source name to narrow the search.
if (journal.containsText('You are poisoned')) {
  player.useType(0xf0e); // Cure potion
}

waitForText()

waitForText(text: string, author?: string, timeout?: number): boolean
Blocks the script until the given text appears in the journal or the timeout is reached. Returns true if found, false if timed out.
text
string
required
The substring to wait for.
author
string
Optional author name to filter by (e.g. 'System').
timeout
number
Maximum time to wait in milliseconds. Defaults to 5000ms.
const healthBefore = player.hits;

journal.clear();
player.useType(0xe21); // Bandages
target.waitTargetSelf();

if (journal.waitForText('You healed', 'System', 8000)) {
  client.headMsg(`Bandaged +${player.hits - healthBefore}`, player, 66);
}

waitForTextAny()

waitForTextAny(text: string[], author?: string, timeout?: number): null | string
Waits until any one of the strings in the array appears in the journal. Returns the first matching string, or null if the timeout was reached before any match. Use this when multiple outcomes are possible and you want to branch on which one occurred first.
text
string[]
required
An array of substrings to watch for.
author
string
Optional author name filter.
timeout
number
Maximum time to wait in milliseconds.
const waitMessage    = 'You must wait';
const failMessage    = 'You cannot focus';
const successMessage = 'You enter a meditative trance.';

journal.clear();
const response = journal.waitForTextAny([waitMessage, failMessage, successMessage]);

switch (response) {
  case waitMessage: {
    sleep(2000); // Wait and retry
    break;
  }
  case failMessage: {
    client.sysMsg('Focus failed, retrying...');
    break;
  }
  case successMessage: {
    client.headMsg('Meditating', player, 66);
    break;
  }
  default: {
    client.sysMsg('Timed out waiting for meditation response');
  }
}

waitForTextEvery()

waitForTextEvery(text: string[], author?: string, timeout?: number): string[]
Waits until all of the strings in the array have appeared in the journal, or the timeout is reached. Returns an array of the strings that were found — which may be a subset if the timeout was hit before all appeared. Use this when you need to confirm that a series of messages all occurred.
text
string[]
required
An array of substrings that must all appear.
author
string
Optional author name filter.
timeout
number
Maximum time to wait in milliseconds.
const waitMessage    = 'You must wait';
const failMessage    = 'You cannot focus';
const successMessage = 'You enter a meditative trance.';

journal.clear();
const response = journal.waitForTextEvery([waitMessage, failMessage, successMessage]);

if (response.includes(successMessage)) {
  client.headMsg('Meditating...', player, 66);
}

Common Patterns

React to bandage results

journal.clear();
player.useType(0xe21);
target.waitTargetSelf();

const result = journal.waitForTextAny(
  ['You heal', 'You can not', 'bandages remaining'],
  undefined,
  10000
);

if (result?.includes('You heal')) {
  client.sysMsg('Heal successful!');
} else {
  client.sysMsg('Bandage failed or timed out.');
}

Skill use with journal response

journal.clear();
player.useSkill(Skills.Meditation);

if (journal.waitForText('You enter a meditative trance', undefined, 3000)) {
  client.headMsg('In trance', player, 66);
  sleep(5000); // Meditate for 5 seconds
}

Build docs developers (and LLMs) love