Skip to content

EN UO Topic journal

Codex edited this page Oct 12, 2026 · 4 revisions

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

Journal

Home · C# · IDE · UO API · A–Z · Examples · Languages

Search and wait for messages, line indexes, time, color and serial of the author. Separate old log lines from the message you expect after the action.

Sections

Topic Commands and explanations
Journal UO.Journal
InJournal UO.InJournal
InJournalBetweenTimes UO.InJournalBetweenTimes
WaitJournalLine UO.WaitJournalLine
System Journal UO.AddToSystemJournal · UO.AddToSystemJournalEx · UO.ClearSystemJournal · UO.WaitJournalLineSystem
Journal Ignore UO.AddJournalIgnore · UO.ClearJournalIgnore
Journal Color UO.JournalColor · UO.GetJournalColor
Journal Serial UO.JournalSerial · UO.GetJournalSerial
Journal Timer UO.JournalTimer
Found Text UO.GetFoundedText · UO.GetFoundedTextColor · UO.GetFoundedTextID · UO.GetFoundedTextIndex · UO.GetFoundedTextSerial · UO.GetFoundedTextTimer

All theme commands

Journal

UO.Journal · UO.GetJournal · UO.InJournal · UO.InJournalBetweenTimes · UO.LowJournal · UO.HighJournal · UO.ClearJournal · UO.DeleteJournal · UO.ChangeJournalLength · UO.SetJournalLine · UO.AddToJournal · UO.LastJournalMessage · UO.LastMessage

Waiting

UO.WaitJournalLine · UO.WaitJournalLineSystem · UO.WaitingForJournalText

System Journal

UO.AddToSystemJournal · UO.AddToSystemJournalEx · UO.ClearSystemJournal

Journal Ignore

UO.AddJournalIgnore · UO.ClearJournalIgnore

Line Information

UO.JournalColor · UO.GetJournalColor · UO.JournalSerial · UO.GetJournalSerial · UO.JournalTimer · UO.LineCount · UO.LineID · UO.LineIndex · UO.LineMsgType · UO.LineName · UO.LineTextColor · UO.LineTextFont · UO.LineTime · UO.LineType

Found Text

UO.FoundedParamId · UO.GetFoundedText · UO.GetFoundedTextColor · UO.GetFoundedTextID · UO.GetFoundedTextIndex · UO.GetFoundedTextSerial · UO.GetFoundedTextTimer

Examples on the topic

Each command card has several independent scenarios: direct code, functions and classes. Below are selected short scenarios; restrictions and full analysis are in the cards.

UO.InJournal

Parameters, result and all scenarios

var found = UO.InJournal("You see");
if (Truth(found > 0))
{
    var text = UO.GetFoundedText();
    UO.Print(text);
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

UO.WaitJournalLine

Parameters, result and all scenarios

var started = Now();
var found = UO.WaitJournalLine(started, "success|failed", 3000);
if (Truth(found))
{
    UO.Print(UO.GetFoundedText());
}
else
{
    UO.Print("Timeout");
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

Reference parts

1 · 2

Complete command reference


UO.AddJournalIgnore

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

void UO.AddJournalIgnore(object? str);

Adds a local text filter for ClassicUO game log entries.

Parameters

  • str - non-empty text fragment to search in the text of the journal entry.

Return value

void. The command does not return the number of matches.

Behavior

  • The text is cut off at the edges; no empty line is added. When checking a record, the search for a substring is performed in a case-insensitive manner. The matched entry is hidden locally in the client log; the server does not receive the filter. UO.ClearJournalIgnore() clears all added text filters. Already displayed entries are not restored when cleared.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The command is a separate statement. The message before it marks the start of the call; it does not confirm a server action.

UO.Print("Calling UO.AddJournalIgnore");
UO.AddJournalIgnore("You see");

1. Hide new posts containing this phrase. - direct script

Parameters and execution flow:

  • Hide new posts containing this phrase.
UO.AddJournalIgnore("You see");

2. The filter searches for a substring that is not case sensitive. - script function

Parameters and execution flow:

  • The filter searches for a substring that is not case sensitive.
return  RunScenario();
 object? RunScenario()
{
    var phrase = "vendor";
    UO.AddJournalIgnore(phrase);
    return null;
}

3. Multiple calls add independent text filters. - script class

Parameters and execution flow:

  • Multiple calls add independent text filters.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        UO.AddJournalIgnore("You see");
        UO.AddJournalIgnore("vendor");
        return null;
    }
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.AddJournalIgnore(str) — UO.AddJournalIgnore(Any)

Parameters: str (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "addjournalignore": bridge.AddJournalIgnore(Text(0)); return InjectionValue.Unit;

UO.AddToJournal

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

void UO.AddToJournal(object? text);

Shows a local message about script progress or stopping condition. You see it, not other players.

Parameters

Return value

A call to a method with a return type void is written as a standalone statement C#; the result cannot be assigned or checked. Completing the statement does not constitute confirmation from the game server.

Behavior

  • The message goes to the lower left area of ​​the game window and the local log. A copy is available in output IDE. In the manager's general log, enable the script message filter: the entry is available without the game window. The server system message filter does not select such records. The network voice packet is not sent. For the inscription above the head there is UO.CharPrint.
  • UO.Print adds a new entry to the game message log: first read or save the desired search string/result, then record the diagnostic message. In a fast loop, record messages when changes occur rather than every iteration.
  • The color of system messages of this script runtime is used: initially 0x0440, changed UO.ConColor. This is a local entry; the command name does not mean sending to the server.
  • UO.Print · UO.CharPrint · UO.Say · UO.ConColor

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The command is a separate statement. The message before it marks the start of the call; it does not confirm a server action.

UO.Print("Calling UO.AddToJournal");
UO.AddToJournal("Script started");

1. Brief report - direct script

Parameters and execution flow:

  • processed=12 — demo number of items already processed. Convert.ToString turns it into a string. This example only reports a number; it does not transfer the objects themselves.
var processed = 12;
UO.AddToJournal("Processed item entries: " + Convert.ToString(processed));

2. Overload Warning - Script Function

Parameters and execution flow:

  • The character's weight and maximum are read. A zero/unknown maximum is not considered an overload. If weight >= maximum, one line is printed and Main ends; items are not thrown away.
return  RunScenario();
 object? RunScenario()
{
    var weight = UO.Weight();
    var maximum = UO.MaxWeight();
    if (Truth(maximum > 0) && Truth(weight >= maximum))
    {
        UO.AddToJournal("Too heavy: " + Convert.ToString(weight) + "/" + Convert.ToString(maximum));
        return null;
    }

    return null;
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

3. Report Weight Changes Only - Script Class

Parameters and execution flow:

  • Main remembers the weight, waits 1000 milliseconds, and calls the fully declared ReportWeight. The assistant prints only if the weight has changed and returns the new weight for the next check. It does not itself create an infinite loop.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        var previous = UO.Weight();
        UO.Wait(1000);
        previous = ReportWeight(previous, UO.Weight());
        return null;
    }

    dynamic ReportWeight(dynamic previous, dynamic current)
    {
        if (Truth(previous != current))
        {
            UO.AddToJournal("Weight changed: " + Convert.ToString(current));
        }

        return current;
    }

    bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.AddToJournal(text) — UO.AddToJournal(Any)

Parameters: text (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "addtojournal":

                case "addtosystemjournal":

                case "clientprint":

                    SystemMessage(Text(0)); return InjectionValue.Unit;

UO.AddToSystemJournal

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

void UO.AddToSystemJournal(object? text);

Shows a local message about script progress or stopping condition. You see it, not other players.

Parameters

Return value

A call to a method with a return type void is written as a standalone statement C#; the result cannot be assigned or checked. Completing the statement does not constitute confirmation from the game server.

Behavior

  • The message goes to the lower left area of ​​the game window and the local log. A copy is available in output IDE. In the manager's general log, enable the script message filter: the entry is available without the game window. The server system message filter does not select such records. The network voice packet is not sent. For the inscription above the head there is UO.CharPrint.
  • UO.Print adds a new entry to the game message log: first read or save the desired search string/result, then record the diagnostic message. In a fast loop, record messages when changes occur rather than every iteration.
  • The color of system messages of this script runtime is used: initially 0x0440, changed UO.ConColor. This is a local entry; the command name does not mean sending to the server.
  • UO.Print · UO.CharPrint · UO.Say · UO.ConColor

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The command is a separate statement. The message before it marks the start of the call; it does not confirm a server action.

UO.Print("Calling UO.AddToSystemJournal");
UO.AddToSystemJournal("Script started");

1. Brief report - direct script

Parameters and execution flow:

  • processed=12 — demo number of items already processed. Convert.ToString turns it into a string. This example only reports a number; it does not transfer the objects themselves.
var processed = 12;
UO.AddToSystemJournal("Processed item entries: " + Convert.ToString(processed));

2. Overload Warning - Script Function

Parameters and execution flow:

  • The character's weight and maximum are read. A zero/unknown maximum is not considered an overload. If weight >= maximum, one line is printed and Main ends; items are not thrown away.
return  RunScenario();
 object? RunScenario()
{
    var weight = UO.Weight();
    var maximum = UO.MaxWeight();
    if (Truth(maximum > 0) && Truth(weight >= maximum))
    {
        UO.AddToSystemJournal("Too heavy: " + Convert.ToString(weight) + "/" + Convert.ToString(maximum));
        return null;
    }

    return null;
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

3. Report Weight Changes Only - Script Class

Parameters and execution flow:

  • Main remembers the weight, waits 1000 milliseconds, and calls the fully declared ReportWeight. The assistant prints only if the weight has changed and returns the new weight for the next check. It does not itself create an infinite loop.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        var previous = UO.Weight();
        UO.Wait(1000);
        previous = ReportWeight(previous, UO.Weight());
        return null;
    }

    dynamic ReportWeight(dynamic previous, dynamic current)
    {
        if (Truth(previous != current))
        {
            UO.AddToSystemJournal("Weight changed: " + Convert.ToString(current));
        }

        return current;
    }

    bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.AddToSystemJournal(text) — UO.AddToSystemJournal(Any)

Parameters: text (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "addtojournal":

                case "addtosystemjournal":

                case "clientprint":

                    SystemMessage(Text(0)); return InjectionValue.Unit;

UO.AddToSystemJournalEx

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

void UO.AddToSystemJournalEx(object? text, object? textColor, object? bgColor, object? fontSize, object? fontName);

Outputs a local line to the game window and log with an approximate display of the specified design. Useful for distinguishable script diagnostic messages.

Parameters

  • textColor — Text color in 0xRRGGBB format, not UO hue. The alpha channel is not used. Example 0xFF8800 - orange; the engine selects the closest color from the UO palette.
  • bgColor - Negative number - default background; non-negative - RGB 0xRRGGBB. The requested background is written to the output of IDE, but a separate colored rectangle behind the line is not drawn in the game window.
  • fontSize — Requested size in points: the value <= 0 is replaced by 10, then the range 4..72 is applied. The game font number is calculated integer as (size + 1) / 3; There is no exact desktop size in the game window.
  • fontName — Name of the font to write design information to output IDE. Whitespace around the edges is removed; empty value means Consolas. This command does not load an arbitrary Windows font into the game window.

Return value

A call to a method with a return type void is written as a standalone statement C#; the result cannot be assigned or checked. Completing the statement does not constitute confirmation from the game server.

Behavior

  • All five arguments are required: Text, TextColor, BGColor, FontSize, FontName. The text is visible locally; in IDE the requested design is additionally saved. The background color and font name are design cues and are not guaranteed to be reproduced exactly. ConColor does not change the explicitly passed RGB.
  • The message goes to the lower left area of ​​the game window and the local log. A copy is available in output IDE. In the manager's general log, enable the script message filter: the entry is available without the game window. The server system message filter does not select such records. The network voice packet is not sent. For the inscription above the head there is UO.CharPrint.
  • UO.Print · UO.CharPrint · UO.ClientPrintEx · UO.AddToSystemJournalEx

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The command is a separate statement. The message before it marks the start of the call; it does not confirm a server action.

UO.Print("Calling UO.AddToSystemJournalEx");
UO.AddToSystemJournalEx("Route started", 0xFF8800, -1, 12, "Consolas");

1. UO.AddToSystemJournalEx - 1 - direct script

Parameters and execution flow:

  • Orange message, default background - 1, size 12: this makes the game font 4. Consolas is stored in IDE information. Color may vary from exact RGB due to game palette.
UO.AddToSystemJournalEx("Route started", 0xFF8800, -1, 12, "Consolas");

2. UO.AddToSystemJournalEx — 2 — script function

Parameters and execution flow:

  • A positive BGColor value of 0x112233 stores the background request in IDE. For FontSize=0 10 is used, empty FontName becomes Consolas. In the game window, the background is not painted over according to this parameter.
return  RunScenario();
 object? RunScenario()
{
    UO.AddToSystemJournalEx("Formatting details", 0x33AAFF, 0x112233, 0, "");
    return null;
}

3. UO.AddToSystemJournalEx - 3 - scenario class

Parameters and execution flow:

  • ReportCount is a fully declared procedure. It only reports changes in quantity, selecting green RGB for increasing and red for decreasing. Returns a new quantity for the next comparison; the result belongs to ReportCount, not AddToSystemJournalEx.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        var previous = 10;
        previous = ReportCount(previous, 12);
        return null;
    }

    dynamic ReportCount(dynamic previous, dynamic current)
    {
        if (Truth(previous != current))
        {
            var textColor = 0xCC3333;
            if (Truth(current > previous))
            {
                textColor = 0x33AA66;
            }

            UO.AddToSystemJournalEx("Count: " + Convert.ToString(current), textColor, -1, 10, "Consolas");
        }

        return current;
    }

    bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.AddToSystemJournalEx(text, textColor, bgColor, fontSize, fontName) — UO.AddToSystemJournalEx(Any,Any,Any,Any,Any)

Parameters: text (Any), textColor (Any), bgColor (Any), fontSize (Any), fontName (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "addtosystemjournalex":

                    bridge.PrintFormattedJournal(Text(0), Arg(1), Arg(2), Arg(3), Text(4)); return InjectionValue.Unit;

UO.ChangeJournalLength

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

void UO.ChangeJournalLength(object? newLength);

Changes the client log history limit that is retained.

Parameters

  • newLength — Number of records to convert to int. Runtime limits below to 1; JournalManager limits from above Constants.MAX_JOURNAL_HISTORY_COUNT.

Return value

void - no return value.

Behavior

  • Saves state.JournalLength, then calls SetJournalLength. JournalManager reduces the existing history by removing the oldest entries to a new limit. Filtered entries and log display are separate mechanisms.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The command is a separate statement. The message before it marks the start of the call; it does not confirm a server action.

UO.Print("Calling UO.ChangeJournalLength");
UO.ChangeJournalLength(100);

1. History on 100 records - direct script

Parameters and execution flow:

  • The new limit limits the number of records saved.
UO.ChangeJournalLength(100);

2. Minimal History - Script Function

Parameters and execution flow:

  • When the limit is reduced, old entries are deleted.
return  RunScenario();
 object? RunScenario()
{
    UO.ChangeJournalLength(1);
    return null;
}

3. Null Input - Script Class

Parameters and execution flow:

  • The zero is normalized to 1 rather than clearing the log.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        UO.ChangeJournalLength(0);
        return null;
    }
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.ChangeJournalLength(newLength) — UO.ChangeJournalLength(Any)

Parameters: newLength (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "changejournallength": state.JournalLength = Math.Max(1, Arg(0, 100)); bridge.SetJournalLength(state.JournalLength); break;

UO.ClearJournal

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

void UO.ClearJournal();

Removes lines from the shared local log.

Parameters

There are no parameters.

Return value

void - no return value. Does not return the number of rows deleted. The hit counter and current script selection are reset.

Behavior

  • The shared buffer is available to all scripts: deleted lines are no longer present. Snapshots previously saved by other scripts may remain, but their index will become -1.
  • Without a text filter, the entire Classic UO buffer is cleared, including System. The local log file and server messages are not deleted.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The command is a separate statement. The message before it marks the start of the call; it does not confirm a server action.

UO.Print("Calling UO.ClearJournal");
UO.ClearJournal();

1. Clear selected log area - direct script

Parameters and execution flow:

  • There are no arguments. All lines of the shared buffer are deleted.
  • The last search counter becomes 0; Print may add a new line after clearing.
UO.ClearJournal();
var count = UO.LineCount();
UO.Print("Search matches after clear: " + Convert.ToString(count));

2. Clear Before Wait - Script Function

Parameters and execution flow:

  • Clearing occurs before the timestamp is saved. 1000 - limited wait in milliseconds.
  • A timestamp is usually sufficient to exclude old messages; The cleanup also affects other scripts.
return  RunScenario();
 object? RunScenario()
{
    UO.ClearJournal();
    var started = Now();
    var found = UO.WaitJournalLine(started, "notice", 1000);
    UO.Print(Convert.ToString(found));
    return null;
}

3. Check Reset Selected Entry - Script Class

Parameters and execution flow:

  • After cleaning through the current script index=-1, even if only part of the buffer was deleted.
  • The text variable stores the previously read copy, and GetFoundedText has already been cleared.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        var text = UO.Journal(0);
        UO.ClearJournal();
        var index = UO.LineIndex();
        UO.Print(Convert.ToString(index));
        return null;
    }
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.ClearJournal() — UO.ClearJournal()

Parameters: No parameters.

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "clearjournal": DeleteJournal(); return InjectionValue.Unit;

UO.ClearJournalIgnore

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

void UO.ClearJournalIgnore();

Removes all text filters JournalManager.

Parameters

There are no parameters.

Return value

void - no return value.

Behavior

  • Removing filters does not delete history or cancel AddChatUserIgnore name filters.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The command is a separate statement. The message before it marks the start of the call; it does not confirm a server action.

UO.Print("Calling UO.ClearJournalIgnore");
UO.ClearJournalIgnore();

1. Clear state - direct script

Parameters and execution flow:

  • Removes all text filters JournalManager.
UO.ClearJournalIgnore();

2. Clear after setup - script function

Parameters and execution flow:

  • Allow the You see text to display again.
return  RunScenario();
 object? RunScenario()
{
    UO.AddJournalIgnore("You see");
    UO.ClearJournalIgnore();
    return null;
}

3. Re-Purge - Script Class

Parameters and execution flow:

  • Clearing an empty set is acceptable and does not create a new setting.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        UO.ClearJournalIgnore();
        UO.ClearJournalIgnore();
        return null;
    }
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.ClearJournalIgnore() — UO.ClearJournalIgnore()

Parameters: No parameters.

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "clearjournalignore": bridge.ClearJournalIgnore(); return InjectionValue.Unit;

UO.ClearSystemJournal

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

void UO.ClearSystemJournal();

Removes lines with author name System.

Parameters

There are no parameters.

Return value

void - no return value. Does not return the number of rows deleted. The hit counter and current script selection are reset.

Behavior

  • The shared buffer is available to all scripts: deleted lines are no longer present. Snapshots previously saved by other scripts may remain, but their index will become -1.
  • System is recognized by the author's name, case insensitive; This is the ClassicUO general journal filter.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The command is a separate statement. The message before it marks the start of the call; it does not confirm a server action.

UO.Print("Calling UO.ClearSystemJournal");
UO.ClearSystemJournal();

1. Clear selected log area - direct script

Parameters and execution flow:

  • There are no arguments. Only the System lines are removed.
  • The last search counter becomes 0; Print may add a new line after clearing.
UO.ClearSystemJournal();
var count = UO.LineCount();
UO.Print("Search matches after clear: " + Convert.ToString(count));

2. Clear Before Wait - Script Function

Parameters and execution flow:

  • Clearing occurs before the timestamp is saved. 1000 - limited wait in milliseconds.
  • A timestamp is usually sufficient to exclude old messages; The cleanup also affects other scripts.
return  RunScenario();
 object? RunScenario()
{
    UO.ClearSystemJournal();
    var started = Now();
    var found = UO.WaitJournalLine(started, "notice", 1000);
    UO.Print(Convert.ToString(found));
    return null;
}

3. Check Reset Selected Entry - Script Class

Parameters and execution flow:

  • After cleaning through the current script index=-1, even if only part of the buffer was deleted.
  • The text variable stores the previously read copy, and GetFoundedText has already been cleared.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        var text = UO.Journal(0);
        UO.ClearSystemJournal();
        var index = UO.LineIndex();
        UO.Print(Convert.ToString(index));
        return null;
    }
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.ClearSystemJournal() — UO.ClearSystemJournal()

Parameters: No parameters.

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "clearsystemjournal": bridge.DeleteSystemJournal(); SelectJournalEntry(null); return InjectionValue.Unit;

UO.DeleteJournal

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

void UO.DeleteJournal();
void UO.DeleteJournal(object? text);

Removes lines from the shared local log.

Parameters

  • text — The searched substring or several alternatives via |, for example success|failed. Spaces at the edges of each alternative are removed, empty alternatives are skipped. This is plain text, not a regular expression. Use a non-empty template. Optional only for DeleteJournal: when transmitting, matching strings are removed in a case-insensitive manner; without an argument, the entire buffer is deleted.

Return value

void - no return value. Does not return the number of rows deleted. The hit counter and current script selection are reset.

Behavior

  • The shared buffer is available to all scripts: deleted lines are no longer present. Snapshots previously saved by other scripts may remain, but their index will become -1.
  • Without a text filter, the entire Classic UO buffer is cleared, including System. The local log file and server messages are not deleted.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The command is a separate statement. The message before it marks the start of the call; it does not confirm a server action.

UO.Print("Calling UO.DeleteJournal");
UO.DeleteJournal();

1. Clear selected log area - direct script

Parameters and execution flow:

  • There are no arguments. All lines of the shared buffer are deleted.
  • The last search counter becomes 0; Print may add a new line after clearing.
UO.DeleteJournal();
var count = UO.LineCount();
UO.Print("Search matches after clear: " + Convert.ToString(count));

2. Clear Before Wait - Script Function

Parameters and execution flow:

  • Clearing occurs before the timestamp is saved. 1000 - limited wait in milliseconds.
  • A timestamp is usually sufficient to exclude old messages; The cleanup also affects other scripts.
return  RunScenario();
 object? RunScenario()
{
    UO.DeleteJournal();
    var started = Now();
    var found = UO.WaitJournalLine(started, "notice", 1000);
    UO.Print(Convert.ToString(found));
    return null;
}

3. Check Reset Selected Entry - Script Class

Parameters and execution flow:

  • After cleaning through the current script index=-1, even if only part of the buffer was deleted.
  • The text variable stores the previously read copy, and GetFoundedText has already been cleared.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        var text = UO.Journal(0);
        UO.DeleteJournal();
        var index = UO.LineIndex();
        UO.Print(Convert.ToString(index));
        return null;
    }
}

