Repository navigation
EN UO Topic client ui
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
Home · C# · IDE · UO API · A–Z · Examples · Languages
Display messages, service windows, display objects and open IDE. These steps do not replace sending speech to the server.
| Topic | Commands and explanations |
|---|---|
| UO.Print | |
| ClientPrint | UO.ClientPrint |
| Info Window | UO.FillInfoWindow · UO.ClearInfoWindow · UO.FillNewWindow |
| Text Window | UO.TextOpen · UO.TextPrint · UO.TextClear · UO.TextClose |
| Simple Gumps | UO.CloseSimpleGump |
| Close UI Window | UO.CloseClientUIWindow |
| Circle Transparency | UO.CircleTrans |
| Show Z | UO.SetShowZ |
| Open IDE | UO.OpenIDE |
UO.Print · UO.ClientPrint · UO.ClientPrintEx · UO.CharPrint · UO.ColorPrint · UO.ConsolePrint · UO.ServerPrint · UO.SetSilentMode · UO.ConColor · UO.FontColor
UO.ClearInfoWindow · UO.FillInfoWindow · UO.FillNewWindow · UO.TextOpen · UO.TextClear · UO.TextClose · UO.TextPrint · UO.CloseSimpleGump · UO.CloseClientUIWindow · UO.ShowJournal · UO.OpenIDE · UO.HelpRequest · UO.ActivateHandle · UO.CloseHandle · UO.Snap
UO.Hide · UO.ClientHide · UO.ClientMarkChar · UO.CircleTrans · UO.SetShowZ · UO.Morph
UO.AddFigure · UO.UpdateFigure · UO.RemoveFigure · UO.ClearFigures
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 processed = 12;
UO.Print("Processed item entries: " + Convert.ToString(processed), 0x0044);Parameters, result and all scenarios
UO.FillInfoWindow("Status ready");Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.ActivateHandle();Requests Windows/SDL to bring the current client window to the front. There are no arguments or results. This is a window command, not an item, skill, or target application; actual focus depends on the window system.
There are no parameters.
void. The call only requests activation of the window; it doesn't acknowledge that the windowing system brought it to the foreground.
- The client raises the game view window via SDL. The command does not send a game packet or perform an action in the world. A minimized window or limitations of the window system may prevent actual focus.
- RequireGameView requires Client.Game. If the ClassicUO graphics window is not open, bridge throws InvalidOperationException. SDL_RaiseWindow requests that an existing window be raised; The decision about focus is left to the window system.
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.ActivateHandle");
UO.ActivateHandle();Parameters and execution flow:
- Request that the client window be brought to the foreground.
UO.ActivateHandle();Parameters and execution flow:
- Do not request window focus before connecting to the game.
return RunScenario();
object? RunScenario()
{
if (Truth(UO.Connected()))
{
UO.ActivateHandle();
}
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:
- Wrap the window action into a reusable procedure.
- Execute the request through an auxiliary procedure.
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()
{
RunAction();
return null;
}
void RunAction()
{
UO.ActivateHandle();
}
}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.ActivateHandle. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ActivateHandle:bridge.ActivateHandle().
Internal implementation code; this is not a standalone script.
public void ActivateHandle() => bridge.ActivateHandle();Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.AddFigure(object? figure);Adds a local figure to the ClassicUO world map and returns its ID. The figure is stored on the client side, the game server is not notified.
int is the positive ID of the added figure. 0 is returned if the figure data is incorrect or the card refuses to add it. Transfer the received ID to UO.UpdateFigure or UO.RemoveFigure.
- Creates a local figure for
WorldMapGump. Line, ellipse, rectangle, directional arrow and text are supported. ThefcWorldcoordinates follow the map transformation and scale;fcScreenare measured relative to the map window. The shapes for the selected facet are displayed.
Array format: [kind, coord, x1, y1, x2, y2, brushColor, brushStyle, color, worldNum, text]. kind: 0 line, 1 ellipse, 2 rectangle, 3 directional arrow, 4 text. coord: 0 world, 1 screen. color uses Delphi TColor (0x00BBGGRR) byte order. For an arrow with world coordinates and x2=0,y2=0, the starting point is the current character. Historical brushColor and brushStyle are adopted for compatibility; visual shading does not guarantee a complete match with Delphi.
The figure remains in the client collection until it is deleted/purged or the process ends. Changing facet only hides figures belonging to another facet.
- A minimum of 9 fields is accepted. If worldNum is missing, the current card is used; without text, an empty string is taken. kind is limited to 0..4, coord - 0..1; other meanings give 0. Negative worldNum allows display on any facet. The ID counter is incremented before SetYokoMapFigure is checked, so a rejected piece can leave a gap in ID. Collection WorldMapGump static in progress; regular scripts of one manager use a common persistent runtime state.
- brushColor and brushStyle are saved in the entry, but the current renderer does not use them. The line and rectangle are drawn as an outline; the ellipse consists of 32 segments. The text signature is drawn only for kind=4; other kinds don't output it. color specifies the outline in the format COLORREF 0x00BBGGRR.
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.AddFigure(new object?[] { 0, 0, UO.X(), UO.Y(), UO.X() + 3, UO.Y(), 0, 0, 255 });
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- kind=2 draws a red outline. The text field with the value Area is saved, but for this kind the label is not drawn; the text outputs kind=4.
dynamic[] fig = new dynamic[checked((int)(11) + 1)];
fig[0] = 2;
fig[1] = 0;
fig[2] = UO.GetX("self")-3;
fig[3] = UO.GetY("self")-3;
fig[4] = UO.GetX("self")+3;
fig[5] = UO.GetY("self")+3;
fig[6] = 0;
fig[7] = 1;
fig[8] = 255;
fig[9] = UO.WorldNum();
fig[10] = "Area";
var figureId = UO.AddFigure(fig);Parameters and execution flow:
- With world coordinates and x2=0,y2=0 the beginning of the arrow is taken from the character’s position when drawn. text with the value East for kind=3 is not output.
return RunScenario();
object? RunScenario()
{
dynamic[] dirFig = new dynamic[checked((int)(11) + 1)];
dirFig[0] = 3;
dirFig[1] = 0;
dirFig[2] = UO.GetX("self") + 10;
dirFig[3] = UO.GetY("self");
dirFig[4] = 0;
dirFig[5] = 0;
dirFig[6] = 0;
dirFig[7] = 1;
dirFig[8] = 65280;
dirFig[9] = UO.WorldNum();
dirFig[10] = "East";
var arrowId = UO.AddFigure(dirFig);
return null;
}Parameters and execution flow:
- Create a blue line between two points of the current facet.
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()
{
dynamic[] lineFig = new dynamic[checked((int)(11) + 1)];
lineFig[0] = 0;
lineFig[1] = 0;
lineFig[2] = UO.GetX("self");
lineFig[3] = UO.GetY("self");
lineFig[4] = UO.GetX("self") + 8;
lineFig[5] = UO.GetY("self");
lineFig[6] = 0;
lineFig[7] = 1;
lineFig[8] = 16711680;
lineFig[9] = UO.WorldNum();
lineFig[10] = "";
var lineId = UO.AddFigure(lineFig);
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: figure (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::TryMapFigureArg:TryMapFigureArg(0, out int[] figure, out string figureText). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetMapFigure:bridge.SetMapFigure(id, figure[0], figure[1], figure[2], figure[3], figure[4], figure[5], figure[6], figure[7], figure[8], figure[9], figureText). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::SerializeMapFigure:SerializeMapFigure(figure, figureText).
Internal implementation code; this is not a standalone script.
case "addfigure":
{
if (!TryMapFigureArg(0, out int[] figure, out string figureText))
return InjectionValue.Zero;
int id = state.NextMapFigureId++;
if (bridge.SetMapFigure(id, figure[0], figure[1], figure[2], figure[3], figure[4], figure[5], figure[6], figure[7], figure[8], figure[9], figureText) == 0)
return InjectionValue.Zero;
state.MapFigures[id] = SerializeMapFigure(figure, figureText);
return new InjectionValue(id);
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.CharPrint(object? color, object? msg);
void UO.CharPrint(object? id, object? color, object? msg);Creates an inscription visible only to you above the loaded object: for example, a mark of the selected target or a warning above your character. This is not the character's speech or the message at the bottom of the game window.
-
id— Serial of the object, not graphic/type or coordinate. UO.CharPrint in three-argument form also understands self, lasttarget, and stored object names. For SenderID in UO.ClientPrintEx use a number, such as UO.Hex2Int(UO.GetSerial("self")); string aliases are not resolved as objects there. -
coloris UO hue, not RGB. The least significant 16 bits of the number are taken; 0x0044 is an example. -1 becomes 0xFFFF rather than meaning "any color". The color ConColor is not used here.
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 object must exist in the loaded world and not be deleted; empty text or missing target are not drawn. The command does not download the object from the server. The server and other players do not receive this message. Without the game window, the inscription cannot be seen in the world; it is not a replacement for the manager's syslog.
- UO.CharPrint(color, msg) selects his character. UO.CharPrint(id, color, msg) selects the specified object. Both forms use the font 3. UO.ClientPrintEx requires all four arguments in the order SenderID, Color, Font, Text.
- The font number is UO, not the point size or Windows font name. The number is limited to the range 0..255; The availability of a specific font depends on the game files. In the example, 3 is the normal font number.
- GetSerial returns a hex string. Hex2Int turns it into an int before comparing it with the number 0; the string "0x00000000" cannot be checked as the number 0.
- 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.CharPrint");
UO.CharPrint(0x0044, "Ready");Parameters and execution flow:
- The first form CharPrint places Ready above its character. ClientPrintEx receives its serial via UO.Hex2Int(UO.GetSerial("self")) and explicitly passes the font to 3. The inscription does not include any game mode.
- GetSerial returns a hex string. Hex2Int turns it into an int before comparing it with the number 0; the string "0x00000000" cannot be checked as the number 0.
UO.CharPrint(0x0044, "Ready");Parameters and execution flow:
- target — serial of the last target. Zero means that there is no one to tag in this example. Selected target - local signature only: the target is not attacked and the active server target is not filled.
- GetSerial returns a hex string. Hex2Int turns it into an int before comparing it with the number 0; the string "0x00000000" cannot be checked as the number 0.
return RunScenario();
object? RunScenario()
{
var target = UO.Hex2Int(UO.GetSerial("lasttarget"));
if (Truth(target != 0))
{
UO.CharPrint(target, 0x0044, "Selected target");
}
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:
- ShowWeightWarning is declared in full below. She compares the weight to a positive known limit and writes over her character only when overloaded; doesn't throw anything away. Convert.ToString turns the weight into text.
- GetSerial returns a hex string. Hex2Int turns it into an int before comparing it with the number 0; the string "0x00000000" cannot be checked as the number 0.
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()
{
ShowWeightWarning(UO.Weight(), UO.MaxWeight());
return null;
}
void ShowWeightWarning(dynamic weight, dynamic maximum)
{
if (Truth(maximum > 0) && Truth(weight >= maximum))
{
UO.CharPrint(UO.Hex2Int(UO.GetSerial("self")), 0x0044, "Too heavy: " + Convert.ToString(weight));
}
}
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: color (Integer/String), msg (String)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.CharPrint. -
InjectionScript.Runtime.InjectionApiUO.CharPrint:CharPrint(bridge.Self, color, msg). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
Internal implementation code; this is not a standalone script.
public void CharPrint(int color, string msg) => CharPrint(bridge.Self, color, msg);Parameters: color (Integer/String), msg (String)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.CharPrint. -
InjectionScript.Runtime.InjectionApiUO.CharPrint:CharPrint(bridge.Self, NumberConversions.ToInt(color), msg). -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(color). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
Internal implementation code; this is not a standalone script.
public void CharPrint(string color, string msg) => CharPrint(bridge.Self, NumberConversions.ToInt(color), msg);Parameters: id (Any/Integer), color (Any/Integer), msg (Any/String)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.CharPrint. -
InjectionScript.Runtime.InjectionApiUO.CharPrint:CharPrint(GetObject(id), NumberConversions.ToInt(color), (string)msg). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(id). -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(color).
Internal implementation code; this is not a standalone script.
public void CharPrint(InjectionValue id, InjectionValue color, InjectionValue msg)
=> CharPrint(GetObject(id), NumberConversions.ToInt(color), (string)msg);Parameters: id (Any/Integer), color (Any/Integer), msg (Any/String)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.CharPrint. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.CharPrint:bridge.CharPrint(id, color, msg).
Internal implementation code; this is not a standalone script.
public void CharPrint(int id, int color, string msg) => bridge.CharPrint(id, color, msg);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.CircleTrans();
void UO.CircleTrans(object? enabled);Reads or changes the active profile's transparency circle setting.
-
enabled- int: 0 disables, any non-zero value enables. Without an argument, the setting is read only.
Without argument int 1/0; the form with an argument returns null.
- Reading in the absence of a profile gives 0. An entry with no profile prints an error; if there is a profile, changes UseCircleOfTransparency and saves the profile. This is a visual customization of the client.
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.CircleTrans();
UO.Print("CircleTrans: " + Convert.ToString(result));Parameters and execution flow:
- Reading does not change the profile.
var enabled = UO.CircleTrans();
UO.Print(Convert.ToString(enabled));Parameters and execution flow:
- The recording keeps the transparency circle turned on.
return RunScenario();
object? RunScenario()
{
UO.CircleTrans(1);
return null;
}Parameters and execution flow:
- The saved flag is restored after a temporary change of 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()
{
var previous = UO.CircleTrans();
UO.CircleTrans(0);
UO.CircleTrans(previous);
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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.CircleTrans. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.CircleTrans:bridge.CircleTrans().
Internal implementation code; this is not a standalone script.
public int CircleTrans() => bridge.CircleTrans();Parameters: enabled (Integer)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.CircleTrans. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.CircleTrans:bridge.CircleTrans(enabled).
Internal implementation code; this is not a standalone script.
public void CircleTrans(int enabled) => bridge.CircleTrans(enabled);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.ClearFigures();Deletes all custom map shapes and their runtime entries.
There are no parameters.
void - no return value.
- Clears WorldMapGump.ClearYokoMapFigures and state.MapFigures. The base map and UserStatics are not changed.
- ClearYokoMapFigures clears WorldMapGump's static collection in progress, then the command clears MapFigures of its runtime state. This cleanup scope is determined by the overall client collection, not just the name of the calling script.
- Regular custom map labels (userMarkers.usr) are retained.
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.ClearFigures");
UO.ClearFigures();Parameters and execution flow:
- Deletes all custom map shapes and their runtime entries.
UO.ClearFigures();Parameters and execution flow:
- Create a local shape for the current map, then delete all custom shapes.
return RunScenario();
object? RunScenario()
{
dynamic[] figure = new dynamic[checked((int)(9) + 1)];
figure[0] = 0;
figure[1] = 0;
figure[2] = UO.GetX();
figure[3] = UO.GetY();
figure[4] = figure[2] + 1;
figure[5] = figure[3] + 1;
figure[6] = 0;
figure[7] = 0;
figure[8] = 0;
figure[9] = UO.WorldNum();
var figureId = UO.AddFigure(figure);
UO.ClearFigures();
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.ClearFigures();
UO.ClearFigures();
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.ClearMapFigures:bridge.ClearMapFigures().
Internal implementation code; this is not a standalone script.
case "clearfigures":
bridge.ClearMapFigures();
state.MapFigures.Clear();
return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.ClearInfoWindow();Clears the lines of the client text window.
There are no parameters.
void - no return value.
- TextClear clears the buffer; if the window was open, updates it with empty content. The window does not necessarily close.
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.ClearInfoWindow");
UO.ClearInfoWindow();Parameters and execution flow:
- Clears the lines of the client text window.
UO.ClearInfoWindow();Parameters and execution flow:
- Clear a previously added text window line.
return RunScenario();
object? RunScenario()
{
UO.FillInfoWindow("status");
UO.ClearInfoWindow();
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.ClearInfoWindow();
UO.ClearInfoWindow();
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.TextClear:bridge.TextClear().
Internal implementation code; this is not a standalone script.
case "clearinfowindow": bridge.TextClear(); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.ClientHide(object? objID);Hides by serial a loaded item or other character only in the ClassicUO display, including containers, paperdoll and equipped items.
-
objID— Serial of the specific loaded object: int or hex/decimal string. This is not a graphic/type. For a saved name, use GetSerial(name). The parameter is required; the sight does not appear.
int 1 after transmitting the bridge command. The historical result does not confirm the presence of the object: even for an unknown serial or self bridge outputs a failure, and runtime returns 1. Do not use this value as a test for successful hiding. The compatibility metadata shows object?.
- Exactly one argument is required. To select with the mouse, use UO.Hide().
- Hide(serial) acts immediately on a known loaded object. Pass serial of a specific stack/item, not graphic/type. The selected stack is hidden entirely, regardless of Amount.
- The item remains in the container: quantity, owner, contents and server state do not change. FindType/GetContent can still find it. Hiding is not a search filter, carryover, deletion, Hiding skill, or server-side invisibility.
- The normal container, trade window and loot grid do not draw the hidden item and do not accept clicks/drags on it. The flag persists when the window is rebuilt and reopened while the same loaded object is in use.
- The equipped item disappears from the paperdoll, from the small slot and from the character image. It remains equipped: the layer, armor and state on the server do not change. The hidden robe no longer overlaps the underwear. The character image in the manager is updated using the same flag; the list of actual equipment remains available.
- Hide does not hide his own character, land and static. A non-existent serial gives a message. Hiding the bag itself does not close the contents window that is already open, nor does it automatically hide each item that is included.
- There is no separate Unhide command in the current API. Hiding belongs to the loaded object instance: removing it from the client world and loading it again (for example, when reconnecting) resets the flag. Simply closing/opening a chest is not a guaranteed way to return an item.
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.ClientHide(0x40001234);
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- ObjID is a specific item, not its type. It disappears from the display, remaining in its container.
var item = 0x40001234;
if (Truth(UO.Exists(item)))
{
UO.ClientHide(item);
}
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:
- FindType searches for graphic 0x0EED of any color in the backpack. The returned serial is transmitted to ClientHide; the entire stack is hidden entirely.
return RunScenario();
object? RunScenario()
{
var item = UO.FindType(0x0EED, -1, "backpack");
if (Truth(item != ""))
{
UO.ClientHide(item);
UO.Print("Amount is still: " + Convert.ToString(UO.GetQuantity(item)));
}
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:
- GetSerial resolves the previously saved decoration name. The item must first be loaded, such as opening its container.
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 item = UO.GetSerial("decoration");
if (Truth(UO.Exists(item)) && Truth(item != UO.GetSerial("self")))
{
UO.ClientHide(item);
}
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: objID (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ClientHide:bridge.ClientHide(Arg(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "clienthide": bridge.ClientHide(Arg(0)); return InjectionValue.True;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.ClientMarkChar(object? actionIndex, object? id);Updates client labels LastTarget and/or LastAttack.
-
actionIndex- int: 1 - LastTarget; 2 - LastAttack; 3 - both. Other values print an error. -
id— Serial of the object or supported name of self/backpack/lasttarget/saved object; numeric strings and 0x strings are resolved by runtime.
void - no return value.
- ClientMarkChar modifies saved targets without sending an attack or responding to the server target. Subsequent commands can use the new label.
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.ClientMarkChar");
UO.ClientMarkChar(1, "self");Parameters and execution flow:
- The saved target becomes your own character.
UO.ClientMarkChar(1,"self");Parameters and execution flow:
- The latter target is used for both client tags.
return RunScenario();
object? RunScenario()
{
var target = UO.LastTarget();
if (Truth(UO.Exists(target)))
{
UO.ClientMarkChar(3, target);
}
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:
- Zero is not part of the action set and results in an error message.
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.ClientMarkChar(0, "self");
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: actionIndex (Any), id (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ClientMarkChar. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ClientMarkChar:bridge.ClientMarkChar(NumberConversions.ToInt(actionIndex), GetObject(id)). -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(actionIndex). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(id).
Internal implementation code; this is not a standalone script.
public void ClientMarkChar(InjectionValue actionIndex, InjectionValue id)
=> bridge.ClientMarkChar(NumberConversions.ToInt(actionIndex), GetObject(id));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.ClientPrint(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 and has no return value (void). The message text appears directly in the call.
UO.ClientPrint("Hello from C#");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.ClientPrint("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.ClientPrint("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.ClientPrint("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.ClientPrintEx(object? senderID, object? color, object? font, object? text);Creates an inscription visible only to you above the loaded object: for example, a mark of the selected target or a warning above your character. This is not the character's speech or the message at the bottom of the game window.
-
senderID— Serial of the object, not graphic/type or coordinate. UO.CharPrint in three-argument form also understands self, lasttarget, and stored object names. For SenderID in UO.ClientPrintEx use a number, such as UO.Hex2Int(UO.GetSerial("self")); string aliases are not resolved as objects there. -
coloris UO hue, not RGB. The least significant 16 bits of the number are taken; 0x0044 is an example. -1 becomes 0xFFFF rather than meaning "any color". The color ConColor is not used here. -
font— Font number UO, not the point size or Windows font name. The number is limited to the range 0..255; The availability of a specific font depends on the game files. In the example, 3 is the normal font number.
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 object must exist in the loaded world and not be deleted; empty text or missing target are not drawn. The command does not download the object from the server. The server and other players do not receive this message. Without the game window, the inscription cannot be seen in the world; it is not a replacement for the manager's syslog.
- UO.CharPrint(color, msg) selects his character. UO.CharPrint(id, color, msg) selects the specified object. Both forms use the font 3. UO.ClientPrintEx requires all four arguments in the order SenderID, Color, Font, Text.
- The font number is UO, not the point size or Windows font name. The number is limited to the range 0..255; The availability of a specific font depends on the game files. In the example, 3 is the normal font number.
- GetSerial returns a hex string. Hex2Int turns it into an int before comparing it with the number 0; the string "0x00000000" cannot be checked as the number 0.
- 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.ClientPrintEx");
UO.ClientPrintEx(UO.Hex2Int(UO.GetSerial("self")), 0x0044, 3, "Ready");Parameters and execution flow:
- The first form CharPrint places Ready above its character. ClientPrintEx receives its serial via UO.Hex2Int(UO.GetSerial("self")) and explicitly passes the font to 3. The inscription does not include any game mode.
- GetSerial returns a hex string. Hex2Int turns it into an int before comparing it with the number 0; the string "0x00000000" cannot be checked as the number 0.
UO.ClientPrintEx(UO.Hex2Int(UO.GetSerial("self")), 0x0044, 3, "Ready");Parameters and execution flow:
- target — serial of the last target. Zero means that there is no one to tag in this example. Selected target - local signature only: the target is not attacked and the active server target is not filled.
- GetSerial returns a hex string. Hex2Int turns it into an int before comparing it with the number 0; the string "0x00000000" cannot be checked as the number 0.
return RunScenario();
object? RunScenario()
{
var target = UO.Hex2Int(UO.GetSerial("lasttarget"));
if (Truth(target != 0))
{
UO.ClientPrintEx(target, 0x0044, 3, "Selected target");
}
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:
- ShowWeightWarning is declared in full below. She compares the weight to a positive known limit and writes over her character only when overloaded; doesn't throw anything away. Convert.ToString turns the weight into text.
- GetSerial returns a hex string. Hex2Int turns it into an int before comparing it with the number 0; the string "0x00000000" cannot be checked as the number 0.
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()
{
ShowWeightWarning(UO.Weight(), UO.MaxWeight());
return null;
}
void ShowWeightWarning(dynamic weight, dynamic maximum)
{
if (Truth(maximum > 0) && Truth(weight >= maximum))
{
UO.ClientPrintEx(UO.Hex2Int(UO.GetSerial("self")), 0x0044, 3, "Too heavy: " + Convert.ToString(weight));
}
}
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: senderID (Any), color (Any), font (Any), text (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.CharPrintEx:bridge.CharPrintEx(Arg(0), Arg(1), Arg(2), Text(3)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(3).
Internal implementation code; this is not a standalone script.
case "clientprintex":
bridge.CharPrintEx(Arg(0), Arg(1), Arg(2), Text(3)); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.CloseClientUIWindow(object? uiWindowType, object? id);Closes the local client window of the specified type for a specific object. For example, you can remove the character's paper doll, his status, or the backpack window. The command does not close the game client and does not respond to server gump buttons.
-
uiWindowType— Mandatory numeric window code: 0 — paperdoll (equipment), 1 — character status, 2 — profile, 3 — container. This is a separate list of four codes, not the graphic/type of the body and not the ID server gump. Other numbers do not find the window. -
id— Serial of the object to which the window belongs: self/serial of the character for types 0..2, backpack/serial of the container for type 3. Accepts a number, a hex string, or a resolvable object alias. This is not the window number in the list InfoGumps. An unknown object alias is converted to 0.
void - no value. The call is written on a separate line, without var result = and without if UO.CloseClientUIWindow(...). If there is no suitable open window, nothing happens; the command does not return true/false.
- Both parameters are required. Both the window class and LocalSerial are compared. Calling with (3, self) does not mean backpack: the backpack requires backpack.
- The bypass affects open, not yet destroyed windows of this type/serial; all matching windows are closed on the game thread. The remaining windows remain open.
- The interface closes, items are not removed from the container, and the character does not disappear from the world. It's safe to repeat: if the window is already closed, there is no match.
- For server-side dialogs, study UO.CloseSimpleGump and UO.NumGumpButton; the codes 0..3 of this command do not apply there.
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.CloseClientUIWindow");
UO.CloseClientUIWindow(0, "self");Parameters and execution flow:
- Only the window for your character’s equipment closes; his status, profile and backpack remain separate windows.
UO.CloseClientUIWindow(0, "self");Parameters and execution flow:
- If the backpack was not opened, the action will not change anything. This command does not move items and does not return a result.
return RunScenario();
object? RunScenario()
{
if (Truth(UO.Connected()) && Truth(UO.Exists("backpack")))
{
UO.CloseClientUIWindow(3, "backpack");
}
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:
- 1 - status, 2 - profile. id — serial of the selected mobile. ASC(text,0) here parses the string serial into a number with a spare 0. The user procedure does not promise anything about the presence of a window; both calls have Unit.
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 selected = Asc(UO.GetSerial("lasttarget"), 0);
CloseMobilePanels(selected);
return null;
}
void CloseMobilePanels(dynamic id)
{
if (Truth(id == 0) || !(Truth(UO.Exists(id))))
{
return;
}
UO.CloseClientUIWindow(1, id);
UO.CloseClientUIWindow(2, id);
}
int Asc(object? value, int fallback = 0)
{
string text = Convert.ToString(value) ?? "";
if (text.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
return int.TryParse(text[2..], System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture, out int hex) ? hex : fallback;
return int.TryParse(text, out int number) ? number : fallback;
}
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: uiWindowType (Any), id (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.CloseClientWindow:bridge.CloseClientWindow(Arg(0), Arg(1)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "closeclientuiwindow": bridge.CloseClientWindow(Arg(0), Arg(1)); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.CloseHandle();Requests the current client application to exit via Client.Game.Exit.
There are no parameters.
void - no return value.
- CloseUO is sent to the same bridge.CloseHandle. Exit is executed on the game thread; if Client.Game is missing, there is no action. The command is not a shutdown of a separate gump.
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.CloseHandle");
UO.CloseHandle();Parameters and execution flow:
- The call requests termination of the client application.
UO.CloseHandle();Parameters and execution flow:
- The example shows a controlled condition; the value 0 keeps the client open.
return RunScenario();
object? RunScenario()
{
var finishClient = 0;
if (Truth(finishClient))
{
UO.CloseHandle();
}
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:
- A fully declared helper allows for explicit exit enablement.
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()
{
FinishClient(0);
return null;
}
void FinishClient(dynamic enabled)
{
if (Truth(enabled))
{
UO.CloseHandle();
}
}
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: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.CloseHandle. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.CloseHandle:bridge.CloseHandle().
Internal implementation code; this is not a standalone script.
public void CloseHandle() => bridge.CloseHandle();Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.CloseSimpleGump(object? gumpIndex);Locally closes a server gump that is allowed to be closed by a strict index.
-
gumpIndex— Mandatory int — index of the active server gump, from 0 to GetGumpsCount()-1. This is not GumpID/serial. Negative number and index outside the list are invalid. Opening, closing, and reordering windows can change the index; check GetGumpID/GetGumpSerial before acting.
void - returns nothing. The result cannot be interpreted as server confirmation or bool.
- Works with active server gumps. Backpack, map, settings and other local windows are not included in this list. One call reads data in the game thread; different calls may see different states of the list.
- Invalid index and NoClose do not change anything. The command does not send the button response to the server. For this answer, use SendGumpSelect.
- Closing modifies the list and indexes. To mass close, traverse the list from the last index to the first.
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.CloseSimpleGump");
UO.CloseSimpleGump(0);Parameters and execution flow:
- 0 is an index, not ID. If the window prohibits closing, it remains open.
UO.CloseSimpleGump(0);Parameters and execution flow:
- Reverse traversal reduces the impact of post-closing index shifts. When opening new windows in parallel, check the list again.
return RunScenario();
object? RunScenario()
{
var i = UO.GetGumpsCount() - 1;
while (Truth(i >= 0))
{
UO.CloseSimpleGump(i);
i = i - 1;
}
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:
- info[1] - saved GumpID. The action does not return anything, so the result is not assigned to the variable.
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 info = UO.GetGumpInfo(0);
if (Truth(ArrayLength(info) == 5))
{
UO.CloseSimpleGump(0);
UO.Print(Hex(info[1]));
}
return null;
}
int ArrayLength(object? value) => value is System.Array array ? array.Length : 0;
string Hex(object? value) => Convert.ToInt64(value).ToString("X");
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: gumpIndex (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.CloseSimpleGump:bridge.CloseSimpleGump(Arg(0)).
Internal implementation code; this is not a standalone script.
case "closesimplegump":
if (bridge is IApiGumpAccess gumpAccess) gumpAccess.CloseGumpAtIndex(Arg(0));
else bridge.CloseSimpleGump(Arg(0));
return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.ColorPrint(object? color, object? msg);Shows a local message about script progress or stopping condition. You see it, not other players.
-
coloris UO hue, not RGB. Number or hex string; the bridge uses the least significant 16 bits. Not to be confused with graphic/type. 0x0044 in the example is the selected hue. Without color, hue 0x03B2 is used. UO.Print(text, color) accepts text first; UO.ColorPrint(color, text) – color first.
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. - Without color, hue 0x03B2 is used. UO.Print(text, color) accepts text first; UO.ColorPrint(color, text) – color first.
- 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 and has no return value (void). The message text appears directly in the call.
UO.ColorPrint(0x0044, "Hello from C#");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.ColorPrint(0x0044, "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.ColorPrint(0x0044, "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.ColorPrint(0x0044, "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: color (Any), msg (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ColorPrint. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Print:bridge.Print(NumberConversions.ToInt(color), msg.ToString()). -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(color). -
InjectionScript.Runtime.InjectionValue.ToString:msg.ToString().
Internal implementation code; this is not a standalone script.
public void ColorPrint(InjectionValue color, InjectionValue msg) => bridge.Print(NumberConversions.ToInt(color), msg.ToString());Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.ConColor(object? color);Sets UO hue for subsequent system messages of this script runtime.
-
coloris UO hue, not RGB. Number or hex string; the bridge uses the low 16 bits. Not to be confused with graphic/type. 0x0044 in the example is the selected hue.
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.
- Affects subsequent UO.ClientPrint, UO.AddToJournal and UO.AddToSystemJournal. Does not recolor previous lines, does not change the SpeechHue profile, and does not change the color of UO.Print without a color argument. The old color getter is not here: store the selected normal hue in its own variable.
- 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.ConColor");
UO.ConColor(0x0044);Parameters and execution flow:
- 0x0044 becomes the color of the next system line. ConColor itself does not print anything.
UO.ConColor(0x0044);
UO.AddToSystemJournal("Notice");Parameters and execution flow:
- Normal Print retains its color 0x03B2, and AddToJournal uses the specified 0x0044. Both messages are local.
return RunScenario();
object? RunScenario()
{
UO.ConColor(0x0044);
UO.Print("Normal Print color");
UO.AddToJournal("System color");
return null;
}Parameters and execution flow:
- usualHue=0x0440 is clearly the selected normal color, not the old value read. The try uses the temporary 0x0035;
finallyreturns usualHue, then the next line is printed in normal color again.
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 usualHue = 0x0440;
UO.ConColor(usualHue);
try
{
UO.ConColor(0x0035);
UO.AddToSystemJournal("Temporary warning");
}
finally
{
UO.ConColor(usualHue);
}
UO.AddToSystemJournal("Normal messages again");
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: color (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ConColor. -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(color).
Internal implementation code; this is not a standalone script.
public void ConColor(InjectionValue color)
{
systemMessageColor = NumberConversions.ToInt(color);
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.ConsolePrint(object? msg);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. - Without color, hue 0x03B2 is used. UO.Print(text, color) accepts text first; UO.ColorPrint(color, text) – color first.
- Despite the Console in the name, this is the same local game output, not a separate Windows terminal.
- 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 and has no return value (void). The message text appears directly in the call.
UO.ConsolePrint("Hello from C#");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.ConsolePrint("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.ConsolePrint("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.ConsolePrint("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: msg (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ConsolePrint. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Print:bridge.Print(msg.ToString()). -
InjectionScript.Runtime.InjectionValue.ToString:msg.ToString().
Internal implementation code; this is not a standalone script.
public void ConsolePrint(InjectionValue msg) => bridge.Print(msg.ToString());Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.FillInfoWindow(object? s);Adds one line to a text window and displays it.
-
s— Line text; the value is converted to string.
void - no return value.
- Previously accumulated rows are retained up to the MaxTextWindowLines limit.
- TextPrint adds a line and shows YokoTextWindowGump itself; TextOpen secures the open state. When the buffer overflows, the oldest lines are deleted. This is a separate text window, not a server gump and not UO.GetInfo.
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.FillInfoWindow");
UO.FillInfoWindow("Status ready");Parameters and execution flow:
- The text is sent to the client text window.
UO.FillInfoWindow("Status ready");Parameters and execution flow:
- The string is formed from the local current HP.
return RunScenario();
object? RunScenario()
{
var status = "HP: " + Convert.ToString(UO.GetHP());
UO.FillInfoWindow(status);
return null;
}Parameters and execution flow:
- The second command adds second after first.
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.FillInfoWindow("first");
UO.FillInfoWindow("second");
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: s (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.TextPrint:bridge.TextPrint(Text(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.TextOpen:bridge.TextOpen().
Internal implementation code; this is not a standalone script.
case "fillinfowindow":
bridge.TextPrint(Text(0));
bridge.TextOpen();
return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.FillNewWindow(object? s);Clears the text window, adds one line and shows it.
-
s— Line text; the value is converted to string.
void - no return value.
- Before TextPrint, TextClear is executed; previously accumulated rows are deleted.
- TextPrint adds a line and shows YokoTextWindowGump itself; TextOpen secures the open state. When the buffer overflows, the oldest lines are deleted. This is a separate text window, not a server gump and not UO.GetInfo.
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.FillNewWindow");
UO.FillNewWindow("Status ready");Parameters and execution flow:
- The text is sent to the client text window.
UO.FillNewWindow("Status ready");Parameters and execution flow:
- The string is formed from the local current HP.
return RunScenario();
object? RunScenario()
{
var status = "HP: " + Convert.ToString(UO.GetHP());
UO.FillNewWindow(status);
return null;
}Parameters and execution flow:
- The second command replaces the contents: what remains is second.
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.FillNewWindow("first");
UO.FillNewWindow("second");
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: s (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.TextClear:bridge.TextClear(). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.TextPrint:bridge.TextPrint(Text(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.TextOpen:bridge.TextOpen().
Internal implementation code; this is not a standalone script.
case "fillnewwindow": bridge.TextClear(); bridge.TextPrint(Text(0)); bridge.TextOpen(); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.FontColor(object? color);Sets the hue of subsequent local UO.UOAMessage of this script. Does not change the character's speech color, normal UO.Print, InfoFindList, or IDE theme.
-
color— Mandatory numeric index hue 0..65535, for example 0x0044. This is not RGB. An int is stored inside and is converted to ushort when output; -1 does NOT mean reset and becomes 65535. The initial value of the new runtime is 0x03B2. There is no form without an argument.
void: no result, old color or success sign. To revert your customization later, store the selected hue in a script variable.
- Only changes state.FontColor, does not print a message or send a network packet.
- Valid until the next FontColor in the same runtime. Another independent script has its own state. UO.Print(text,color) sets the color directly and does not read FontColor.
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.FontColor");
UO.FontColor(0x0021);Parameters and execution flow:
- 0x0021 — hue index; The final shade depends on the client's hues files. The message is visible locally; it is not spoken by the character.
UO.FontColor(0x0021);
var first = UO.FindList("0x0EED", "backpack");
if (Truth(first == ""))
{
UO.UOAMessage("No gold in the loaded backpack");
}
else
{
UO.UOAMessage("Gold units: " + Convert.ToString(UO.FindFullQuantity()));
}
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:
- Full Notice accepts text and hue. The last set hue remains for the next UOAMessage of this runtime. There is no built-in FontColor() for reading here.
return RunScenario();
object? RunScenario()
{
Notice("Supplies checked", 0x0044);
Notice("Restock needed", 0x0021);
return null;
}
void Notice(dynamic text, dynamic hue)
{
UO.FontColor(hue);
UO.UOAMessage(text);
}Parameters and execution flow:
- 0x03B2 — initial value FontColor of the new runtime. Finally returns exactly the selected base on normal completion/error handling; it does not restore the unknown previous value.
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 baseHue = 0x03B2;
try
{
UO.FontColor(0x0021);
UO.UOAMessage("Check the route before moving");
}
finally
{
UO.FontColor(baseHue);
}
UO.UOAMessage("Ready");
UO.Print("Regular Print keeps its own color");
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: color (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias. -
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias::Arg:Arg(0, state.FontColor).
Internal implementation code; this is not a standalone script.
case "fontcolor": state.FontColor = Arg(0, state.FontColor); break;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.HelpRequest();Requests the server help menu.
There are no parameters.
void - no value. Call on a separate line; completion does not confirm the server's action.
- ExecuteClientApiCompatibility calls HelpRequest, which sends GameActions.RequestHelp via Invoke. The contents of the menu are determined by the server.
- In the examples, UO.Wait specifies only a script pause; the end of the pause does not prove that the server has completed the request.
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.HelpRequest");
UO.HelpRequest();Parameters and execution flow:
- Requests the server help menu.
UO.HelpRequest();Parameters and execution flow:
- ExecuteClientApiCompatibility calls HelpRequest, which sends GameActions.RequestHelp via Invoke. The contents of the menu are determined by the server.
return RunScenario();
object? RunScenario()
{
if (Truth(UO.IsOnline()))
{
UO.HelpRequest();
}
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:
- In the examples, UO.Wait specifies only a script pause; the end of the pause does not prove that the server has completed the request.
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.IsOnline()))
{
UO.HelpRequest();
UO.Print("Help requested");
}
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: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.HelpRequest:bridge.HelpRequest().
Internal implementation code; this is not a standalone script.
case "helprequest": bridge.HelpRequest(); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.Hide();
void UO.Hide(object? serial);Removes a loaded item or other character from the ClassicUO screen. Helps remove interfering objects; works with items inside containers and trade, equipped items on the paperdoll and in its small equipment slots.
-
serial— Numeric serial or its hex/decimal string. This is not type. For a named object, first obtain the numeric string via GetSerial(name). Without an argument, a local target appears.
void - no return value. The result cannot be assigned as serial, graphic/type, quantity or true/false. The information is output to the interface/log rather than returned to the script.
- Hide() opens a local crosshair and immediately returns control to the script. Click on an item on the paperdoll, an item in an open container, or an object in the world. Escape cancels the selection.
- Hide(serial) acts immediately on a known loaded object. Pass serial of a specific stack/item, not graphic/type. The selected stack is hidden entirely, regardless of Amount.
- The item remains in the container: quantity, owner, contents and server state do not change. FindType/GetContent can still find it. Hiding is not a search filter, carryover, deletion, Hiding skill, or server-side invisibility.
- The normal container, trade window and loot grid do not draw the hidden item and do not accept clicks/drags on it. The flag persists when the window is rebuilt and reopened while the same loaded object is in use.
- The equipped item disappears from the paperdoll, from the small slot and from the character image. It remains equipped: the layer, armor and state on the server do not change. The hidden robe no longer overlaps the underwear. The character image in the manager is updated using the same flag; the list of actual equipment remains available.
- Hide does not hide his own character, land and static. A non-existent serial gives a message. Hiding the bag itself does not close the contents window that is already open, nor does it automatically hide each item that is included.
- There is no separate Unhide command in the current API. Hiding belongs to the loaded object instance: removing it from the client world and loading it again (for example, when reconnecting) resets the flag. Simply closing/opening a chest is not a guaranteed way to return an item.
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.Hide");
UO.Hide();Parameters and execution flow:
- There are no parameters. After clicking, only the selected item disappears; The contents of the chest on the server do not change.
UO.Hide();
UO.Print("Select an item to hide locally");Parameters and execution flow:
- Hide gets ID of the search result, not 0x0EED. If there is no result, the call is not executed. Unit from Hide cannot be compared with true/false.
return RunScenario();
object? RunScenario()
{
var item = UO.FindType(0x0EED, -1, "backpack");
if (Truth(item == ""))
{
UO.Print("No loaded matching item");
return null;
}
UO.Hide(item);
UO.Print("Stack amount: " + Convert.ToString(UO.GetQuantity(item)));
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 named object is first resolved via GetSerial. The Exists check means presence in memory, not successful hiding or availability for migration.
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 item = UO.GetSerial("decoration");
if (Truth(UO.Exists(item)) && Truth(item != UO.GetSerial("self")))
{
UO.Hide(item);
}
else
{
UO.Print("Select a loaded object other than self");
}
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:
- 22 is the layer number, not serial or type. First ObjAtLayer gets serial, then Hide hides the image of that particular thing. Removal and transfer of the item are not performed; reopening paperdoll does not unhide it.
var robe = UO.ObjAtLayer(22);
if (Truth(robe == 0))
{
UO.Print("No robe equipped");
return null;
}
UO.Hide(robe);
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: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Hide. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.RequestInteractiveHideTarget:bridge.RequestInteractiveHideTarget().
Internal implementation code; this is not a standalone script.
public void Hide()
{
// Action command: the bridge owns UI/error reporting. A missing/non-interactive
// target surface must not turn a void compatibility command into a script failure.
bridge.RequestInteractiveHideTarget();
}Parameters: serial (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Hide. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ClientHide:bridge.ClientHide(NumberConversions.ToInt(serial)). -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(serial).
Internal implementation code; this is not a standalone script.
public void Hide(InjectionValue serial)
{
bridge.ClientHide(NumberConversions.ToInt(serial));
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.Morph(object? @type);Locally changes the current character's graphic.
-
type- int body graphic or type string resolved by ResolveType. 0 restores the graphic saved during the first Morph; a non-zero number is cast to ushort.
void - no value. Call on a separate line; completion does not confirm the server's action.
- Bridge.Morph without Player changes nothing. The first time it is called, it saves _originalGraphic, then assigns it to Player.Graphic. Runtime updates ticksAnim=Timer even if Player is missing.
- This is a local appearance, not a server transformation or a change in race/available skills. Values outside ushort are not checked by this bridge function and are reduced to 16 bits.
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.Morph");
UO.Morph("0x0190");Parameters and execution flow:
- Locally changes the current character's graphic.
UO.Morph("0x0190");Parameters and execution flow:
- Bridge.Morph without Player changes nothing. The first time it is called, it saves _originalGraphic, then assigns it to Player.Graphic. Runtime updates ticksAnim=Timer even if Player is missing.
return RunScenario();
object? RunScenario()
{
UO.Morph(0);
return null;
}Parameters and execution flow:
- This is a local appearance, not a server transformation or a change in race/available skills. Values outside ushort are not checked by this bridge function and are reduced to 16 bits.
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.Morph("0x0190");
UO.Wait(500);
UO.Morph(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: type (Integer/String)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Morph. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Morph:bridge.Morph(type). -
InjectionScript.Runtime.InjectionApiUO.Timer:Timer().
Internal implementation code; this is not a standalone script.
public void Morph(int type)
{
bridge.Morph(type);
ticksAnim = Timer();
}Parameters: type (Integer/String)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Morph. -
InjectionScript.Runtime.InjectionApiUO.Morph:Morph(ResolveType(type)). -
InjectionScript.Runtime.InjectionApiUO.ResolveType:ResolveType(type).
Internal implementation code; this is not a standalone script.
public void Morph(string type) => Morph(ResolveType(type));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.OpenIDE();
void UO.OpenIDE(object? filePath);-
filePath— Optional path. Blank/whitespace—open the editor without selecting a file; relative is resolved from _manager.AutoloadPath, absolute is preserved.
void - no value. Call on a separate line; completion does not confirm the server's action.
- Bridge.OpenIDE prepares the requested path, then Invoke calls YokoScriptEditorGump.Open(_world,requested). The script from the file is not run by the OpenIDE command.
- The editor is a graphical window, not an external Launch application. Reading/displaying the file depends on the existence of the path and editor logic.
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.OpenIDE");
UO.OpenIDE();Parameters and execution flow:
- Opens the graphic editor C# IDE.
UO.OpenIDE();Parameters and execution flow:
- Bridge.OpenIDE prepares the requested path, then Invoke calls YokoScriptEditorGump.Open(_world,requested). The script from the file is not run by the OpenIDE command.
return RunScenario();
object? RunScenario()
{
UO.OpenIDE("Example.csx");
return null;
}Parameters and execution flow:
- The editor is a graphical window, not an external Launch application. Reading/displaying the file depends on the existence of the path and editor logic.
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 path = "C:\\UO Scripts\\Example.csx";
UO.OpenIDE(path);
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.OpenIDE. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.OpenIDE:bridge.OpenIDE(string.Empty).
Internal implementation code; this is not a standalone script.
public void OpenIDE() => bridge.OpenIDE(string.Empty);Parameters: filePath (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.OpenIDE. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.OpenIDE:bridge.OpenIDE(filePath.ToString()). -
InjectionScript.Runtime.InjectionValue.ToString:filePath.ToString().
Internal implementation code; this is not a standalone script.
public void OpenIDE(InjectionValue filePath) => bridge.OpenIDE(filePath.ToString());Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.Print(object? msg);
void UO.Print(object? msg, object? color);Shows a local message about script progress or stopping condition. You see it, not other players.
-
coloris UO hue, not RGB. Number or hex string; the bridge uses the least significant 16 bits. Not to be confused with graphic/type. 0x0044 in the example is the selected hue. Without color, hue 0x03B2 is used. UO.Print(text, color) accepts text first; UO.ColorPrint(color, text) – color first.
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. - Without color, hue 0x03B2 is used. UO.Print(text, color) accepts text first; UO.ColorPrint(color, text) – color first.
- UO.Print · UO.CharPrint · UO.Say · UO.ConColor
UO.Print("C# script started");
UO.Print($"Position: {UO.GetX()}, {UO.GetY()}");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 and has no return value (void). The message text appears directly in the call.
UO.Print("Hello from C#");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.Print("Processed item entries: " + Convert.ToString(processed), 0x0044);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.Print("Too heavy: " + Convert.ToString(weight) + "/" + Convert.ToString(maximum), 0x0044);
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.Print("Weight changed: " + Convert.ToString(current), 0x0044);
}
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: msg (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Print. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Print:bridge.Print(msg.ToString()). -
InjectionScript.Runtime.InjectionValue.ToString:msg.ToString().
Internal implementation code; this is not a standalone script.
public void Print(InjectionValue msg)
{
bridge.Print(msg.ToString());
}Parameters: msg (Any), color (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Print. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Print:bridge.Print(NumberConversions.ToInt(color), msg.ToString()). -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(color). -
InjectionScript.Runtime.InjectionValue.ToString:msg.ToString().
Internal implementation code; this is not a standalone script.
public void Print(InjectionValue msg, InjectionValue color)
{
bridge.Print(NumberConversions.ToInt(color), msg.ToString());
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.RemoveFigure(object? figureID);Deletes a local map figure by its ID.
-
figureID— int ID, returned by AddFigure. This is not a serial item and not a ID gump.
int — the result of bridge.RemoveMapFigure: 1/0 by the presence of a removed figure. The runtime entry is deleted regardless of the result of the bridge.
- First calls bridge.RemoveMapFigure, then state.MapFigures.Remove(id), then returns the bridge result. Unknown ID does not create a shape or trigger a server action.
- The local figure of the map is not an object of the world. Other shapes and server geometry do not change.
- WorldMapGump stores pictures in the process's static dictionary. Regular scripts/chat/macros of one world/profile use a common GetPersistentState and a counter ID; Individual Manager processes do not share drawings. World.Clear/YokoScripts.Clear and loading profile state do not clear or restore this dictionary (loader only restores UserStatics). Therefore, drawings can survive a world/profile change in the same process, taking into account worldNum; the new state can re-emphasize an already existing ID drawing. ClearFigures explicitly clears drawings and current state records. Success - writing/deleting data, not proof of display.
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.
var id = UO.AddFigure(new object?[] { 0, 0, UO.X(), UO.Y(), UO.X() + 3, UO.Y(), 0, 0, 255 });
UO.Print("Removed flag: " + Convert.ToString(UO.RemoveFigure(id)));Parameters and execution flow:
- Deletes a local map figure by its ID.
UO.Print(UO.RemoveFigure(1));Parameters and execution flow:
- First calls bridge.RemoveMapFigure, then state.MapFigures.Remove(id), then returns the bridge result. Unknown ID does not create a shape or trigger a server action.
return RunScenario();
object? RunScenario()
{
dynamic[] figure = new dynamic[checked((int)(10) + 1)];
figure[0] = 0;
figure[1] = 0;
figure[2] = UO.GetX();
figure[3] = UO.GetY();
figure[4] = UO.GetX() + 1;
figure[5] = UO.GetY() + 1;
figure[6] = 0;
figure[7] = 0;
figure[8] = 0;
figure[9] = UO.WorldNum();
figure[10] = "Example";
var id = UO.AddFigure(figure);
if (Truth(id > 0))
{
UO.Print(UO.RemoveFigure(id));
}
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 local figure of the map is not an object of the world. Other shapes and server geometry do not change.
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 id = 1;
var first = UO.RemoveFigure(id);
var second = UO.RemoveFigure(id);
UO.Print(Convert.ToString(first) + " " + Convert.ToString(second));
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: figureID (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.RemoveMapFigure:bridge.RemoveMapFigure(id).
Internal implementation code; this is not a standalone script.
case "removefigure":
{
int id = Arg(0);
int removed = bridge.RemoveMapFigure(id);
state.MapFigures.Remove(id);
return new InjectionValue(removed);
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.ServerPrint(object? message);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. - Without color, hue 0x03B2 is used. UO.Print(text, color) accepts text first; UO.ColorPrint(color, text) – color first.
- Despite the Server in the name or the similarity to a network message, the command only prints local text. To speak to the world, use UO.Say.
- 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 and has no return value (void). The message text appears directly in the call.
UO.ServerPrint("Hello from C#");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.ServerPrint("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.ServerPrint("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.ServerPrint("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: message (String)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ServerPrint. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ServerPrint:bridge.ServerPrint(message).
Internal implementation code; this is not a standalone script.
public void ServerPrint(string message) => bridge.ServerPrint(message);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.SetShowZ(object? stateValue);Changes the local flag showZ runtime.
-
stateValue- 0 turns off; any non-zero integer includes.
void - no value. Call on a separate line; completion does not confirm the server's action.
- Assigns showZ the value of 0 or 1 after NumberConversions.ToInt. This function itself does not change the coordinates and does not send the packet.
- This is the compatibility storage of the current runtime. There are no consumers in the project private mulPath/showZ; the change does not reload assets or change the height display.
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.SetShowZ");
UO.SetShowZ(1);Parameters and execution flow:
- Changes the local flag showZ runtime.
UO.SetShowZ(1);Parameters and execution flow:
- Assigns showZ the value of 0 or 1 after NumberConversions.ToInt. This function itself does not change the coordinates and does not send the packet.
return RunScenario();
object? RunScenario()
{
UO.SetShowZ(0);
return null;
}Parameters and execution flow:
- This is the compatibility storage of the current runtime. There are no consumers in the project private mulPath/showZ; the change does not reload assets or change the height display.
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()
{
ApplyValue(1);
return null;
}
void ApplyValue(dynamic value)
{
UO.SetShowZ(value);
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: stateValue (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.SetShowZ. -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(stateValue).
Internal implementation code; this is not a standalone script.
public void SetShowZ(InjectionValue stateValue) => showZ = NumberConversions.ToInt(stateValue) != 0 ? 1 : 0;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.SetSilentMode(object? value);Changes the local flag SilentMode runtime.
-
value- 0 turns off; any non-zero integer includes.
void - no value. Call on a separate line; completion does not confirm the server's action.
- Stores SilentMode as 0/1. GumpLinesResult reads the flag: with 0 the non-empty results GetGumpShortLines/GetGumpFullLines/GetGumpButtonsDescription are additionally printed into a text window and open it; with 1 this additional display is suppressed. The returned array does not change. Other Print, sounds and server messages are not suppressed.
- In a regular client host, this state data is taken from the GetPersistentState manager and is common to scripts/chat/macros of the same world/profile, and does not belong to one script. Another process or an apparently separate InjectionRuntimeState has a different state. Loading/clearing a profile can replace it; saved serial are still checked against the loaded world.
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.SetSilentMode");
UO.SetSilentMode(1);Parameters and execution flow:
- Stores SilentMode as 0/1. GumpLinesResult reads the flag: with 0 the non-empty results GetGumpShortLines/GetGumpFullLines/GetGumpButtonsDescription are additionally printed into a text window and open it; with 1 this additional display is suppressed. The returned array does not change. Other Print, sounds and server messages are not suppressed.
UO.SetSilentMode(1);Parameters and execution flow:
- Stores SilentMode as 0/1. GumpLinesResult reads the flag: with 0 the non-empty results GetGumpShortLines/GetGumpFullLines/GetGumpButtonsDescription are additionally printed into a text window and open it; with 1 this additional display is suppressed. The returned array does not change. Other Print, sounds and server messages are not suppressed.
return RunScenario();
object? RunScenario()
{
UO.SetSilentMode(0);
return null;
}Parameters and execution flow:
- Stores SilentMode as 0/1. GumpLinesResult reads the flag: with 0 the non-empty results GetGumpShortLines/GetGumpFullLines/GetGumpButtonsDescription are additionally printed into a text window and open it; with 1 this additional display is suppressed. The returned array does not change. Other Print, sounds and server messages are not suppressed.
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()
{
ApplyValue(1);
return null;
}
void ApplyValue(dynamic value)
{
UO.SetSilentMode(value);
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: value (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "setsilentmode": state.SilentMode = Arg(0) != 0 ? 1 : 0; return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.ShowJournal();Opens a local client log window.
There are no parameters.
void - no value. Call on a separate line; completion does not confirm the server's action.
- ShowJournal calls GameActions.OpenJournal(_world). The records are not cleared and the text is not sent to the server.
- Modifies or displays only the specified local data. This command does not have server confirmation.
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.ShowJournal");
UO.ShowJournal();Parameters and execution flow:
- Opens a local client log window.
UO.ShowJournal();Parameters and execution flow:
- ShowJournal calls GameActions.OpenJournal(_world). The records are not cleared and the text is not sent to the server.
return RunScenario();
object? RunScenario()
{
UO.Print("Journal example");
UO.ShowJournal();
return null;
}Parameters and execution flow:
- Modifies or displays only the specified local data. This command does not have server confirmation.
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.ShowJournal();
UO.Print(UO.LineCount());
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.ExecuteLegacyManualAlias. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ShowJournal:bridge.ShowJournal().
Internal implementation code; this is not a standalone script.
case "showjournal": bridge.ShowJournal(); break;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.Snap();
int UO.Snap(object? name);
int UO.Snap(object? name, object? quality);
int UO.Snap(object? file, object? quality, object? includeUI);Saves a snapshot of the client's graphics window.
-
name— Optional file name. .jpg/.jpeg selects JPEG, other/none selects PNG. Directories from the name are removed; Only the base name is used. -
file— Optional file name. .jpg/.jpeg selects JPEG, other/none selects PNG. Directories from the name are removed; Only the base name is used. -
quality— Optional int, defaults to 100, limited to 1..100. Affects JPEG; PNG does not use lossy quality. -
includeUI- Optional bool, default true. false draws the world/lighting without UI.
Numeric flag int: 1 - image file saved, 0 - capture/write error. Without a graphics window, RequireGameView throws an error before TakeScreenshot.
- TakeScreenshot writes to ExecutablePath/Data/Client/Screenshots, clears invalid name characters, automatically selects name by date if empty, adds _2/_3 if there is an existing file. An arbitrary absolute path is not used.
- With UI reads backbuffer; without UI creates RenderTarget2D and renders the world. JPEG temporarily sets FNA_GRAPHICS_JPEG_SAVE_QUALITY with restoration; PNG SaveAsPng. Errors inside TakeScreenshot are logged and given as 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.
var result = UO.Snap();
UO.Print("Snap: " + Convert.ToString(result));Parameters and execution flow:
- Saves a snapshot of the client's graphics window.
UO.Print(UO.Snap());Parameters and execution flow:
- TakeScreenshot writes to ExecutablePath/Data/Client/Screenshots, clears invalid name characters, automatically selects name by date if empty, adds _2/_3 if there is an existing file. An arbitrary absolute path is not used.
return RunScenario();
object? RunScenario()
{
UO.Print(UO.Snap("manual-example.jpg", 85));
return null;
}Parameters and execution flow:
- With UI reads backbuffer; without UI creates RenderTarget2D and renders the world. JPEG temporarily sets FNA_GRAPHICS_JPEG_SAVE_QUALITY with restoration; PNG SaveAsPng. Errors inside TakeScreenshot are logged and given as 0.
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.Print(UO.Snap("manual-world.png", 100, false));
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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Snap. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Snap:bridge.Snap(null, 100, true).
Internal implementation code; this is not a standalone script.
public int Snap() => bridge.Snap(null, 100, true);Parameters: name (String)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Snap. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Snap:bridge.Snap(name, 100, true).
Internal implementation code; this is not a standalone script.
public int Snap(string name) => bridge.Snap(name, 100, true);Parameters: name (String), quality (Integer)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Snap. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Snap:bridge.Snap(name, Math.Max(1, Math.Min(100, quality)), true).
Internal implementation code; this is not a standalone script.
public int Snap(string name, int quality) => bridge.Snap(name, Math.Max(1, Math.Min(100, quality)), true);Parameters: file (Any), quality (Any), includeUI (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [Snap]. -
InjectionScript.Runtime.InjectionApiUO.Snap:Snap(values[0].ToString(), NumberConversions.ToInt(values[1]), ToBoolean(values[2])). -
InjectionScript.Runtime.InjectionValue.ToString:values[0].ToString(). -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(values[1]). -
InjectionScript.Runtime.InjectionApiUO.ToBoolean:ToBoolean(values[2]).
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(Snap(values[0].ToString(), NumberConversions.ToInt(values[1]), ToBoolean(values[2])))Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.TextClear();Clears the local text window's buffer.
There are no parameters.
void - no value. Call on a separate line; completion does not confirm the server's action.
- Clears _textWindow; if the window was open, re-shows it with an empty list. A closed window remains closed. The client log is not cleared.
- The action is local interface/buffer; There is no network message or server confirmation.
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.TextClear");
UO.TextClear();Parameters and execution flow:
- Clears the local text window's buffer.
UO.TextClear();Parameters and execution flow:
- Clears _textWindow; if the window was open, re-shows it with an empty list. A closed window remains closed. The client log is not cleared.
return RunScenario();
object? RunScenario()
{
UO.TextPrint("Old line");
UO.TextClear();
return null;
}Parameters and execution flow:
- The action is local interface/buffer; There is no network message or server confirmation.
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.TextClose();
UO.TextClear();
UO.TextOpen();
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.TextClear. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.TextClear:bridge.TextClear().
Internal implementation code; this is not a standalone script.
public void TextClear() => bridge.TextClear();Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.TextClose();Closes the local text window, saving the buffer.
There are no parameters.
void - no value. Call on a separate line; completion does not confirm the server's action.
- Sets _textWindowOpen=false and Dispose of the existing YokoTextWindowGump. The _textWindow list is not cleared; TextOpen will show its lines again.
- The action is local interface/buffer; There is no network message or server confirmation.
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.TextClose");
UO.TextClose();Parameters and execution flow:
- Closes the local text window, saving the buffer.
UO.TextClose();Parameters and execution flow:
- Sets _textWindowOpen=false and Dispose of the existing YokoTextWindowGump. The _textWindow list is not cleared; TextOpen will show its lines again.
return RunScenario();
object? RunScenario()
{
UO.TextPrint("Retained line");
UO.TextClose();
return null;
}Parameters and execution flow:
- The action is local interface/buffer; There is no network message or server confirmation.
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.TextPrint("Retained line");
UO.TextClose();
UO.Wait(250);
UO.TextOpen();
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.TextClose. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.TextClose:bridge.TextClose().
Internal implementation code; this is not a standalone script.
public void TextClose() => bridge.TextClose();Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.TextOpen();Opens a local text window.
There are no parameters.
void - no value. Call on a separate line; completion does not confirm the server's action.
- Stores _textWindowOpen=true and calls YokoTextWindowGump.Show with the current _textWindow. The buffer is not cleared; reopening shows the accumulated rows.
- The action is local interface/buffer; There is no network message or server confirmation.
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.TextOpen");
UO.TextOpen();Parameters and execution flow:
- Opens a local text window.
UO.TextOpen();Parameters and execution flow:
- Stores _textWindowOpen=true and calls YokoTextWindowGump.Show with the current _textWindow. The buffer is not cleared; reopening shows the accumulated rows.
return RunScenario();
object? RunScenario()
{
UO.TextPrint("Example");
UO.TextOpen();
return null;
}Parameters and execution flow:
- The action is local interface/buffer; There is no network message or server confirmation.
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.TextOpen();
UO.Wait(500);
UO.TextClose();
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.TextOpen. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.TextOpen:bridge.TextOpen().
Internal implementation code; this is not a standalone script.
public void TextOpen() => bridge.TextOpen();Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.TextPrint(object? text);Adds a line to a local text window and opens it.
-
text— Text through ToString; saved as transmitted.
void - no value. Call on a separate line; completion does not confirm the server's action.
- At the limit, MaxTextWindowLines=2000 removes old lines, then adds text or an empty line, sets _textWindowOpen=true and shows the window. This is not UO.Print in the log and not a speech to the server.
- The action is local interface/buffer; There is no network message or server confirmation.
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.TextPrint");
UO.TextPrint("Example");Parameters and execution flow:
- Adds a line to a local text window and opens it.
UO.TextPrint("Example");Parameters and execution flow:
- At the limit, MaxTextWindowLines=2000 removes old lines, then adds text or an empty line, sets _textWindowOpen=true and shows the window. This is not UO.Print in the log and not a speech to the server.
return RunScenario();
object? RunScenario()
{
var message = "Line 1";
UO.TextPrint(message);
UO.TextPrint("Line 2");
return null;
}Parameters and execution flow:
- The action is local interface/buffer; There is no network message or server confirmation.
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.TextClear();
UO.TextPrint("Fresh report");
UO.TextClose();
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: text (String)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.TextPrint. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.TextPrint:bridge.TextPrint(text).
Internal implementation code; this is not a standalone script.
public void TextPrint(string text) => bridge.TextPrint(text);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.UpdateFigure(object? figureID, object? figure);Replaces the description of an existing local map figure.
-
figureID- int ID in state. MapFigures received by AddFigure. Unknown ID gives 0. -
figure— Array or string with |: [kind,coord,x1,y1,x2,y2,brushColor,brushStyle,color,worldNum,text]. Minimum first 9 numeric fields; worldNum is the current map by default, text is empty by default. -
figure[0] (kind)- kind should be 0..4, coord - 0..1, FigureID - positive. WorldMapGump.SetYokoMapFigure returns 0 when these boundaries are violated. -
figure[1] (coord)- kind should be 0..4, coord - 0..1, FigureID - positive. WorldMapGump.SetYokoMapFigure returns 0 when these boundaries are violated.
Numeric flag int: 1 - parsing was successful and bridge. SetMapFigure returned a non-zero result, after which the record was updated; 0 - no ID, structure/numeric text field error or bridge failed.
- TryMapFigureArg accepts Array or |string. The first 9 fields are converted; numeric text is checked by TryStr2Int. Unsupported view/short notation - 0, other view conversion errors may break the script.
- If the bridge fails, the existing runtime entry is not replaced. On success, saves SerializeMapFigure with 10 numeric fields and text. The figure is local only, not a server item.
- kind: 0 line, 1 ellipse (32 contour segment), 2 rectangle contour, 3 arrow, 4 text. coord=0 — world coordinates with conversion to the map, coord=1 — pixels relative to the map drawing area. x1/y1 and x2/y2 - ends/boundaries; for the world arrow x2=y2=0 sets the beginning of the Player and the goal of x1/y1. color — 0x00BBGGRR (low byte red), outline color. brushColor/brushStyle are saved, but the render does not read them: there is no fill. worldNum<0 shows on any map, otherwise only the specified one. The text is drawn at the first point (+3 pixels for non-text shapes) in the map font, not the outline color.
- WorldMapGump stores pictures in the process's static dictionary. Regular scripts/chat/macros of one world/profile use a common GetPersistentState and a counter ID; Individual Manager processes do not share drawings. World.Clear/YokoScripts.Clear and loading profile state do not clear or restore this dictionary (loader only restores UserStatics). Therefore, drawings can survive a world/profile change in the same process, taking into account worldNum; the new state can re-emphasize an already existing ID drawing. ClearFigures explicitly clears drawings and current state records. Success - writing/deleting data, not proof of display.
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.
object?[] figure = { 0, 0, UO.X(), UO.Y(), UO.X() + 3, UO.Y(), 0, 0, 255 };
var id = UO.AddFigure(figure);
figure[8] = 65280;
UO.Print("Updated flag: " + Convert.ToString(UO.UpdateFigure(id, figure)));Parameters and execution flow:
- Replaces the description of an existing local map figure.
dynamic[] figure = new dynamic[checked((int)(8) + 1)];
figure[0] = 0;
figure[1] = 0;
figure[2] = 100;
figure[3] = 100;
figure[4] = 101;
figure[5] = 101;
figure[6] = 0;
figure[7] = 0;
figure[8] = 0;
UO.Print(UO.UpdateFigure(1, figure));Parameters and execution flow:
- TryMapFigureArg accepts Array or |string. The first 9 fields are converted; numeric text is checked by TryStr2Int. Unsupported view/short notation - 0, other view conversion errors may break the script.
return RunScenario();
object? RunScenario()
{
dynamic[] figure = new dynamic[checked((int)(10) + 1)];
figure[0] = 0;
figure[1] = 0;
figure[2] = UO.GetX();
figure[3] = UO.GetY();
figure[4] = UO.GetX() + 1;
figure[5] = UO.GetY() + 1;
figure[6] = 0;
figure[7] = 0;
figure[8] = 0;
figure[9] = UO.WorldNum();
figure[10] = "Example";
var id = UO.AddFigure(figure);
if (Truth(id > 0))
{
UO.Print(UO.UpdateFigure(id, figure));
UO.RemoveFigure(id);
}
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:
- If the bridge fails, the existing runtime entry is not replaced. On success, saves SerializeMapFigure with 10 numeric fields and text. The figure is local only, not a server item.
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 figure = "0|0|100|100|101|101|0|0|0";
UO.Print(UO.UpdateFigure(1, figure));
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: figureID (Any), figure (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::TryMapFigureArg:TryMapFigureArg(1, out int[] figure, out string figureText). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetMapFigure:bridge.SetMapFigure(id, figure[0], figure[1], figure[2], figure[3], figure[4], figure[5], figure[6], figure[7], figure[8], figure[9], figureText). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::SerializeMapFigure:SerializeMapFigure(figure, figureText).
Internal implementation code; this is not a standalone script.
case "updatefigure":
{
int id = Arg(0);
if (!state.MapFigures.ContainsKey(id) || !TryMapFigureArg(1, out int[] figure, out string figureText))
return InjectionValue.False;
if (bridge.SetMapFigure(id, figure[0], figure[1], figure[2], figure[3], figure[4], figure[5], figure[6], figure[7], figure[8], figure[9], figureText) == 0)
return InjectionValue.False;
state.MapFigures[id] = SerializeMapFigure(figure, figureText);
return InjectionValue.True;
}ClassicUO — Bad Newbie & C# Scripts IDE