Repository navigation
EN UO Topic journal
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
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.
| 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 |
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
UO.WaitJournalLine · UO.WaitJournalLineSystem · UO.WaitingForJournalText
UO.AddToSystemJournal · UO.AddToSystemJournalEx · UO.ClearSystemJournal
UO.AddJournalIgnore · UO.ClearJournalIgnore
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
UO.FoundedParamId · UO.GetFoundedText · UO.GetFoundedTextColor · UO.GetFoundedTextID · UO.GetFoundedTextIndex · UO.GetFoundedTextSerial · UO.GetFoundedTextTimer
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.
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;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;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.AddJournalIgnore(object? str);Adds a local text filter for ClassicUO game log entries.
-
str- non-empty text fragment to search in the text of the journal entry.
void. The command does not return the number of matches.
- 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.
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.
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");Parameters and execution flow:
- Hide new posts containing this phrase.
UO.AddJournalIgnore("You see");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;
}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;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: str (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.AddJournalIgnore:bridge.AddJournalIgnore(Text(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0).
Internal implementation code; this is not a standalone script.
case "addjournalignore": bridge.AddJournalIgnore(Text(0)); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.AddToJournal(object? text);Shows a local message about script progress or stopping condition. You see it, not other players.
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.
- 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.Printadds 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
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.
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");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));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;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;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: text (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.SystemMessage:SystemMessage(Text(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0).
Internal implementation code; this is not a standalone script.
case "addtojournal":
case "addtosystemjournal":
case "clientprint":
SystemMessage(Text(0)); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.AddToSystemJournal(object? text);Shows a local message about script progress or stopping condition. You see it, not other players.
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.
- 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.Printadds 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
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.
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");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));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;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;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: text (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.SystemMessage:SystemMessage(Text(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0).
Internal implementation code; this is not a standalone script.
case "addtojournal":
case "addtosystemjournal":
case "clientprint":
SystemMessage(Text(0)); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
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.
-
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.
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.
- 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
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.
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");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");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;
}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;
}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:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.PrintFormattedJournal:bridge.PrintFormattedJournal(Text(0), Arg(1), Arg(2), Arg(3), Text(4)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(1).
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;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.ChangeJournalLength(object? newLength);Changes the client log history limit that is retained.
-
newLength— Number of records to convert to int. Runtime limits below to 1; JournalManager limits from above Constants.MAX_JOURNAL_HISTORY_COUNT.
void - no return value.
- 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.
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.
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);Parameters and execution flow:
- The new limit limits the number of records saved.
UO.ChangeJournalLength(100);Parameters and execution flow:
- When the limit is reduced, old entries are deleted.
return RunScenario();
object? RunScenario()
{
UO.ChangeJournalLength(1);
return null;
}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;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: newLength (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias. -
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias::Arg:Arg(0, 100). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetJournalLength:bridge.SetJournalLength(state.JournalLength).
Internal implementation code; this is not a standalone script.
case "changejournallength": state.JournalLength = Math.Max(1, Arg(0, 100)); bridge.SetJournalLength(state.JournalLength); break;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.ClearJournal();Removes lines from the shared local log.
There are no parameters.
void - no return value. Does not return the number of rows deleted. The hit counter and current script selection are reset.
- 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.
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.
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();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));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;
}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;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.DeleteJournal:DeleteJournal().
Internal implementation code; this is not a standalone script.
case "clearjournal": DeleteJournal(); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.ClearJournalIgnore();Removes all text filters JournalManager.
There are no parameters.
void - no return value.
- Removing filters does not delete history or cancel AddChatUserIgnore name filters.
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.
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();Parameters and execution flow:
- Removes all text filters JournalManager.
UO.ClearJournalIgnore();Parameters and execution flow:
- Allow the You see text to display again.
return RunScenario();
object? RunScenario()
{
UO.AddJournalIgnore("You see");
UO.ClearJournalIgnore();
return null;
}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;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ClearJournalIgnore:bridge.ClearJournalIgnore().
Internal implementation code; this is not a standalone script.
case "clearjournalignore": bridge.ClearJournalIgnore(); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.ClearSystemJournal();Removes lines with author name System.
There are no parameters.
void - no return value. Does not return the number of rows deleted. The hit counter and current script selection are reset.
- 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.
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.
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();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));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;
}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;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.DeleteSystemJournal:bridge.DeleteSystemJournal(). -
InjectionScript.Runtime.InjectionApiUO.SelectJournalEntry:SelectJournalEntry(null).
Internal implementation code; this is not a standalone script.
case "clearsystemjournal": bridge.DeleteSystemJournal(); SelectJournalEntry(null); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.DeleteJournal();
void UO.DeleteJournal(object? text);Removes lines from the shared local log.
-
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.
void - no return value. Does not return the number of rows deleted. The hit counter and current script selection are reset.
- 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.
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.
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();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));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;
}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;
}
}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));C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.DeleteJournal. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.DeleteJournal:bridge.DeleteJournal(). -
InjectionScript.Runtime.InjectionApiUO.SelectJournalEntry:SelectJournalEntry(null).
Internal implementation code; this is not a standalone script.
public void DeleteJournal()
{
bridge.DeleteJournal();
SelectJournalEntry(null);
}Parameters: text (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.DeleteJournal. -
InjectionScript.Runtime.InjectionApiUO.DeleteJournal:DeleteJournal((string)text).
Internal implementation code; this is not a standalone script.
public void DeleteJournal(InjectionValue text) => DeleteJournal((string)text);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.FoundedParamId();Returns the number of the matched search pattern alternative.
There are no parameters.
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.
- 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.
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.
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));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;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;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;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
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);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
string UO.GetFoundedText();Returns the text of the selected log entry.
There are no parameters.
string — text of the selected entry; empty line with no selection. Blank text is acceptable for an existing entry.
- 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.
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.
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));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;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;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;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
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;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
string UO.GetFoundedTextColor();Returns the color of the selected log entry.
There are no parameters.
string — UO hue in 0x0044 format (4 hex digits). No choice - 0x0000; hue=0 is also acceptable for a message. This is not RGB.
- 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.
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.
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));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;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;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;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
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";Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetFoundedTextID();Returns the number of the matched search pattern alternative.
There are no parameters.
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.
- 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.
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.
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));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;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;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;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
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;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetFoundedTextIndex();Returns the current index of the selected entry, if it is still stored in the log.
There are no parameters.
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.
- 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.
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.
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));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;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;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;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
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;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
string UO.GetFoundedTextSerial();Returns serial of the author of the selected log entry.
There are no parameters.
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.
- 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.
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.
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));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;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;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;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
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";Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetFoundedTextTimer();Returns the millisecond timestamp of the selected log entry.
There are no parameters.
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().
- 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.
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.
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));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;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;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;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.GetFoundedTextTimer. -
InjectionScript.Runtime.InjectionApiUO.JournalEntryTime:JournalEntryTime(selectedJournalEntry.Timestamp).
Internal implementation code; this is not a standalone script.
public int GetFoundedTextTimer() => selectedJournalEntry != null ? JournalEntryTime(selectedJournalEntry.Timestamp) : 0;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
string UO.GetJournal(object? index);Reads the text of a line at the current index and selects that entry for GetFoundedText/Line*.
-
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.
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.
- 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 ; .
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.
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));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);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;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;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: index (Integer)
Result: string / String.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.GetJournalText. -
InjectionScript.Runtime.InjectionApiUO.SelectJournalEntry:SelectJournalEntry(ReadJournalSnapshot(index)). -
InjectionScript.Runtime.InjectionApiUO.ReadJournalSnapshot:ReadJournalSnapshot(index).
Internal implementation code; this is not a standalone script.
public string GetJournalText(int index)
{
SelectJournalEntry(ReadJournalSnapshot(index));
return selectedJournalEntry?.Text ?? string.Empty;
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
string UO.GetJournalColor(object? index);Reads the hue field of a row at the current index without changing the selected entry.
-
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.
string — UO hue like 0x0044; if the index 0x0000 is incorrect. This is not RGB.
- 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.
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.
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));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;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;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;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: index (Integer)
Result: string / String.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.JournalColor. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.JournalColor:bridge.JournalColor(index).
Internal implementation code; this is not a standalone script.
public string JournalColor(int index) => bridge.JournalColor(index);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
string UO.GetJournalSerial(object? index);Reads the serial field of a row at the current index without changing the selected entry.
-
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.
string — author's serial as 0x00001234; if the index 0x00000000 is incorrect.
- 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.
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.
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));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;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;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;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: index (Integer)
Result: string / String.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.JournalSerial. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.JournalSerial:bridge.JournalSerial(index).
Internal implementation code; this is not a standalone script.
public string JournalSerial(int index) => bridge.JournalSerial(index);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.HighJournal();Returns the maximum available log index.
There are no parameters.
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.
- New messages and cleaning change the boundaries. The order here is Journal(0) from new entry to old entry.
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.
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));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;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;
}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;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.JournalEntryCount:bridge.JournalEntryCount().
Internal implementation code; this is not a standalone script.
case "highjournal": return new InjectionValue(bridge.JournalEntryCount() == 0 ? -1 : bridge.JournalEntryCount() - 1);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
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.
-
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.
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.
- 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.
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.
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));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;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;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;
}
}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;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;C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: pattern (Any/String)
Result: int / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.InJournal:InJournal(Text(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0).
Internal implementation code; this is not a standalone script.
case "injournal": return new InjectionValue(InJournal(Text(0)));Parameters: pattern (Any/String)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.InJournal. -
InjectionScript.Runtime.InjectionApiUO.InJournalCore:InJournalCore(pattern, -1, ignoreCase: false).
Internal implementation code; this is not a standalone script.
public int InJournal(string pattern)
=> InJournalCore(pattern, -1, ignoreCase: false);Parameters: pattern (String), maxLinesOrIgnoreCase (Integer)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.InJournal. -
InjectionScript.Runtime.InjectionApiUO.InJournalCore:InJournalCore(pattern, maxLinesOrIgnoreCase == -1 ? -1 : Math.Max(0, maxLinesOrIgnoreCase), ignoreCase: maxLinesOrIgnoreCase == -1).
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);Parameters: pattern (Any), serial (Any), color (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [InJournal]. -
InjectionScript.Runtime.InjectionApiUO.CompactInJournal:CompactInJournal(values).
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))Parameters: pattern (Any), serial (Any), color (Any), startTime (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [InJournal]. -
InjectionScript.Runtime.InjectionApiUO.CompactInJournal:CompactInJournal(values).
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))Parameters: pattern (Any), serial (Any), color (Any), startTime (Any), endTime (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [InJournal]. -
InjectionScript.Runtime.InjectionApiUO.CompactInJournal:CompactInJournal(values).
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:
-
InjectionScript.Runtime.InjectionApiUO.Register [InJournal]. -
InjectionScript.Runtime.InjectionApiUO.CompactInJournal:CompactInJournal(values).
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:
-
InjectionScript.Runtime.InjectionApiUO.Register [InJournal]. -
InjectionScript.Runtime.InjectionApiUO.CompactInJournal:CompactInJournal(values).
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))Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
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.
-
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.
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.
- 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.
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.
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));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;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;
}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();
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: pattern (Any/String), startTime (Any/Integer)
Result: int / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.InJournalBetweenTimes:InJournalBetweenTimes(Text(0), Arg(1), Arg(2), Arg(3)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(1). -
InjectionScript.Runtime.InjectionApiUO.InJournalBetweenTimes:InJournalBetweenTimes(Text(0), Arg(1), Arg(2)). -
InjectionScript.Runtime.InjectionApiUO.InJournalBetweenTimes:InJournalBetweenTimes(Text(0), Arg(1)).
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)));Parameters: pattern (Any/String), startTime (Any/Integer)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.InJournalBetweenTimes. -
InjectionScript.Runtime.InjectionApiUO.InJournalBetweenTimesCore:InJournalBetweenTimesCore(pattern, startTime, CurrentJournalTime(), -1, ignoreCase: false). -
InjectionScript.Runtime.InjectionApiUO.CurrentJournalTime:CurrentJournalTime().
Internal implementation code; this is not a standalone script.
public int InJournalBetweenTimes(string pattern, int startTime)
=> InJournalBetweenTimesCore(pattern, startTime, CurrentJournalTime(), -1, ignoreCase: false);Parameters: pattern (Any/String), startTime (Any/Integer), endTime (Any/Integer)
Result: int / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.InJournalBetweenTimes:InJournalBetweenTimes(Text(0), Arg(1), Arg(2), Arg(3)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(1). -
InjectionScript.Runtime.InjectionApiUO.InJournalBetweenTimes:InJournalBetweenTimes(Text(0), Arg(1), Arg(2)). -
InjectionScript.Runtime.InjectionApiUO.InJournalBetweenTimes:InJournalBetweenTimes(Text(0), Arg(1)).
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:
-
InjectionScript.Runtime.InjectionApiUO.InJournalBetweenTimes. -
InjectionScript.Runtime.InjectionApiUO.InJournalBetweenTimesCore:InJournalBetweenTimesCore(pattern, startTime, endTime, -1, ignoreCase: false).
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:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.InJournalBetweenTimes:InJournalBetweenTimes(Text(0), Arg(1), Arg(2), Arg(3)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(1). -
InjectionScript.Runtime.InjectionApiUO.InJournalBetweenTimes:InJournalBetweenTimes(Text(0), Arg(1), Arg(2)). -
InjectionScript.Runtime.InjectionApiUO.InJournalBetweenTimes:InJournalBetweenTimes(Text(0), Arg(1)).
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:
-
InjectionScript.Runtime.InjectionApiUO.InJournalBetweenTimes. -
InjectionScript.Runtime.InjectionApiUO.InJournalBetweenTimesCore:InJournalBetweenTimesCore(pattern, startTime, endTime, limit == -1 ? -1 : Math.Max(0, limit), ignoreCase: limit == -1).
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);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
string UO.Journal(object? index);Reads the text of a line at the current index and selects that entry for GetFoundedText/Line*.
-
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.
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.
- 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 ; .
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.
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));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);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;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;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: index (Any/Integer)
Result: string / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.GetJournalText:GetJournalText(Arg(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "journal": return new InjectionValue(GetJournalText(Arg(0)));Parameters: index (Any/Integer)
Result: string / String.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.GetJournalText. -
InjectionScript.Runtime.InjectionApiUO.SelectJournalEntry:SelectJournalEntry(ReadJournalSnapshot(index)). -
InjectionScript.Runtime.InjectionApiUO.ReadJournalSnapshot:ReadJournalSnapshot(index).
Internal implementation code; this is not a standalone script.
public string GetJournalText(int index)
{
SelectJournalEntry(ReadJournalSnapshot(index));
return selectedJournalEntry?.Text ?? string.Empty;
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
string UO.JournalColor(object? index);Reads the hue field of a row at the current index without changing the selected entry.
-
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.
string — UO hue like 0x0044; if the index 0x0000 is incorrect. This is not RGB.
- 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.
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.
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));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;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;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;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: index (Integer)
Result: string / String.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.JournalColor. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.JournalColor:bridge.JournalColor(index).
Internal implementation code; this is not a standalone script.
public string JournalColor(int index) => bridge.JournalColor(index);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
string UO.JournalSerial(object? index);Reads the serial field of a row at the current index without changing the selected entry.
-
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.
string — author's serial as 0x00001234; if the index 0x00000000 is incorrect.
- 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.
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.
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));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;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;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;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: index (Integer)
Result: string / String.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.JournalSerial. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.JournalSerial:bridge.JournalSerial(index).
Internal implementation code; this is not a standalone script.
public string JournalSerial(int index) => bridge.JournalSerial(index);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.JournalTimer(object? index);Reads the timestamp field of a row at the current index without changing the selected entry.
-
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.
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().
- 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.
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.
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));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;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;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;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: index (Integer)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.JournalTimer. -
InjectionScript.Runtime.InjectionApiUO.JournalEntryTime:JournalEntryTime(index).
Internal implementation code; this is not a standalone script.
public int JournalTimer(int index) => JournalEntryTime(index);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.LastJournalMessage();Reads the text of the newest local log entry.
There are no parameters.
string — text of the new entry; empty string if there is no log or the entry itself contains empty text.
- 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).
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.
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));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);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;
}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;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.GetJournalText:GetJournalText(0).
Internal implementation code; this is not a standalone script.
case "lastjournalmessage": return new InjectionValue(GetJournalText(0));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
string UO.LastMessage();Reads the text of the newest local log entry.
There are no parameters.
string — text of the new entry; empty string if there is no log or the entry itself contains empty text.
- This getter reads the new entry but retains the old selection GetFoundedText/Line*. To select the latest entry, use LastJournalMessage or Journal(0).
- Primary directory: https://forum.yoko.com.ua/viewtopic.php?p=27633.
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.
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));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);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;
}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;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: string / String.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.LastMessage. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.LastMessage:bridge.LastMessage().
Internal implementation code; this is not a standalone script.
public string LastMessage() => bridge.LastMessage();Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.LineCount();Reads the number of matching rows from the last search.
There are no parameters.
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.
- 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.
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.
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));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));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;
}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;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.JournalMatchCount:bridge.JournalMatchCount().
Internal implementation code; this is not a standalone script.
case "linecount": return new InjectionValue(bridge.JournalMatchCount());Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.LineID();Returns the numeric serial of the author of the selected log entry.
There are no parameters.
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.
- 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.
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.
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));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;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;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;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
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);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.LineIndex();Returns the current index of the selected entry, if it is still stored in the log.
There are no parameters.
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.
- 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.
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.
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));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;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;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;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.GetFoundedTextIndex:GetFoundedTextIndex().
Internal implementation code; this is not a standalone script.
case "lineindex": return new InjectionValue(GetFoundedTextIndex());Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.LineMsgType();Returns the network message type of the selected log entry.
There are no parameters.
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.
- 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.
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.
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));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;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;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;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
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);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.LineName();Returns the author name of the selected journal entry.
There are no parameters.
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.
- 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.
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.
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));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;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;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;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
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);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.LineTextColor();Returns the numeric color of the selected log entry.
There are no parameters.
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.
- 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.
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.
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));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;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;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;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
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);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.LineTextFont();Returns the font of the selected log entry.
There are no parameters.
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.
- 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.
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.
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));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;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;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;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
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);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.LineTime();Returns the calendar timestamp of the selected log entry.
There are no parameters.
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.
- 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.
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.
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));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;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;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;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
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);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.LineType();Returns the text category of the selected log entry.
There are no parameters.
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.
- 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.
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.
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));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;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;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;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
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);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.LowJournal();Returns the minimum available log index.
There are no parameters.
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.
- New messages and cleaning change the boundaries. The order here is Journal(0) from new entry to old entry.
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.
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));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;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;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;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.JournalEntryCount:bridge.JournalEntryCount().
Internal implementation code; this is not a standalone script.
case "lowjournal": return new InjectionValue(bridge.JournalEntryCount() == 0 ? -1 : 0);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
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.
-
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.
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.
- 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().
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.
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);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;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;
}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;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: index (Integer)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.SetJournalLine. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetJournalLine:bridge.SetJournalLine(index).
Internal implementation code; this is not a standalone script.
public void SetJournalLine(int index) => bridge.SetJournalLine(index);Parameters: stringIndex (Any/Integer), text (Any/String)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetJournalLine:bridge.SetJournalLine(Arg(0), Text(1)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(1). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetJournalLine:bridge.SetJournalLine(Arg(0)).
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;Parameters: stringIndex (Any/Integer), text (Any/String)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.SetJournalLine. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetJournalLine:bridge.SetJournalLine(index, text).
Internal implementation code; this is not a standalone script.
public void SetJournalLine(int index, string text) => bridge.SetJournalLine(index, text);ClassicUO — Bad Newbie & C# Scripts IDE