4. Remove only matching text - direct script

Parameters and execution flow:

  • text contains two substrings. Lines from any of them are deleted without taking into account case; the remaining messages remain.
  • found=0 if there are no new matching messages after deletion. The empty pattern in this implementation matches all strings.
UO.DeleteJournal("notice|warning");
var found = UO.InJournal("notice|warning", -1);
UO.Print(Convert.ToString(found));

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.DeleteJournal() — UO.DeleteJournal()

Parameters: No parameters.

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

public void DeleteJournal()

        {

            bridge.DeleteJournal();

            SelectJournalEntry(null);

        }

UO.DeleteJournal(text) — UO.DeleteJournal(Any)

Parameters: text (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

public void DeleteJournal(InjectionValue text) => DeleteJournal((string)text);

UO.FoundedParamId

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

dynamic UO.FoundedParamId();

Returns the number of the matched search pattern alternative.

Parameters

There are no parameters.

Return value

int - index from 0 in the list of non-empty alternatives through |: success|failed gives 0 for success and 1 for failed. If there are several suitable alternatives, the first one in the template is taken. Without a match or after a direct Journal also 0. This is not the author's serial, not the line number, and not the message type.

Behavior

  • Search and Journal/GetJournal/LastJournalMessage save the text and fields of a single entry in the current script. New messages do not replace these fields. If a record is evicted from a limited journal, the retained fields remain, but LineIndex/GetFoundedTextIndex return -1. The next search or read selects another entry; an unsuccessful search, an invalid index, and clearing through this script reset the selection.
  • First check the search result > 0. The value of 0 does not in itself confirm success. Edge spaces and empty alternatives are removed before numbering.
  • https://forum.yoko.com.ua/viewtopic.php?p=27633 ; . In this adaptation, ID stands for alternative, the author and type fields are available separately via LineID/LineMsgType.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.

object? result = UO.FoundedParamId();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));

1. Two outcomes - direct script

Parameters and execution flow:

  • success is an alternative to 0, failed is an alternative to 1. Search success is checked separately.
  • This is text analysis, not confirmation of a game operation by the server.
if (Truth(UO.InJournal("success|failed") > 0))
{
    var outcome = UO.FoundedParamId();
    if (Truth(outcome == 0))
    {
        UO.Print("Success text");
    }
    else
    {
        UO.Print("Failure text");
    }
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

2. Three selections without case - script function

Parameters and execution flow:

  • -1 disables the register. The results 0, 1, 2 correspond to the order of the alternatives.
  • If the string contains multiple options, the first matching pattern in order is returned.
return  RunScenario();
 object? RunScenario()
{
    if (Truth(UO.InJournal("mining|ore|empty", -1) > 0))
    {
        var kind = UO.FoundedParamId();
        UO.Print("Alternative: " + Convert.ToString(kind));
    }

    return null;
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

3. Save Outcome Before Reading Another Line - Script Class

Parameters and execution flow:

  • Journal(0) changes the choice and resets ID alternatives, so the outcome is stored in advance.
  • The new getter call after Journal no longer describes the previous pattern.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        if (Truth(UO.InJournal("success|failed") > 0))
        {
            var outcome = UO.FoundedParamId();
            var latest = UO.Journal(0);
            UO.Print("Saved outcome: " + Convert.ToString(outcome));
        }

        return null;
    }

    bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.FoundedParamId() — UO.FoundedParamId()

Parameters: No parameters.

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "foundedparamid":

                    return new InjectionValue(foundedTextId >= 0 ? foundedTextId : 0);

UO.GetFoundedText

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

string UO.GetFoundedText();

Returns the text of the selected log entry.

Parameters

There are no parameters.

Return value

string — text of the selected entry; empty line with no selection. Blank text is acceptable for an existing entry.

Behavior

  • Search and Journal/GetJournal/LastJournalMessage save the text and fields of a single entry in the current script. New messages do not replace these fields. If a record is evicted from a limited journal, the retained fields remain, but LineIndex/GetFoundedTextIndex return -1. The next search or read selects another entry; an unsuccessful search, an invalid index, and clearing through this script reset the selection.
  • Getter does not run a search and select the newest row. Null/empty values ​​may be valid data; consider the search result.
  • Primary directory: https://forum.yoko.com.ua/viewtopic.php?p=27633.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.

var result = UO.GetFoundedText();
UO.Print("GetFoundedText: " + Convert.ToString(result));

1. Read field after search - direct script

Parameters and execution flow:

  • notice — an example of the searched text. Getter is called without parameters only after a successful search.
  • string — text of the selected entry; empty line with no selection. Blank text is acceptable for an existing entry.
if (Truth(UO.InJournal("notice") > 0))
{
    var value = UO.GetFoundedText();
    UO.Print("Text: " + Convert.ToString(value));
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

2. Read field of a specific line - script function

Parameters and execution flow:

  • Journal(0) selects a new entry. index and value are read before Print.
  • The index check allows you to distinguish between the absence of a record and a valid null or empty field.
return  RunScenario();
 object? RunScenario()
{
    var text = UO.Journal(0);
    var index = UO.LineIndex();
    var value = UO.GetFoundedText();
    if (Truth(index >= 0))
    {
        UO.Print(Convert.ToString(value));
    }

    return null;
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

3. Save Field Before Next Lookup - Script Class

Parameters and execution flow:

  • The first search selects success, the second replaces or resets the selection. saved already contains a copy of the required field.
  • The saved var does not change with new searches, cleanups, or messages.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        if (Truth(UO.InJournal("success") > 0))
        {
            var saved = UO.GetFoundedText();
            var nextMatch = UO.InJournal("failed");
            UO.Print("Saved: " + Convert.ToString(saved));
        }

        return null;
    }

    bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.GetFoundedText() — UO.GetFoundedText()

Parameters: No parameters.

Result: string / String.

During a call:

Internal implementation code; this is not a standalone script.

public string GetFoundedText() => selectedJournalEntry?.Text ?? string.Empty;

UO.GetFoundedTextColor

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

string UO.GetFoundedTextColor();

Returns the color of the selected log entry.

Parameters

There are no parameters.

Return value

string — UO hue in 0x0044 format (4 hex digits). No choice - 0x0000; hue=0 is also acceptable for a message. This is not RGB.

Behavior

  • Search and Journal/GetJournal/LastJournalMessage save the text and fields of a single entry in the current script. New messages do not replace these fields. If a record is evicted from a limited journal, the retained fields remain, but LineIndex/GetFoundedTextIndex return -1. The next search or read selects another entry; an unsuccessful search, an invalid index, and clearing through this script reset the selection.
  • Getter does not run a search and select the newest row. Null/empty values ​​may be valid data; consider the search result.
  • Primary directory: https://forum.yoko.com.ua/viewtopic.php?p=27633.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.

var result = UO.GetFoundedTextColor();
UO.Print("GetFoundedTextColor: " + Convert.ToString(result));

1. Read field after search - direct script

Parameters and execution flow:

  • notice — an example of the searched text. Getter is called without parameters only after a successful search.
  • string — UO hue in 0x0044 format (4 hex digits). No choice - 0x0000; hue=0 is also acceptable for a message. This is not RGB.
if (Truth(UO.InJournal("notice") > 0))
{
    var value = UO.GetFoundedTextColor();
    UO.Print("Hue: " + Convert.ToString(value));
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

2. Read field of a specific line - script function

Parameters and execution flow:

  • Journal(0) selects a new entry. index and value are read before Print.
  • The index check allows you to distinguish between the absence of a record and a valid null or empty field.
return  RunScenario();
 object? RunScenario()
{
    var text = UO.Journal(0);
    var index = UO.LineIndex();
    var value = UO.GetFoundedTextColor();
    if (Truth(index >= 0))
    {
        UO.Print(Convert.ToString(value));
    }

    return null;
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

3. Save Field Before Next Lookup - Script Class

Parameters and execution flow:

  • The first search selects success, the second replaces or resets the selection. saved already contains a copy of the required field.
  • The saved var does not change with new searches, cleanups, or messages.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        if (Truth(UO.InJournal("success") > 0))
        {
            var saved = UO.GetFoundedTextColor();
            var nextMatch = UO.InJournal("failed");
            UO.Print("Saved: " + Convert.ToString(saved));
        }

        return null;
    }

    bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.GetFoundedTextColor() — UO.GetFoundedTextColor()

Parameters: No parameters.

Result: string / String.

During a call:

Internal implementation code; this is not a standalone script.

public string GetFoundedTextColor() => selectedJournalEntry != null ? $"0x{selectedJournalEntry.Color:X4}" : "0x0000";

UO.GetFoundedTextID

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

int UO.GetFoundedTextID();

Returns the number of the matched search pattern alternative.

Parameters

There are no parameters.

Return value

int - index from 0 in the list of non-empty alternatives through |: success|failed gives 0 for success and 1 for failed. If there are several suitable alternatives, the first one in the template is taken. Without a match or after a direct Journal also 0. This is not the author's serial, not the line number, and not the message type.

Behavior

  • Search and Journal/GetJournal/LastJournalMessage save the text and fields of a single entry in the current script. New messages do not replace these fields. If a record is evicted from a limited journal, the retained fields remain, but LineIndex/GetFoundedTextIndex return -1. The next search or read selects another entry; an unsuccessful search, an invalid index, and clearing through this script reset the selection.
  • First check the search result > 0. The value of 0 does not in itself confirm success. Edge spaces and empty alternatives are removed before numbering.
  • https://forum.yoko.com.ua/viewtopic.php?p=27633 ; . In this adaptation, ID stands for alternative, the author and type fields are available separately via LineID/LineMsgType.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.

var result = UO.GetFoundedTextID();
UO.Print("GetFoundedTextID: " + Convert.ToString(result));

1. Two outcomes - direct script

Parameters and execution flow:

  • success is an alternative to 0, failed is an alternative to 1. Search success is checked separately.
  • This is text analysis, not confirmation of a game operation by the server.
if (Truth(UO.InJournal("success|failed") > 0))
{
    var outcome = UO.GetFoundedTextID();
    if (Truth(outcome == 0))
    {
        UO.Print("Success text");
    }
    else
    {
        UO.Print("Failure text");
    }
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

2. Three selections without case - script function

Parameters and execution flow:

  • -1 disables the register. The results 0, 1, 2 correspond to the order of the alternatives.
  • If the string contains multiple options, the first matching pattern in order is returned.
return  RunScenario();
 object? RunScenario()
{
    if (Truth(UO.InJournal("mining|ore|empty", -1) > 0))
    {
        var kind = UO.GetFoundedTextID();
        UO.Print("Alternative: " + Convert.ToString(kind));
    }

    return null;
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

3. Save Outcome Before Reading Another Line - Script Class

Parameters and execution flow:

  • Journal(0) changes the choice and resets ID alternatives, so the outcome is stored in advance.
  • The new getter call after Journal no longer describes the previous pattern.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        if (Truth(UO.InJournal("success|failed") > 0))
        {
            var outcome = UO.GetFoundedTextID();
            var latest = UO.Journal(0);
            UO.Print("Saved outcome: " + Convert.ToString(outcome));
        }

        return null;
    }

    bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.GetFoundedTextID() — UO.GetFoundedTextID()

Parameters: No parameters.

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int GetFoundedTextID() => foundedTextId >= 0 ? foundedTextId : 0;

UO.GetFoundedTextIndex

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

int UO.GetFoundedTextIndex();

Returns the current index of the selected entry, if it is still stored in the log.

Parameters

There are no parameters.

Return value

int is the current index from 0 (newest row). -1 means that there is no choice or the selected entry has already been deleted/preempted. This is not the result of InJournal: 1 does not need to be subtracted from the index.

Behavior

  • Search and Journal/GetJournal/LastJournalMessage save the text and fields of a single entry in the current script. New messages do not replace these fields. If a record is evicted from a limited journal, the retained fields remain, but LineIndex/GetFoundedTextIndex return -1. The next search or read selects another entry; an unsuccessful search, an invalid index, and clearing through this script reset the selection.
  • The index is recalculated based on the identity of the record. New messages increase it. The old stored index is not constant ID; for text, GetFoundedText is safer.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.

var result = UO.GetFoundedTextIndex();
UO.Print("GetFoundedTextIndex: " + Convert.ToString(result));

1. Index of the found record - direct script

Parameters and execution flow:

  • Getter without arguments reads the current script's selection. 0 — new line, -1 — no line in the current buffer.
  • The text is taken from the saved entry so that new messages do not replace it.
if (Truth(UO.InJournal("notice") > 0))
{
    var index = UO.GetFoundedTextIndex();
    var text = UO.GetFoundedText();
    UO.Print(Convert.ToString(index) + ": " + text);
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

2. Check Forward Read - Script Function

Parameters and execution flow:

  • Journal(0) selects the last entry; the check excludes an empty log.
  • Empty text is allowed for a valid entry.
return  RunScenario();
 object? RunScenario()
{
    var text = UO.Journal(0);
    if (Truth(UO.GetFoundedTextIndex() >= 0))
    {
        UO.Print(text);
    }

    return null;
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

3. Update Index After Waiting - Script Class

Parameters and execution flow:

  • Waiting 100 ms allows new messages to arrive. after finds the same entry again.
  • after may increase or become -1 when removed; GetFoundedText still contains the saved text.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        if (Truth(UO.InJournal("needle") > 0))
        {
            var before = UO.GetFoundedTextIndex();
            UO.Wait(100);
            var after = UO.GetFoundedTextIndex();
            UO.Print(Convert.ToString(before) + " -> " + Convert.ToString(after));
        }

        return null;
    }

    bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.GetFoundedTextIndex() — UO.GetFoundedTextIndex()

Parameters: No parameters.

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int GetFoundedTextIndex() => selectedJournalEntry != null && bridge is IApiJournalReader reader

            ? reader.FindJournalEntryIndex(selectedJournalEntry.Identity) : foundedTextIndex;

UO.GetFoundedTextSerial

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

string UO.GetFoundedTextSerial();

Returns serial of the author of the selected log entry.

Parameters

There are no parameters.

Return value

string — serial of the author in the format 0x00001234 (8 hex digits). No choice - 0x00000000. This is not an item type or a journal index.

Behavior

  • Search and Journal/GetJournal/LastJournalMessage save the text and fields of a single entry in the current script. New messages do not replace these fields. If a record is evicted from a limited journal, the retained fields remain, but LineIndex/GetFoundedTextIndex return -1. The next search or read selects another entry; an unsuccessful search, an invalid index, and clearing through this script reset the selection.
  • Getter does not run a search and select the newest row. Null/empty values ​​may be valid data; consider the search result.
  • Primary directory: https://forum.yoko.com.ua/viewtopic.php?p=27633.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.

var result = UO.GetFoundedTextSerial();
UO.Print("GetFoundedTextSerial: " + Convert.ToString(result));

1. Read field after search - direct script

Parameters and execution flow:

  • notice — an example of the searched text. Getter is called without parameters only after a successful search.
  • string — serial of the author in the format 0x00001234 (8 hex digits). No choice - 0x00000000. This is not an item type or a journal index.
if (Truth(UO.InJournal("notice") > 0))
{
    var value = UO.GetFoundedTextSerial();
    UO.Print("Speaker serial: " + Convert.ToString(value));
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

2. Read field of a specific line - script function

Parameters and execution flow:

  • Journal(0) selects a new entry. index and value are read before Print.
  • The index check allows you to distinguish between the absence of a record and a valid null or empty field.
return  RunScenario();
 object? RunScenario()
{
    var text = UO.Journal(0);
    var index = UO.LineIndex();
    var value = UO.GetFoundedTextSerial();
    if (Truth(index >= 0))
    {
        UO.Print(Convert.ToString(value));
    }

    return null;
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

3. Save Field Before Next Lookup - Script Class

Parameters and execution flow:

  • The first search selects success, the second replaces or resets the selection. saved already contains a copy of the required field.
  • The saved var does not change with new searches, cleanups, or messages.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        if (Truth(UO.InJournal("success") > 0))
        {
            var saved = UO.GetFoundedTextSerial();
            var nextMatch = UO.InJournal("failed");
            UO.Print("Saved: " + Convert.ToString(saved));
        }

        return null;
    }

    bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.GetFoundedTextSerial() — UO.GetFoundedTextSerial()

Parameters: No parameters.

Result: string / String.

During a call:

Internal implementation code; this is not a standalone script.

public string GetFoundedTextSerial() => selectedJournalEntry != null

            ? $"0x{unchecked((uint)selectedJournalEntry.Serial):X8}" : "0x00000000";

UO.GetFoundedTextTimer

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

int UO.GetFoundedTextTimer();

Returns the millisecond timestamp of the selected log entry.

Parameters

There are no parameters.

Return value

int — recording moment in milliseconds from the start of runtime, compatible with Now(). Entries before the start give 0. Without choice also 0; an incorrect calendar mark gives -1. It is not past tense or tenths of a second UO.Timer().

Behavior

  • Search and Journal/GetJournal/LastJournalMessage save the text and fields of a single entry in the current script. New messages do not replace these fields. If a record is evicted from a limited journal, the retained fields remain, but LineIndex/GetFoundedTextIndex return -1. The next search or read selects another entry; an unsuccessful search, an invalid index, and clearing through this script reset the selection.
  • Getter does not run a search and select the newest row. Null/empty values ​​may be valid data; consider the search result.
  • Primary directory: https://forum.yoko.com.ua/viewtopic.php?p=27633.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.

var result = UO.GetFoundedTextTimer();
UO.Print("GetFoundedTextTimer: " + Convert.ToString(result));

1. Read field after search - direct script

Parameters and execution flow:

  • notice — an example of the searched text. Getter is called without parameters only after a successful search.
  • int — recording moment in milliseconds from the start of runtime, compatible with Now(). Entries before the start give 0. Without choice also 0; an incorrect calendar mark gives -1. It is not past tense or tenths of a second UO.Timer().
if (Truth(UO.InJournal("notice") > 0))
{
    var value = UO.GetFoundedTextTimer();
    UO.Print("Timestamp ms: " + Convert.ToString(value));
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

2. Read field of a specific line - script function

Parameters and execution flow:

  • Journal(0) selects a new entry. index and value are read before Print.
  • The index check allows you to distinguish between the absence of a record and a valid null or empty field.
return  RunScenario();
 object? RunScenario()
{
    var text = UO.Journal(0);
    var index = UO.LineIndex();
    var value = UO.GetFoundedTextTimer();
    if (Truth(index >= 0))
    {
        UO.Print(Convert.ToString(value));
    }

    return null;
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

3. Save Field Before Next Lookup - Script Class

Parameters and execution flow:

  • The first search selects success, the second replaces or resets the selection. saved already contains a copy of the required field.
  • The saved var does not change with new searches, cleanups, or messages.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        if (Truth(UO.InJournal("success") > 0))
        {
            var saved = UO.GetFoundedTextTimer();
            var nextMatch = UO.InJournal("failed");
            UO.Print("Saved: " + Convert.ToString(saved));
        }

        return null;
    }

    bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.GetFoundedTextTimer() — UO.GetFoundedTextTimer()

Parameters: No parameters.

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int GetFoundedTextTimer() => selectedJournalEntry != null ? JournalEntryTime(selectedJournalEntry.Timestamp) : 0;

UO.GetJournal

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

string UO.GetJournal(object? index);

Reads the text of a line at the current index and selects that entry for GetFoundedText/Line*.

Parameters

  • index - Required int - current index: 0 means the newest row, 1 means the previous one. Indexes are shifted when messages arrive. This is not a serial, not a ID variant of the pattern, and not a positive result InJournal.

Return value

string — text of the line, or an empty line if the index is incorrect/the journal is empty. An existing row can also have empty text: after reading, LineIndex >= 0 confirms that the entry has been selected. It's not the number of lines.

Behavior

  • Search and Journal/GetJournal/LastJournalMessage save the text and fields of a single entry in the current script. New messages do not replace these fields. If a record is evicted from a limited journal, the retained fields remain, but LineIndex/GetFoundedTextIndex return -1. The next search or read selects another entry; an unsuccessful search, an invalid index, and clearing through this script reset the selection.
  • Direct reading resets ID alternatives; GetFoundedTextID/FoundedParamId is followed by 0. Journal itself does not recalculate LineCount.
  • https://forum.yoko.com.ua/viewtopic.php?p=27633 ; .

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.

var result = UO.GetJournal(0);
UO.Print("GetJournal: " + Convert.ToString(result));

1. The last line and its author is a direct script

Parameters and execution flow:

  • 0 is the newest line. First, the text and author are read, then the result is displayed.
  • Print can add a message; the saved text/author refers to the previously selected entry.
var text = UO.GetJournal(0);
var author = UO.LineName();
UO.Print(author + ": " + text);

2. The previous line, if it exists, is a script function

Parameters and execution flow:

  • 1 is the previous entry, HighJournal is the maximum available index.
  • The log may change between calls. For data of a row already found, use GetFoundedText.
return  RunScenario();
 object? RunScenario()
{
    if (Truth(UO.HighJournal() >= 1))
    {
        var text = UO.GetJournal(1);
        UO.Print(text);
    }

    return null;
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

3. Distinguish empty text from no string - script class

Parameters and execution flow:

  • LineIndex=-1 means the selected entry is missing/deleted. Len(text)=0 by itself does not mean this.
  • Store the test result until the diagnostic output is added to the log.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        var text = UO.GetJournal(0);
        var index = UO.LineIndex();
        if (Truth(index < 0))
        {
            UO.Print("No record");
        }
        else
        {
            UO.Print("Text length: " + Convert.ToString(Len(text)));
        }

        return null;
    }

    int Len(object? value) => Convert.ToString(value)?.Length ?? 0;
    bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.GetJournal(index) — UO.GetJournal(Integer)

Parameters: index (Integer)

Result: string / String.

During a call:

Internal implementation code; this is not a standalone script.

public string GetJournalText(int index)

        {

            SelectJournalEntry(ReadJournalSnapshot(index));

            return selectedJournalEntry?.Text ?? string.Empty;

        }

UO.GetJournalColor

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

string UO.GetJournalColor(object? index);

Reads the hue field of a row at the current index without changing the selected entry.

Parameters

  • index - Required int - current index: 0 means the newest row, 1 means the previous one. Indexes are shifted when messages arrive. This is not a serial, not a ID variant of the pattern, and not a positive result InJournal.

Return value

string — UO hue like 0x0044; if the index 0x0000 is incorrect. This is not RGB.

Behavior

  • Each call reads the current position. For consistent text and fields of the same record, first Journal(index), then GetFoundedText/Line*. Null values ​​may be real data.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.

var result = UO.GetJournalColor(0);
UO.Print("GetJournalColor: " + Convert.ToString(result));

1. New record field - direct script

Parameters and execution flow:

  • 0 is the index of the new line. The presence of a buffer is checked.
  • string — UO hue like 0x0044; if the index 0x0000 is incorrect. This is not RGB.
if (Truth(UO.HighJournal() >= 0))
{
    var value = UO.GetJournalColor(0);
    UO.Print(Convert.ToString(value));
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

2. Previous Record Field - Script Function

Parameters and execution flow:

  • 1 is the previous line, not serial=1.
  • The entry GetFoundedText/Line* selected by the search is not changed.
return  RunScenario();
 object? RunScenario()
{
    if (Truth(UO.HighJournal() >= 1))
    {
        var value = UO.GetJournalColor(1);
        UO.Print(Convert.ToString(value));
    }

    return null;
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

3. Save value before next action - Script Class

Parameters and execution flow:

  • value copies the field at the time of the call. Waiting does not update the variable.
  • To read the current line 0 again, call the command again; this may already be another entry.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        var value = UO.GetJournalColor(0);
        UO.Wait(100);
        UO.Print("Saved value: " + Convert.ToString(value));
        return null;
    }
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.GetJournalColor(index) — UO.GetJournalColor(Integer)

Parameters: index (Integer)

Result: string / String.

During a call:

Internal implementation code; this is not a standalone script.

public string JournalColor(int index) => bridge.JournalColor(index);

UO.GetJournalSerial

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

string UO.GetJournalSerial(object? index);

Reads the serial field of a row at the current index without changing the selected entry.

Parameters

  • index - Required int - current index: 0 means the newest row, 1 means the previous one. Indexes are shifted when messages arrive. This is not a serial, not a ID variant of the pattern, and not a positive result InJournal.

Return value

string — author's serial as 0x00001234; if the index 0x00000000 is incorrect.

Behavior

  • Each call reads the current position. For consistent text and fields of the same record, first Journal(index), then GetFoundedText/Line*. Null values ​​may be real data.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.

var result = UO.GetJournalSerial(0);
UO.Print("GetJournalSerial: " + Convert.ToString(result));

1. New record field - direct script

Parameters and execution flow:

  • 0 is the index of the new line. The presence of a buffer is checked.
  • string — author's serial as 0x00001234; if the index 0x00000000 is incorrect.
if (Truth(UO.HighJournal() >= 0))
{
    var value = UO.GetJournalSerial(0);
    UO.Print(Convert.ToString(value));
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

2. Previous Record Field - Script Function

Parameters and execution flow:

  • 1 is the previous line, not serial=1.
  • The entry GetFoundedText/Line* selected by the search is not changed.
return  RunScenario();
 object? RunScenario()
{
    if (Truth(UO.HighJournal() >= 1))
    {
        var value = UO.GetJournalSerial(1);
        UO.Print(Convert.ToString(value));
    }

    return null;
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

3. Save value before next action - Script Class

Parameters and execution flow:

  • value copies the field at the time of the call. Waiting does not update the variable.
  • To read the current line 0 again, call the command again; this may already be another entry.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        var value = UO.GetJournalSerial(0);
        UO.Wait(100);
        UO.Print("Saved value: " + Convert.ToString(value));
        return null;
    }
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.GetJournalSerial(index) — UO.GetJournalSerial(Integer)

Parameters: index (Integer)

Result: string / String.

During a call:

Internal implementation code; this is not a standalone script.

public string JournalSerial(int index) => bridge.JournalSerial(index);

UO.HighJournal

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

dynamic UO.HighJournal();

Returns the maximum available log index.

Parameters

There are no parameters.

Return value

int: -1 when the journal is empty; otherwise the number of stored records minus 1 is the index of the oldest available record. Journal/GetJournal use zero indexes from new record to old; a positive result InJournal uses a different, single count.

Behavior

  • New messages and cleaning change the boundaries. The order here is Journal(0) from new entry to old entry.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.

object? result = UO.HighJournal();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));

1. Check for entries - direct script

Parameters and execution flow:

  • A negative bound means an empty buffer.
  • If the buffer is not empty, Journal(0) reads a new entry.
if (Truth(UO.HighJournal() >= 0))
{
    var text = UO.Journal(0);
    UO.Print(text);
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

2. Number of available lines - script function

Parameters and execution flow:

  • HighJournal=-1 when the log is empty, so total=0. LowJournal describes the lower bound, not the number of lines.
  • This is the total number of locally stored rows; LineCount refers to the last search.
return  RunScenario();
 object? RunScenario()
{
    var total = UO.HighJournal() + 1;
    UO.Print("Rows: " + Convert.ToString(total));
    return null;
}

3. Read Line on Border - Script Class

Parameters and execution flow:

  • index is passed directly to Journal, without subtracting one.
  • The index may shift with incoming messages; The buffer is not frozen between calls.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        var index = UO.HighJournal();
        if (Truth(index >= 0))
        {
            var text = UO.Journal(index);
            UO.Print(text);
        }

        return null;
    }

    bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.HighJournal() — UO.HighJournal()

Parameters: No parameters.

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "highjournal": return new InjectionValue(bridge.JournalEntryCount() == 0 ? -1 : bridge.JournalEntryCount() - 1);

UO.InJournal

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

int UO.InJournal(object? pattern);
int UO.InJournal(object? pattern, object? maxLinesOrIgnoreCase);
int UO.InJournal(object? pattern, object? serial, object? color);
int UO.InJournal(object? pattern, object? serial, object? color, object? startTime);
int UO.InJournal(object? pattern, object? serial, object? color, object? startTime, object? endTime);
int UO.InJournal(object? pattern, object? serial, object? color, object? startTime, object? endTime, object? newestOnly);
int UO.InJournal(object? pattern, object? serial, object? color, object? startTime, object? endTime, object? newestOnly, object? caseSensitive);

Searches for a message in the local log and saves the found record with its fields.

Parameters

  • pattern — The searched substring or several alternatives via |, for example success|failed. Spaces at the edges of each alternative are removed, empty alternatives are skipped. This is plain text, not a regular expression. Use a non-empty template.
  • maxLinesOrIgnoreCase — Only the form of two arguments: -1 — the entire available log, not case sensitive; 0 - do not check any lines; positive number - check no more than this number of last lines, case sensitive. Other negative values ​​are limited to 0.
  • serial — The third and subsequent arguments include the extended form. The second argument of this form is the numeric serial of the message author, not the graphic/type. -1 disables the filter; 0 selects serial=0. A hex string containing a number is also converted to a number; object alias name is not allowed here.
  • color — The third argument of the extended form is numeric UO hue; -1 or 0xFFFF disables the filter. 0 selects hue=0. This is not RGB.
  • startTime — Optional start label Now(), int in milliseconds. Given a positive endTime, the value startTime=0 means the start of execution. If both marks are missing/non-positive, there is no time filter.
  • endTime — Optional end label Now(), int in milliseconds. Absent or 0 - current time. The order of the positive boundaries is not significant. The future label is limited to the current time.
  • newestOnly - Optional bool, default false. true stops searching after the first match; LineCount then 0 or 1. false counts all matching lines, still choosing the newest one.
  • caseSensitive - Optional bool extended form, default false. true is case sensitive. A pattern-only form, on the other hand, is always case-sensitive.

Return value

int: 0 – there is no suitable line; a positive number is the position of the newest matching entry, counting from the end of the entire log, starting with 1. This is not the number of matches or the pattern alternative number. For the zero index use LineIndex/GetFoundedTextIndex, for the number of matches use LineCount, for the alternative number use GetFoundedTextID. Subsequent new messages may change the index, but the saved fields of the selected record remain available.

Behavior

  • Search and Journal/GetJournal/LastJournalMessage save the text and fields of a single entry in the current script. New messages do not replace these fields. If a record is evicted from a limited journal, the retained fields remain, but LineIndex/GetFoundedTextIndex return -1. The next search or read selects another entry; an unsuccessful search, an invalid index, and clearing through this script reset the selection.
  • The search does not expect new text. The empty pattern in the current InJournal matches any string, but does not give ID an alternative; to check for strings, use HighJournal/LowJournal.
  • The two argument form specifies limit/case, not serial. For serial, be sure to also pass color. A one-argument SetJournalLine can limit the search area.
  • https://forum.yoko.com.ua/viewtopic.php?p=27633 ; .

Now() provides the host of the current execution: this is an integer number of milliseconds of the same native clock that the log uses. Do not replace it with Environment.TickCount, Unix time, or your own Stopwatch: the origin will be different. In a normal .cs/.csproj program, call context.Now() on the passed CSharpScriptGlobals.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.

var result = UO.InJournal("You see");
UO.Print("InJournal: " + Convert.ToString(result));

1. Check message case sensitive - direct script

Parameters and execution flow:

  • pattern=You see is a substring, case is important. found=0 means absent.
  • The text is copied from the found entry; the arrival of a new message does not replace it.
var found = UO.InJournal("You see");
if (Truth(found > 0))
{
    var text = UO.GetFoundedText();
    UO.Print(text);
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

2. Multiple selections are case insensitive - script function

Parameters and execution flow:

  • The second argument -1 removes the line limit and disables case sensitivity.
  • outcome=0 for success, 1 for failed; this is the number of the alternative, not the speaker's ID.
return  RunScenario();
 object? RunScenario()
{
    var found = UO.InJournal("success|failed", -1);
    if (Truth(found > 0))
    {
        var outcome = UO.GetFoundedTextID();
        UO.Print("Alternative: " + Convert.ToString(outcome));
    }

    return null;
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

3. Check only last twenty lines - script class

Parameters and execution flow:

  • 20 - maximum lines to be checked, case is important. matches - the number of matching lines in the checked area.
  • found contains the position plus 1, not matches. Writing diagnostic text can also add to the log.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        var found = UO.InJournal("bank", 20);
        var matches = UO.LineCount();
        UO.Print("Matches: " + Convert.ToString(matches));
        return null;
    }
}

4. All advanced options - direct script

Parameters and execution flow:

  • serial=0x00001234 — author’s example, color=0x0044 — hue. Replace with real values. started/endTime — millisecond marks.
  • true stops the search at the first line; false is not case sensitive. Waiting 350 ms separately, InJournal does not wait itself.
var started = Now();
UO.Wait(350);
var found = UO.InJournal("hello", 0x00001234, 0x0044, started, Now(), true, false);
if (Truth(found > 0))
{
    UO.Print(UO.GetFoundedText());
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

5. Filter by time only - script function

Parameters and execution flow:

  • serial=-1 and color=-1 disable both filters. Two markers limit the time.
  • newestOnly and caseSensitive omitted: false and false. Without a match, 0 is returned.
return  RunScenario();
 object? RunScenario()
{
    var started = Now();
    UO.Wait(100);
    var found = UO.InJournal("notice", -1, -1, started, Now());
    if (Truth(found == 0))
    {
        UO.Print("No matching message");
    }

    return null;
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.InJournal(pattern) — UO.InJournal(Any)

Parameters: pattern (Any/String)

Result: int / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "injournal": return new InjectionValue(InJournal(Text(0)));

UO.InJournal(pattern) — UO.InJournal(String)

Parameters: pattern (Any/String)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int InJournal(string pattern)

            => InJournalCore(pattern, -1, ignoreCase: false);

UO.InJournal(pattern, maxLinesOrIgnoreCase) — UO.InJournal(String,Integer)

Parameters: pattern (String), maxLinesOrIgnoreCase (Integer)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int InJournal(string pattern, int maxLinesOrIgnoreCase)

            => InJournalCore(pattern,

                maxLinesOrIgnoreCase == -1 ? -1 : Math.Max(0, maxLinesOrIgnoreCase),

                ignoreCase: maxLinesOrIgnoreCase == -1);

UO.InJournal(pattern, serial, color) — UO.InJournal(Any,Any,Any)

Parameters: pattern (Any), serial (Any), color (Any)

Result: int / Integer.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => new InjectionValue(CompactInJournal(values))

UO.InJournal(pattern, serial, color, startTime) — UO.InJournal(Any,Any,Any,Any)

Parameters: pattern (Any), serial (Any), color (Any), startTime (Any)

Result: int / Integer.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => new InjectionValue(CompactInJournal(values))

UO.InJournal(pattern, serial, color, startTime, endTime) — UO.InJournal(Any,Any,Any,Any,Any)

Parameters: pattern (Any), serial (Any), color (Any), startTime (Any), endTime (Any)

Result: int / Integer.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => new InjectionValue(CompactInJournal(values))

UO.InJournal(pattern, serial, color, startTime, endTime, newestOnly) — UO.InJournal(Any,Any,Any,Any,Any,Any)

Parameters: pattern (Any), serial (Any), color (Any), startTime (Any), endTime (Any), newestOnly (Any)

Result: int / Integer.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => new InjectionValue(CompactInJournal(values))

UO.InJournal(pattern, serial, color, startTime, endTime, newestOnly, caseSensitive) — UO.InJournal(Any,Any,Any,Any,Any,Any,Any)

Parameters: pattern (Any), serial (Any), color (Any), startTime (Any), endTime (Any), newestOnly (Any), caseSensitive (Any)

Result: int / Integer.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => new InjectionValue(CompactInJournal(values))

UO.InJournalBetweenTimes

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

int UO.InJournalBetweenTimes(object? pattern, object? startTime);
int UO.InJournalBetweenTimes(object? pattern, object? startTime, object? endTime);
int UO.InJournalBetweenTimes(object? pattern, object? startTime, object? endTime, object? limit);

Searches for a string between two execution timestamps and stores the newest matching entry.

Parameters

  • pattern — The searched substring or several alternatives via |, for example success|failed. Spaces at the edges of each alternative are removed, empty alternatives are skipped. This is plain text, not a regular expression. Use a non-empty template.
  • startTime — Mandatory label Now(): int milliseconds from the start of runtime. 0 - start of execution. This is not the age of the record or the fractional date LineTime.
  • endTime — Optional Now() end label. If omitted or non-positive, the current time is used. Positive boundaries can be conveyed in reverse order; the future boundary is limited to the current time.
  • limit - Optional fourth argument: -1 - no limit and case insensitive; positive number — maximum lines in the interval, case sensitive; 0 and negative values ​​except -1 - do not check strings.

Return value

int: 0 – there is no suitable line; a positive number is the position of the newest matching entry, counting from the end of the entire log, starting with 1. This is not the number of matches or the pattern alternative number. For the zero index use LineIndex/GetFoundedTextIndex, for the number of matches use LineCount, for the alternative number use GetFoundedTextID. Subsequent new messages may change the index, but the saved fields of the selected record remain available.

Behavior

  • Search and Journal/GetJournal/LastJournalMessage save the text and fields of a single entry in the current script. New messages do not replace these fields. If a record is evicted from a limited journal, the retained fields remain, but LineIndex/GetFoundedTextIndex return -1. The next search or read selects another entry; an unsuccessful search, an invalid index, and clearing through this script reset the selection.
  • Forms with two or three arguments are case sensitive. Borders are included. Calculating the interval does not pause the script.
  • Here, pass entire labels to Now(). LineTime returns another unit. Primary directory: .

Now() provides the host of the current execution: this is an integer number of milliseconds of the same native clock that the log uses. Do not replace it with Environment.TickCount, Unix time, or your own Stopwatch: the origin will be different. In a normal .cs/.csproj program, call context.Now() on the passed CSharpScriptGlobals.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.

var result = UO.InJournalBetweenTimes("You see", 0, Now());
UO.Print("InJournalBetweenTimes: " + Convert.ToString(result));

1. Check messages after action - direct script

Parameters and execution flow:

  • started is saved until UseSkill. endTime omitted - up to the current time; hidden is an example of server-side text.
  • Case is taken into account. The message does not prove the current status; UO.Hidden() reads the character's state.
var started = Now();
UO.UseSkill("Hiding");
UO.Wait(500);
if (Truth(UO.InJournalBetweenTimes("hidden", started) > 0))
{
    UO.Print(UO.GetFoundedText());
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

2. Fixed interval from start - script function

Parameters and execution flow:

  • startTime=0 — start of execution; ended — saved ending label in milliseconds.
  • New messages after ended are not included. Old records before runtime are also outside the interval.
return  RunScenario();
 object? RunScenario()
{
    var ended = Now();
    var found = UO.InJournalBetweenTimes("notice", 0, ended);
    UO.Print("Search result: " + Convert.ToString(found));
    return null;
}

3. Interval and Case Insensitive Alternatives - Script Class

Parameters and execution flow:

  • The last one -1 removes the line limit and disables case. The third argument is the end label, not the delay.
  • Result ID: 0 for success, 1 for failed. Checking found > 0 is required.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        var started = Now();
        UO.Wait(350);
        var found = UO.InJournalBetweenTimes("success|failed", started, Now(), -1);
        if (Truth(found > 0))
        {
            UO.Print(Convert.ToString(UO.GetFoundedTextID()));
        }

        return null;
    }

    bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
    private int Now() => global::ClassicUO.CSharp.CSharpScriptContext.Current.Now();
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.InJournalBetweenTimes(pattern, startTime) — UO.InJournalBetweenTimes(Any,Any)

Parameters: pattern (Any/String), startTime (Any/Integer)

Result: int / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "injournalbetweentimes":

                    if (arguments.Length > 3)

                        return new InjectionValue(InJournalBetweenTimes(Text(0), Arg(1), Arg(2), Arg(3)));

                    if (arguments.Length > 2)

                        return new InjectionValue(InJournalBetweenTimes(Text(0), Arg(1), Arg(2)));

                    return new InjectionValue(InJournalBetweenTimes(Text(0), Arg(1)));

UO.InJournalBetweenTimes(pattern, startTime) — UO.InJournalBetweenTimes(String,Integer)

Parameters: pattern (Any/String), startTime (Any/Integer)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int InJournalBetweenTimes(string pattern, int startTime)

            => InJournalBetweenTimesCore(pattern, startTime, CurrentJournalTime(), -1, ignoreCase: false);

UO.InJournalBetweenTimes(pattern, startTime, endTime) — UO.InJournalBetweenTimes(Any,Any,Any)

Parameters: pattern (Any/String), startTime (Any/Integer), endTime (Any/Integer)

Result: int / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "injournalbetweentimes":

                    if (arguments.Length > 3)

                        return new InjectionValue(InJournalBetweenTimes(Text(0), Arg(1), Arg(2), Arg(3)));

                    if (arguments.Length > 2)

                        return new InjectionValue(InJournalBetweenTimes(Text(0), Arg(1), Arg(2)));

                    return new InjectionValue(InJournalBetweenTimes(Text(0), Arg(1)));

UO.InJournalBetweenTimes(pattern, startTime, endTime) — UO.InJournalBetweenTimes(String,Integer,Integer)

Parameters: pattern (Any/String), startTime (Any/Integer), endTime (Any/Integer)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int InJournalBetweenTimes(string pattern, int startTime, int endTime)

            => InJournalBetweenTimesCore(pattern, startTime, endTime, -1, ignoreCase: false);

UO.InJournalBetweenTimes(pattern, startTime, endTime, limit) — UO.InJournalBetweenTimes(Any,Any,Any,Any)

Parameters: pattern (Any/String), startTime (Any/Integer), endTime (Any/Integer), limit (Any/Integer)

Result: int / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "injournalbetweentimes":

                    if (arguments.Length > 3)

                        return new InjectionValue(InJournalBetweenTimes(Text(0), Arg(1), Arg(2), Arg(3)));

                    if (arguments.Length > 2)

                        return new InjectionValue(InJournalBetweenTimes(Text(0), Arg(1), Arg(2)));

                    return new InjectionValue(InJournalBetweenTimes(Text(0), Arg(1)));

UO.InJournalBetweenTimes(pattern, startTime, endTime, limit) — UO.InJournalBetweenTimes(String,Integer,Integer,Integer)

Parameters: pattern (Any/String), startTime (Any/Integer), endTime (Any/Integer), limit (Any/Integer)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int InJournalBetweenTimes(string pattern, int startTime, int endTime, int limit)

            => InJournalBetweenTimesCore(pattern, startTime, endTime,

                limit == -1 ? -1 : Math.Max(0, limit), ignoreCase: limit == -1);

UO.Journal

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

string UO.Journal(object? index);

Reads the text of a line at the current index and selects that entry for GetFoundedText/Line*.

Parameters

  • index - Required int - current index: 0 means the newest row, 1 means the previous one. Indexes are shifted when messages arrive. This is not a serial, not a ID variant of the pattern, and not a positive result InJournal.

Return value

string — text of the line, or an empty line if the index is incorrect/the journal is empty. An existing row can also have empty text: after reading, LineIndex >= 0 confirms that the entry has been selected. It's not the number of lines.

Behavior

  • Search and Journal/GetJournal/LastJournalMessage save the text and fields of a single entry in the current script. New messages do not replace these fields. If a record is evicted from a limited journal, the retained fields remain, but LineIndex/GetFoundedTextIndex return -1. The next search or read selects another entry; an unsuccessful search, an invalid index, and clearing through this script reset the selection.
  • Direct reading resets ID alternatives; GetFoundedTextID/FoundedParamId is followed by 0. Journal itself does not recalculate LineCount.
  • https://forum.yoko.com.ua/viewtopic.php?p=27633 ; .

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.

var result = UO.Journal(0);
UO.Print("Journal: " + Convert.ToString(result));

1. The last line and its author is a direct script

Parameters and execution flow:

  • 0 is the newest line. First, the text and author are read, then the result is displayed.
  • Print can add a message; the saved text/author refers to the previously selected entry.
var text = UO.Journal(0);
var author = UO.LineName();
UO.Print(author + ": " + text);

2. The previous line, if it exists, is a script function

Parameters and execution flow:

  • 1 is the previous entry, HighJournal is the maximum available index.
  • The log may change between calls. For data of a row already found, use GetFoundedText.
return  RunScenario();
 object? RunScenario()
{
    if (Truth(UO.HighJournal() >= 1))
    {
        var text = UO.Journal(1);
        UO.Print(text);
    }

    return null;
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

3. Distinguish empty text from no string - script class

Parameters and execution flow:

  • LineIndex=-1 means the selected entry is missing/deleted. Len(text)=0 by itself does not mean this.
  • Store the test result until the diagnostic output is added to the log.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        var text = UO.Journal(0);
        var index = UO.LineIndex();
        if (Truth(index < 0))
        {
            UO.Print("No record");
        }
        else
        {
            UO.Print("Text length: " + Convert.ToString(Len(text)));
        }

        return null;
    }

    int Len(object? value) => Convert.ToString(value)?.Length ?? 0;
    bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.Journal(index) — UO.Journal(Any)

Parameters: index (Any/Integer)

Result: string / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "journal": return new InjectionValue(GetJournalText(Arg(0)));

UO.Journal(index) — UO.Journal(Integer)

Parameters: index (Any/Integer)

Result: string / String.

During a call:

Internal implementation code; this is not a standalone script.

public string GetJournalText(int index)

        {

            SelectJournalEntry(ReadJournalSnapshot(index));

            return selectedJournalEntry?.Text ?? string.Empty;

        }

UO.JournalColor

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

string UO.JournalColor(object? index);

Reads the hue field of a row at the current index without changing the selected entry.

Parameters

  • index - Required int - current index: 0 means the newest row, 1 means the previous one. Indexes are shifted when messages arrive. This is not a serial, not a ID variant of the pattern, and not a positive result InJournal.

Return value

string — UO hue like 0x0044; if the index 0x0000 is incorrect. This is not RGB.

Behavior

  • Each call reads the current position. For consistent text and fields of the same record, first Journal(index), then GetFoundedText/Line*. Null values ​​may be real data.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.

var result = UO.JournalColor(0);
UO.Print("JournalColor: " + Convert.ToString(result));

1. New record field - direct script

Parameters and execution flow:

  • 0 is the index of the new line. The presence of a buffer is checked.
  • string — UO hue like 0x0044; if the index 0x0000 is incorrect. This is not RGB.
if (Truth(UO.HighJournal() >= 0))
{
    var value = UO.JournalColor(0);
    UO.Print(Convert.ToString(value));
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

2. Previous Record Field - Script Function

Parameters and execution flow:

  • 1 is the previous line, not serial=1.
  • The entry GetFoundedText/Line* selected by the search is not changed.
return  RunScenario();
 object? RunScenario()
{
    if (Truth(UO.HighJournal() >= 1))
    {
        var value = UO.JournalColor(1);
        UO.Print(Convert.ToString(value));
    }

    return null;
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

3. Save value before next action - Script Class

Parameters and execution flow:

  • value copies the field at the time of the call. Waiting does not update the variable.
  • To read the current line 0 again, call the command again; this may already be another entry.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        var value = UO.JournalColor(0);
        UO.Wait(100);
        UO.Print("Saved value: " + Convert.ToString(value));
        return null;
    }
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.JournalColor(index) — UO.JournalColor(Integer)

Parameters: index (Integer)

Result: string / String.

During a call:

Internal implementation code; this is not a standalone script.

public string JournalColor(int index) => bridge.JournalColor(index);

UO.JournalSerial

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

string UO.JournalSerial(object? index);

Reads the serial field of a row at the current index without changing the selected entry.

Parameters

  • index - Required int - current index: 0 means the newest row, 1 means the previous one. Indexes are shifted when messages arrive. This is not a serial, not a ID variant of the pattern, and not a positive result InJournal.

Return value

string — author's serial as 0x00001234; if the index 0x00000000 is incorrect.

Behavior

  • Each call reads the current position. For consistent text and fields of the same record, first Journal(index), then GetFoundedText/Line*. Null values ​​may be real data.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.

var result = UO.JournalSerial(0);
UO.Print("JournalSerial: " + Convert.ToString(result));

1. New record field - direct script

Parameters and execution flow:

  • 0 is the index of the new line. The presence of a buffer is checked.
  • string — author's serial as 0x00001234; if the index 0x00000000 is incorrect.
if (Truth(UO.HighJournal() >= 0))
{
    var value = UO.JournalSerial(0);
    UO.Print(Convert.ToString(value));
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

2. Previous Record Field - Script Function

Parameters and execution flow:

  • 1 is the previous line, not serial=1.
  • The entry GetFoundedText/Line* selected by the search is not changed.
return  RunScenario();
 object? RunScenario()
{
    if (Truth(UO.HighJournal() >= 1))
    {
        var value = UO.JournalSerial(1);
        UO.Print(Convert.ToString(value));
    }

    return null;
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

3. Save value before next action - Script Class

Parameters and execution flow:

  • value copies the field at the time of the call. Waiting does not update the variable.
  • To read the current line 0 again, call the command again; this may already be another entry.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        var value = UO.JournalSerial(0);
        UO.Wait(100);
        UO.Print("Saved value: " + Convert.ToString(value));
        return null;
    }
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.JournalSerial(index) — UO.JournalSerial(Integer)

Parameters: index (Integer)

Result: string / String.

During a call:

Internal implementation code; this is not a standalone script.

public string JournalSerial(int index) => bridge.JournalSerial(index);

UO.JournalTimer

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

int UO.JournalTimer(object? index);

Reads the timestamp field of a row at the current index without changing the selected entry.

Parameters

  • index - Required int - current index: 0 means the newest row, 1 means the previous one. Indexes are shifted when messages arrive. This is not a serial, not a ID variant of the pattern, and not a positive result InJournal.

Return value

int — record label in milliseconds from the start of runtime, compatible with Now(). 0 for recording before runtime; -1 for invalid index/time. This is not the age of the record or tenths of a second UO.Timer().

Behavior

  • Each call reads the current position. For consistent text and fields of the same record, first Journal(index), then GetFoundedText/Line*. Null values ​​may be real data.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.

var result = UO.JournalTimer(0);
UO.Print("JournalTimer: " + Convert.ToString(result));

1. New record field - direct script

Parameters and execution flow:

  • 0 is the index of the new line. The presence of a buffer is checked.
  • int — record label in milliseconds from the start of runtime, compatible with Now(). 0 for recording before runtime; -1 for invalid index/time. This is not the age of the record or tenths of a second UO.Timer().
if (Truth(UO.HighJournal() >= 0))
{
    var value = UO.JournalTimer(0);
    UO.Print(Convert.ToString(value));
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

2. Previous Record Field - Script Function

Parameters and execution flow:

  • 1 is the previous line, not serial=1.
  • The entry GetFoundedText/Line* selected by the search is not changed.
return  RunScenario();
 object? RunScenario()
{
    if (Truth(UO.HighJournal() >= 1))
    {
        var value = UO.JournalTimer(1);
        UO.Print(Convert.ToString(value));
    }

    return null;
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

3. Save value before next action - Script Class

Parameters and execution flow:

  • value copies the field at the time of the call. Waiting does not update the variable.
  • To read the current line 0 again, call the command again; this may already be another entry.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        var value = UO.JournalTimer(0);
        UO.Wait(100);
        UO.Print("Saved value: " + Convert.ToString(value));
        return null;
    }
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.JournalTimer(index) — UO.JournalTimer(Integer)

Parameters: index (Integer)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int JournalTimer(int index) => JournalEntryTime(index);

UO.LastJournalMessage

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

dynamic UO.LastJournalMessage();

Reads the text of the newest local log entry.

Parameters

There are no parameters.

Return value

string — text of the new entry; empty string if there is no log or the entry itself contains empty text.

Behavior

  • Search and Journal/GetJournal/LastJournalMessage save the text and fields of a single entry in the current script. New messages do not replace these fields. If a record is evicted from a limited journal, the retained fields remain, but LineIndex/GetFoundedTextIndex return -1. The next search or read selects another entry; an unsuccessful search, an invalid index, and clearing through this script reset the selection.
  • Updates the Line* selection and fields in the same way as Journal(0).

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.

object? result = UO.LastJournalMessage();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));

1. Read and save text - direct script

Parameters and execution flow:

  • There are no arguments; text copies the current last line.
  • The print after reading may itself become the last message.
var text = UO.LastJournalMessage();
UO.Print(text);

2. Check substring - script function

Parameters and execution flow:

  • FindText returns the position from 1 or 0. Only the last line is checked.
  • To search the entire log, use InJournal.
return  RunScenario();
 object? RunScenario()
{
    var text = UO.LastJournalMessage();
    if (Truth(FindText(text, "bank") > 0))
    {
        UO.Print("Text contains bank");
    }

    return null;
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
int FindText(object? text, object? value) => (Convert.ToString(text) ?? "").IndexOf(Convert.ToString(value) ?? "", StringComparison.Ordinal) + 1;
int FindText(int start, object? text, object? value)
{
    string input = Convert.ToString(text) ?? "";
    return input.IndexOf(Convert.ToString(value) ?? "", Math.Clamp(start - 1, 0, input.Length), StringComparison.Ordinal) + 1;
}

3. Compare with search result - script class

Parameters and execution flow:

  • matched is saved until latest is read, so it does not change with a new selection.
  • The last message may be different from the one found; found > 0 means successful search.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        var found = UO.InJournal("needle");
        var matched = UO.GetFoundedText();
        var latest = UO.LastJournalMessage();
        UO.Print("Found: " + matched);
        UO.Print("Latest: " + latest);
        return null;
    }
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.LastJournalMessage() — UO.LastJournalMessage()

Parameters: No parameters.

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "lastjournalmessage": return new InjectionValue(GetJournalText(0));

UO.LastMessage

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

string UO.LastMessage();

Reads the text of the newest local log entry.

Parameters

There are no parameters.

Return value

string — text of the new entry; empty string if there is no log or the entry itself contains empty text.

Behavior

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.

var result = UO.LastMessage();
UO.Print("LastMessage: " + Convert.ToString(result));

1. Read and save text - direct script

Parameters and execution flow:

  • There are no arguments; text copies the current last line.
  • The print after reading may itself become the last message.
var text = UO.LastMessage();
UO.Print(text);

2. Check substring - script function

Parameters and execution flow:

  • FindText returns the position from 1 or 0. Only the last line is checked.
  • To search the entire log, use InJournal.
return  RunScenario();
 object? RunScenario()
{
    var text = UO.LastMessage();
    if (Truth(FindText(text, "bank") > 0))
    {
        UO.Print("Text contains bank");
    }

    return null;
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
int FindText(object? text, object? value) => (Convert.ToString(text) ?? "").IndexOf(Convert.ToString(value) ?? "", StringComparison.Ordinal) + 1;
int FindText(int start, object? text, object? value)
{
    string input = Convert.ToString(text) ?? "";
    return input.IndexOf(Convert.ToString(value) ?? "", Math.Clamp(start - 1, 0, input.Length), StringComparison.Ordinal) + 1;
}

3. Compare with search result - script class

Parameters and execution flow:

  • matched is saved until latest is read, so it does not change with a new selection.
  • The last message may be different from the one found; found > 0 means successful search.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        var found = UO.InJournal("needle");
        var matched = UO.GetFoundedText();
        var latest = UO.LastMessage();
        UO.Print("Found: " + matched);
        UO.Print("Latest: " + latest);
        return null;
    }
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.LastMessage() — UO.LastMessage()

Parameters: No parameters.

Result: string / String.

During a call:

Internal implementation code; this is not a standalone script.

public string LastMessage() => bridge.LastMessage();

UO.LineCount

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

dynamic UO.LineCount();

Reads the number of matching rows from the last search.

Parameters

There are no parameters.

Return value

int is the number of matching records in the last checked area. 0 if there are no matches; for newestOnly=true no more than 1. This is not the number of lines in the entire log, nor the number of occurrences of a substring in one message, nor the position of the text found.

Behavior

  • The search takes into account limit, time, serial, hue and one-argument SetJournalLine. Direct Journal/GetJournal does not recalculate the counter. Cleaning resets it. The counter belongs to the bridge of the current script.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.

object? result = UO.LineCount();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));

1. All matches are direct script

Parameters and execution flow:

  • Search without limit and register. The lines are counted, not the number of ores within the line.
  • result — position plus 1; matches - a separate quantity.
var result = UO.InJournal("ore", -1);
var matches = UO.LineCount();
UO.Print(Convert.ToString(matches));

2. Matches among the last ten lines are a function of the script

Parameters and execution flow:

  • 10 — maximum lines to be checked; case is taken into account.
  • The count can range from 0 to 10, even if there are many more older matches.
return  RunScenario();
 object? RunScenario()
{
    var result = UO.InJournal("ore", 10);
    UO.Print(Convert.ToString(UO.LineCount()));
    return null;
}

3. Early Finish Search - Script Class

Parameters and execution flow:

  • serial/color=-1, time=0/0 — filters are disabled. true stops the search at the first matching line.
  • checkedMatches is equal to 0 or 1 and does not indicate the total number of matches in the entire log.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        var result = UO.InJournal("ore", -1, -1, 0, 0, true, false);
        var checkedMatches = UO.LineCount();
        UO.Print(Convert.ToString(checkedMatches));
        return null;
    }
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.LineCount() — UO.LineCount()

Parameters: No parameters.

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "linecount": return new InjectionValue(bridge.JournalMatchCount());

UO.LineID

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

dynamic UO.LineID();

Returns the numeric serial of the author of the selected log entry.

Parameters

There are no parameters.

Return value

int — 32-bit serial of the author. No choice - 0. The most significant bit may result in a negative number due to signed int; GetFoundedTextSerial preserves the full hex representation. This is not a graphic/type.

Behavior

  • Search and Journal/GetJournal/LastJournalMessage save the text and fields of a single entry in the current script. New messages do not replace these fields. If a record is evicted from a limited journal, the retained fields remain, but LineIndex/GetFoundedTextIndex return -1. The next search or read selects another entry; an unsuccessful search, an invalid index, and clearing through this script reset the selection.
  • Getter does not run a search and select the newest row. Null/empty values ​​may be valid data; consider the search result.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.

object? result = UO.LineID();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));

1. Read field after search - direct script

Parameters and execution flow:

  • notice — an example of the searched text. Getter is called without parameters only after a successful search.
  • int — 32-bit serial of the author. No choice - 0. The most significant bit may result in a negative number due to signed int; GetFoundedTextSerial preserves the full hex representation. This is not a graphic/type.
if (Truth(UO.InJournal("notice") > 0))
{
    var value = UO.LineID();
    UO.Print("Speaker serial: " + Convert.ToString(value));
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

2. Read field of a specific line - script function

Parameters and execution flow:

  • Journal(0) selects a new entry. index and value are read before Print.
  • The index check allows you to distinguish between the absence of a record and a valid null or empty field.
return  RunScenario();
 object? RunScenario()
{
    var text = UO.Journal(0);
    var index = UO.LineIndex();
    var value = UO.LineID();
    if (Truth(index >= 0))
    {
        UO.Print(Convert.ToString(value));
    }

    return null;
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

3. Save Field Before Next Lookup - Script Class

Parameters and execution flow:

  • The first search selects success, the second replaces or resets the selection. saved already contains a copy of the required field.
  • The saved var does not change with new searches, cleanups, or messages.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        if (Truth(UO.InJournal("success") > 0))
        {
            var saved = UO.LineID();
            var nextMatch = UO.InJournal("failed");
            UO.Print("Saved: " + Convert.ToString(saved));
        }

        return null;
    }

    bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.LineID() — UO.LineID()

Parameters: No parameters.

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "lineid": return new InjectionValue(selectedJournalEntry?.Serial ?? 0);

UO.LineIndex

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

dynamic UO.LineIndex();

Returns the current index of the selected entry, if it is still stored in the log.

Parameters

There are no parameters.

Return value

int is the current index from 0 (newest row). -1 means that there is no choice or the selected entry has already been deleted/preempted. This is not the result of InJournal: 1 does not need to be subtracted from the index.

Behavior

  • Search and Journal/GetJournal/LastJournalMessage save the text and fields of a single entry in the current script. New messages do not replace these fields. If a record is evicted from a limited journal, the retained fields remain, but LineIndex/GetFoundedTextIndex return -1. The next search or read selects another entry; an unsuccessful search, an invalid index, and clearing through this script reset the selection.
  • The index is recalculated based on the identity of the record. New messages increase it. The old stored index is not constant ID; for text, GetFoundedText is safer.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.

object? result = UO.LineIndex();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));

1. Index of the found record - direct script

Parameters and execution flow:

  • Getter without arguments reads the current script's selection. 0 — new line, -1 — no line in the current buffer.
  • The text is taken from the saved entry so that new messages do not replace it.
if (Truth(UO.InJournal("notice") > 0))
{
    var index = UO.LineIndex();
    var text = UO.GetFoundedText();
    UO.Print(Convert.ToString(index) + ": " + text);
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

2. Check Forward Read - Script Function

Parameters and execution flow:

  • Journal(0) selects the last entry; the check excludes an empty log.
  • Empty text is allowed for a valid entry.
return  RunScenario();
 object? RunScenario()
{
    var text = UO.Journal(0);
    if (Truth(UO.LineIndex() >= 0))
    {
        UO.Print(text);
    }

    return null;
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

3. Update Index After Waiting - Script Class

Parameters and execution flow:

  • Waiting 100 ms allows new messages to arrive. after finds the same entry again.
  • after may increase or become -1 when removed; GetFoundedText still contains the saved text.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        if (Truth(UO.InJournal("needle") > 0))
        {
            var before = UO.LineIndex();
            UO.Wait(100);
            var after = UO.LineIndex();
            UO.Print(Convert.ToString(before) + " -> " + Convert.ToString(after));
        }

        return null;
    }

    bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.LineIndex() — UO.LineIndex()

Parameters: No parameters.

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "lineindex": return new InjectionValue(GetFoundedTextIndex());

UO.LineMsgType

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

dynamic UO.LineMsgType();

Returns the network message type of the selected log entry.

Parameters

There are no parameters.

Return value

int - code MessageType: 0 Regular, 1 System, 2 Emote, 3 Limit3Spell, 6 Label, 7 Focus, 8 Whisper, 9 Yell, 10 Spell, 13 Guild, 14 Alliance, 15 Command, 16 GmChat, 192 Encoded, 255 Party. No choice 0. These are the Classic codes UO; do not replace them with different numbers from third-party examples.

Behavior

  • Search and Journal/GetJournal/LastJournalMessage save the text and fields of a single entry in the current script. New messages do not replace these fields. If a record is evicted from a limited journal, the retained fields remain, but LineIndex/GetFoundedTextIndex return -1. The next search or read selects another entry; an unsuccessful search, an invalid index, and clearing through this script reset the selection.
  • Getter does not run a search and select the newest row. Null/empty values ​​may be valid data; consider the search result.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.

object? result = UO.LineMsgType();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));

1. Read field after search - direct script

Parameters and execution flow:

  • notice — an example of the searched text. Getter is called without parameters only after a successful search.
  • int - code MessageType: 0 Regular, 1 System, 2 Emote, 3 Limit3Spell, 6 Label, 7 Focus, 8 Whisper, 9 Yell, 10 Spell, 13 Guild, 14 Alliance, 15 Command, 16 GmChat, 192 Encoded, 255 Party. No choice 0. These are the Classic codes UO; do not replace them with different numbers from third-party examples.
if (Truth(UO.InJournal("notice") > 0))
{
    var value = UO.LineMsgType();
    UO.Print("Message type: " + Convert.ToString(value));
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

2. Read field of a specific line - script function

Parameters and execution flow:

  • Journal(0) selects a new entry. index and value are read before Print.
  • The index check allows you to distinguish between the absence of a record and a valid null or empty field.
return  RunScenario();
 object? RunScenario()
{
    var text = UO.Journal(0);
    var index = UO.LineIndex();
    var value = UO.LineMsgType();
    if (Truth(index >= 0))
    {
        UO.Print(Convert.ToString(value));
    }

    return null;
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

3. Save Field Before Next Lookup - Script Class

Parameters and execution flow:

  • The first search selects success, the second replaces or resets the selection. saved already contains a copy of the required field.
  • The saved var does not change with new searches, cleanups, or messages.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        if (Truth(UO.InJournal("success") > 0))
        {
            var saved = UO.LineMsgType();
            var nextMatch = UO.InJournal("failed");
            UO.Print("Saved: " + Convert.ToString(saved));
        }

        return null;
    }

    bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.LineMsgType() — UO.LineMsgType()

Parameters: No parameters.

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "linemsgtype": return new InjectionValue(selectedJournalEntry?.MessageType ?? 0);

UO.LineName

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

dynamic UO.LineName();

Returns the author name of the selected journal entry.

Parameters

There are no parameters.

Return value

string — the name of the author of the selected entry, for example System or the name of the character; empty string with no selection/no name. A name does not guarantee a character's uniqueness.

Behavior

  • Search and Journal/GetJournal/LastJournalMessage save the text and fields of a single entry in the current script. New messages do not replace these fields. If a record is evicted from a limited journal, the retained fields remain, but LineIndex/GetFoundedTextIndex return -1. The next search or read selects another entry; an unsuccessful search, an invalid index, and clearing through this script reset the selection.
  • Getter does not run a search and select the newest row. Null/empty values ​​may be valid data; consider the search result.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.

object? result = UO.LineName();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));

1. Read field after search - direct script

Parameters and execution flow:

  • notice — an example of the searched text. Getter is called without parameters only after a successful search.
  • string — the name of the author of the selected entry, for example System or the name of the character; empty string with no selection/no name. A name does not guarantee a character's uniqueness.
if (Truth(UO.InJournal("notice") > 0))
{
    var value = UO.LineName();
    UO.Print("Speaker: " + Convert.ToString(value));
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

2. Read field of a specific line - script function

Parameters and execution flow:

  • Journal(0) selects a new entry. index and value are read before Print.
  • The index check allows you to distinguish between the absence of a record and a valid null or empty field.
return  RunScenario();
 object? RunScenario()
{
    var text = UO.Journal(0);
    var index = UO.LineIndex();
    var value = UO.LineName();
    if (Truth(index >= 0))
    {
        UO.Print(Convert.ToString(value));
    }

    return null;
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

3. Save Field Before Next Lookup - Script Class

Parameters and execution flow:

  • The first search selects success, the second replaces or resets the selection. saved already contains a copy of the required field.
  • The saved var does not change with new searches, cleanups, or messages.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        if (Truth(UO.InJournal("success") > 0))
        {
            var saved = UO.LineName();
            var nextMatch = UO.InJournal("failed");
            UO.Print("Saved: " + Convert.ToString(saved));
        }

        return null;
    }

    bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.LineName() — UO.LineName()

Parameters: No parameters.

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "linename": return new InjectionValue(selectedJournalEntry?.Name ?? string.Empty);

UO.LineTextColor

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

dynamic UO.LineTextColor();

Returns the numeric color of the selected log entry.

Parameters

There are no parameters.

Return value

int — UO hue of the selected record (0…65535); no choice 0. Zero is acceptable as a color. This is not the author's RGB or ID.

Behavior

  • Search and Journal/GetJournal/LastJournalMessage save the text and fields of a single entry in the current script. New messages do not replace these fields. If a record is evicted from a limited journal, the retained fields remain, but LineIndex/GetFoundedTextIndex return -1. The next search or read selects another entry; an unsuccessful search, an invalid index, and clearing through this script reset the selection.
  • Getter does not run a search and select the newest row. Null/empty values ​​may be valid data; consider the search result.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.

object? result = UO.LineTextColor();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));

1. Read field after search - direct script

Parameters and execution flow:

  • notice — an example of the searched text. Getter is called without parameters only after a successful search.
  • int — UO hue of the selected record (0…65535); no choice 0. Zero is acceptable as a color. This is not the author's RGB or ID.
if (Truth(UO.InJournal("notice") > 0))
{
    var value = UO.LineTextColor();
    UO.Print("Hue: " + Convert.ToString(value));
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

2. Read field of a specific line - script function

Parameters and execution flow:

  • Journal(0) selects a new entry. index and value are read before Print.
  • The index check allows you to distinguish between the absence of a record and a valid null or empty field.
return  RunScenario();
 object? RunScenario()
{
    var text = UO.Journal(0);
    var index = UO.LineIndex();
    var value = UO.LineTextColor();
    if (Truth(index >= 0))
    {
        UO.Print(Convert.ToString(value));
    }

    return null;
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

3. Save Field Before Next Lookup - Script Class

Parameters and execution flow:

  • The first search selects success, the second replaces or resets the selection. saved already contains a copy of the required field.
  • The saved var does not change with new searches, cleanups, or messages.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        if (Truth(UO.InJournal("success") > 0))
        {
            var saved = UO.LineTextColor();
            var nextMatch = UO.InJournal("failed");
            UO.Print("Saved: " + Convert.ToString(saved));
        }

        return null;
    }

    bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.LineTextColor() — UO.LineTextColor()

Parameters: No parameters.

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "linetextcolor":

                    return new InjectionValue(selectedJournalEntry?.Color ?? 0);

UO.LineTextFont

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

dynamic UO.LineTextFont();

Returns the font of the selected log entry.

Parameters

There are no parameters.

Return value

int — UO font ID of the selected record (0…255 in the client); no choice 0. This is the ID game font, not the IDE font size.

Behavior

  • Search and Journal/GetJournal/LastJournalMessage save the text and fields of a single entry in the current script. New messages do not replace these fields. If a record is evicted from a limited journal, the retained fields remain, but LineIndex/GetFoundedTextIndex return -1. The next search or read selects another entry; an unsuccessful search, an invalid index, and clearing through this script reset the selection.
  • Getter does not run a search and select the newest row. Null/empty values ​​may be valid data; consider the search result.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.

object? result = UO.LineTextFont();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));

1. Read field after search - direct script

Parameters and execution flow:

  • notice — an example of the searched text. Getter is called without parameters only after a successful search.
  • int — UO font ID of the selected record (0…255 in the client); no choice 0. This is the ID game font, not the IDE font size.
if (Truth(UO.InJournal("notice") > 0))
{
    var value = UO.LineTextFont();
    UO.Print("Font ID: " + Convert.ToString(value));
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

2. Read field of a specific line - script function

Parameters and execution flow:

  • Journal(0) selects a new entry. index and value are read before Print.
  • The index check allows you to distinguish between the absence of a record and a valid null or empty field.
return  RunScenario();
 object? RunScenario()
{
    var text = UO.Journal(0);
    var index = UO.LineIndex();
    var value = UO.LineTextFont();
    if (Truth(index >= 0))
    {
        UO.Print(Convert.ToString(value));
    }

    return null;
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

3. Save Field Before Next Lookup - Script Class

Parameters and execution flow:

  • The first search selects success, the second replaces or resets the selection. saved already contains a copy of the required field.
  • The saved var does not change with new searches, cleanups, or messages.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        if (Truth(UO.InJournal("success") > 0))
        {
            var saved = UO.LineTextFont();
            var nextMatch = UO.InJournal("failed");
            UO.Print("Saved: " + Convert.ToString(saved));
        }

        return null;
    }

    bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.LineTextFont() — UO.LineTextFont()

Parameters: No parameters.

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "linetextfont": return new InjectionValue(selectedJournalEntry?.Font ?? 0);

UO.LineTime

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

dynamic UO.LineTime();

Returns the calendar timestamp of the selected log entry.

Parameters

There are no parameters.

Return value

double — OLE Automation Date, number of days from 30.12.1899, the fractional part specifies the time of day. No choice 0. It's not Now() milliseconds or a whole Unix timestamp. The difference of two such marks is multiplied by 86400000 for milliseconds.

Behavior

  • Search and Journal/GetJournal/LastJournalMessage save the text and fields of a single entry in the current script. New messages do not replace these fields. If a record is evicted from a limited journal, the retained fields remain, but LineIndex/GetFoundedTextIndex return -1. The next search or read selects another entry; an unsuccessful search, an invalid index, and clearing through this script reset the selection.
  • Getter does not run a search and select the newest row. Null/empty values ​​may be valid data; consider the search result.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.

object? result = UO.LineTime();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));

1. Read field after search - direct script

Parameters and execution flow:

  • notice — an example of the searched text. Getter is called without parameters only after a successful search.
  • double — OLE Automation Date, number of days from 30.12.1899, the fractional part specifies the time of day. No choice 0. It's not Now() milliseconds or a whole Unix timestamp. The difference of two such marks is multiplied by 86400000 for milliseconds.
if (Truth(UO.InJournal("notice") > 0))
{
    var value = UO.LineTime();
    UO.Print("OLE date: " + Convert.ToString(value));
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

2. Read field of a specific line - script function

Parameters and execution flow:

  • Journal(0) selects a new entry. index and value are read before Print.
  • The index check allows you to distinguish between the absence of a record and a valid null or empty field.
return  RunScenario();
 object? RunScenario()
{
    var text = UO.Journal(0);
    var index = UO.LineIndex();
    var value = UO.LineTime();
    if (Truth(index >= 0))
    {
        UO.Print(Convert.ToString(value));
    }

    return null;
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

3. Save Field Before Next Lookup - Script Class

Parameters and execution flow:

  • The first search selects success, the second replaces or resets the selection. saved already contains a copy of the required field.
  • The saved var does not change with new searches, cleanups, or messages.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        if (Truth(UO.InJournal("success") > 0))
        {
            var saved = UO.LineTime();
            var nextMatch = UO.InJournal("failed");
            UO.Print("Saved: " + Convert.ToString(saved));
        }

        return null;
    }

    bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.LineTime() — UO.LineTime()

Parameters: No parameters.

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "linetime": return new InjectionValue(selectedJournalEntry?.Timestamp ?? 0d);

UO.LineType

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

dynamic UO.LineType();

Returns the text category of the selected log entry.

Parameters

There are no parameters.

Return value

int - category TextType of the client: 0 CLIENT, 1 SYSTEM, 2 OBJECT, 3 GUILD_ALLY. No choice 0. This is a display category, not serial, not graphic, and not MessageType.

Behavior

  • Search and Journal/GetJournal/LastJournalMessage save the text and fields of a single entry in the current script. New messages do not replace these fields. If a record is evicted from a limited journal, the retained fields remain, but LineIndex/GetFoundedTextIndex return -1. The next search or read selects another entry; an unsuccessful search, an invalid index, and clearing through this script reset the selection.
  • Getter does not run a search and select the newest row. Null/empty values ​​may be valid data; consider the search result.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.

object? result = UO.LineType();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));

1. Read field after search - direct script

Parameters and execution flow:

  • notice — an example of the searched text. Getter is called without parameters only after a successful search.
  • int - category TextType of the client: 0 CLIENT, 1 SYSTEM, 2 OBJECT, 3 GUILD_ALLY. No choice 0. This is a display category, not serial, not graphic, and not MessageType.
if (Truth(UO.InJournal("notice") > 0))
{
    var value = UO.LineType();
    UO.Print("Text category: " + Convert.ToString(value));
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

2. Read field of a specific line - script function

Parameters and execution flow:

  • Journal(0) selects a new entry. index and value are read before Print.
  • The index check allows you to distinguish between the absence of a record and a valid null or empty field.
return  RunScenario();
 object? RunScenario()
{
    var text = UO.Journal(0);
    var index = UO.LineIndex();
    var value = UO.LineType();
    if (Truth(index >= 0))
    {
        UO.Print(Convert.ToString(value));
    }

    return null;
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

3. Save Field Before Next Lookup - Script Class

Parameters and execution flow:

  • The first search selects success, the second replaces or resets the selection. saved already contains a copy of the required field.
  • The saved var does not change with new searches, cleanups, or messages.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        if (Truth(UO.InJournal("success") > 0))
        {
            var saved = UO.LineType();
            var nextMatch = UO.InJournal("failed");
            UO.Print("Saved: " + Convert.ToString(saved));
        }

        return null;
    }

    bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.LineType() — UO.LineType()

Parameters: No parameters.

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "linetype": return new InjectionValue(selectedJournalEntry?.TextType ?? 0);

UO.LowJournal

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

dynamic UO.LowJournal();

Returns the minimum available log index.

Parameters

There are no parameters.

Return value

int: -1 when the journal is empty; otherwise 0 is the index of the newest available record. Journal/GetJournal use zero indexes from new record to old; a positive result InJournal uses a different, single count.

Behavior

  • New messages and cleaning change the boundaries. The order here is Journal(0) from new entry to old entry.

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.

object? result = UO.LowJournal();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));

1. Check for entries - direct script

Parameters and execution flow:

  • A negative bound means an empty buffer.
  • If the buffer is not empty, Journal(0) reads a new entry.
if (Truth(UO.LowJournal() >= 0))
{
    var text = UO.Journal(0);
    UO.Print(text);
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

2. Read line at boundary - script function

Parameters and execution flow:

  • index is passed directly to Journal, without subtracting one.
  • The index may shift with incoming messages; The buffer is not frozen between calls.
return  RunScenario();
 object? RunScenario()
{
    var index = UO.LowJournal();
    if (Truth(index >= 0))
    {
        var text = UO.Journal(index);
        UO.Print(text);
    }

    return null;
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

3. Read Current Log Range - Script Class

Parameters and execution flow:

  • LowJournal and HighJournal form the boundaries of the indices. It's not the number of lines; log contents may change between calls.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        int first = UO.LowJournal();
        int last = UO.HighJournal();
        if (first > last)
            return null;
        for (int index = first; index <= last; index++)
            UO.Print($"{index}: {UO.Journal(index)}");
        return null;
    }
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.LowJournal() — UO.LowJournal()

Parameters: No parameters.

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "lowjournal": return new InjectionValue(bridge.JournalEntryCount() == 0 ? -1 : 0);

UO.SetJournalLine

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

void UO.SetJournalLine(object? index);
void UO.SetJournalLine(object? stringIndex, object? text);

Changes the text of a line; a separate one-argument form specifies the lower bound of the search.

Parameters

  • index — For form (index,text): current index from 0, where 0 is new line. For the form (index): the number of old lines to be skipped from the beginning of the internal buffer, not the Journal index; 0 removes the restriction. The negative one-argument bound is limited to 0.
  • stringIndex — Name of the index in compatible two-argument logging: the current Journal index from 0.
  • text — New text of an existing line, including a blank line. Required in text replacement form.

Return value

void - no return value. If the index is invalid, the two-argument form does not change anything. The one-argument form does not change the text.

Behavior

  • The replacement is local, nothing is sent to the server. Author/time fields are preserved. An already selected text snapshot remains the same until the Journal or search is repeated.
  • One-argument bound is a deprecated extension: the number of old lines in the current buffer; when records are ousted/deleted, its meaning shifts. For a reliable boundary between actions, use InJournalBetweenTimes with Now().

Standalone C# scripts

Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.

Simple example

Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.

The command is a separate statement. The message before it marks the start of the call; it does not confirm a server action.

UO.Print("Calling UO.SetJournalLine");
UO.SetJournalLine(0);

1. Mark last line - direct script

Parameters and execution flow:

  • 0 — new line; the second argument is its new full text.
  • This changes the local buffer. Between reading and writing, new messages may arrive; the index is not constant ID.
if (Truth(UO.HighJournal() >= 0))
{
    var text = UO.Journal(0);
    UO.SetJournalLine(0, "[read] " + text);
}

bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;

2. Replace text with empty string - script function

Parameters and execution flow:

  • An empty line replaces the text, but does not remove the entry or its author.
  • Invalid index is skipped. exists can be true even with text="".
return  RunScenario();
 object? RunScenario()
{
    UO.SetJournalLine(0, "");
    var text = UO.Journal(0);
    var exists = UO.LineIndex() >= 0;
    UO.Print(Convert.ToString(exists));
    return null;
}

3. Remove Search Restriction - Script Class

Parameters and execution flow:

  • One argument 0 means don't skip old lines; this is another form of command.
  • Search without restrictions and case insensitive. No text is replaced by this form.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        UO.SetJournalLine(0);
        var found = UO.InJournal("notice", -1);
        UO.Print(Convert.ToString(found));
        return null;
    }
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.SetJournalLine(index) — UO.SetJournalLine(Integer)

Parameters: index (Integer)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

public void SetJournalLine(int index) => bridge.SetJournalLine(index);

UO.SetJournalLine(stringIndex, text) — UO.SetJournalLine(Any,Any)

Parameters: stringIndex (Any/Integer), text (Any/String)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "setjournalline":

                    if (arguments.Length > 1) bridge.SetJournalLine(Arg(0), Text(1));

                    else bridge.SetJournalLine(Arg(0));

                    return InjectionValue.Unit;

UO.SetJournalLine(stringIndex, text) — UO.SetJournalLine(Integer,String)

Parameters: stringIndex (Any/Integer), text (Any/String)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

public void SetJournalLine(int index, string text) => bridge.SetJournalLine(index, text);

Clone this wiki locally