Skip to content

EN UO Topic profiles configuration

Codex edited this page Oct 12, 2026 · 4 revisions

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

Profiles & Configuration

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

Profiles, saving settings, global values ​​and hotkeys. The global runtime value and the local procedure variable have different lifetimes.

Sections

Topic Commands and explanations
GetProfile UO.GetProfile
ProfileName UO.ProfileName
ProfileShardName UO.ProfileShardName
ChangeProfile UO.ChangeProfile
ExtChangeProfile UO.ExtChangeProfile
ResetProfile UO.ResetProfile
SaveConfig UO.SaveConfig
Global Variables UO.GetGlobal · UO.SetGlobal · UO.GListGet · UO.GListSet · UO.GListSize
EasyUO Variables UO.GetEasyUO · UO.SetEasyUO
MUL Path UO.SetMulPath

All theme commands

Profiles

UO.GetProfile · UO.ProfileName · UO.ProfileShardName · UO.ChangeProfile · UO.ExtChangeProfile · UO.ResetProfile · UO.SaveConfig · UO.ReqProfile · UO.ClientProfilePath · UO.ClientPath · UO.SetMulPath

Global Variables

UO.GetGlobal · UO.SetGlobal · UO.GetEasyUO · UO.SetEasyUO · UO.GListClear · UO.GListGet · UO.GListPosName · UO.GListPosValue · UO.GListSet · UO.GListSize

Hotkeys / Settings

UO.LoadHotkeys · UO.SaveHotkeys · UO.Set · UO.SetDefault

Examples on the topic

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

UO.GetGlobal

Parameters, result and all scenarios

var text = UO.GetGlobal("manual.delay");
var delayMs = 350;
if (Truth(text != "N/A") && Truth(IsNumeric(text)))
{
    var parsed = Val(text);
    if (Truth(parsed >= 50) && Truth(parsed <= 5000))
    {
        delayMs = checked((int)parsed);
    }
}
await Delay(delayMs);

Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
bool IsNumeric(object? value) => double.TryParse(Convert.ToString(value), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out _);
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
double Val(object? value) => double.TryParse(Convert.ToString(value), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out var number) ? number : 0;

UO.SetGlobal

Parameters, result and all scenarios

UO.SetGlobal("manual.delay", 350);
UO.SetGlobal("manual.delay", 600);
var text = UO.GetGlobal("manual.delay");
if (Truth(IsNumeric(text)))
{
    await Delay(Val(text));
}

Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
bool IsNumeric(object? value) => double.TryParse(Convert.ToString(value), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out _);
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
double Val(object? value) => double.TryParse(Convert.ToString(value), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out var number) ? number : 0;

Complete command reference


UO.ChangeProfile

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

C# signatures

dynamic UO.ChangeProfile(object? name);

Changes the selected profile for the next self-client connection when the session is disconnected.

Parameters

  • name — Saved profile/character name resolved by TryResolveProfileCharacter for the selected shard. An empty/unknown name gives -4.

Return value

int: 0 — selection is prepared; -2 — manager session or connection/game world is active; -3 — more than one script is executed; -4 - profile name/shard is not allowed.

Behavior

  • ChangeProfile passes empty shard/character; ExtChangeProfile allows explicit shard and character. In the manager session, you need to select another session in ClassicUO Manager - the running session saves its profile.
  • If successful, saves and unloads the current profile, changes LastServerName, saves the settings and assigns the next character. The connection itself does not start; Connect is called for it separately.

Standalone C# scripts

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

Simple example

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

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

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

1. Check failure code - direct script

Parameters and execution flow:

  • Use the actual saved profile name; a negative code describes a failure.
var status = UO.ChangeProfile("ExampleProfile");
UO.Print(Convert.ToString(status));

2. Empty name - script function

Parameters and execution flow:

  • A disabled standalone client with no other violation returns -4 for an empty name.
return  RunScenario();
 object? RunScenario()
{
    var status = UO.ChangeProfile("");
    UO.Print(Convert.ToString(status));
    return null;
}

3. Connection after successful selection - script class

Parameters and execution flow:

  • Connect is called only after the code 0; The server response has not yet been confirmed.
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 status = UO.ChangeProfile("ExampleProfile");
        if (Truth(status == 0))
        {
            UO.Connect();
        }

        return null;
    }

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

Command implementation

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

UO.ChangeProfile(name) — UO.ChangeProfile(Any)

Parameters: name (Any)

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "changeprofile":

                    return new InjectionValue(bridge.ChangeProfileSelection(Text(0), string.Empty, string.Empty));

UO.ClientPath

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

C# signatures

string UO.ClientPath();

Returns the client installation/executable directory.

Parameters

There are no parameters.

Return value

string — path to the directory. It's not a bool, it's not an array, and it's not ID. An empty path means the value is not available; don't use it as your default current working folder.

Behavior

  • Read CUOEnviroment.ExecutablePath. This is not a driving route, a list of waypoints, a script folder, or a path to game data.
  • The command only reads the path, does not open, create or save anything. The trailing delimiter should not be assumed; the helper example adds it if necessary.
  • The name is the game/client name API and is spelled with UO. ClientPath returns the client directory, ClientProfilePath returns the active profile directory.

Standalone C# scripts

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

Simple example

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

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

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

1. Read path - direct script

Parameters and execution flow:

  • There are no arguments. folder - string; an empty value is processed separately.
var folder = UO.ClientPath();
if (Truth(folder == ""))
{
    UO.Print("Folder is not available");
    return null;
}
UO.Print(folder);

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

2. Compare Client Folder to Profile Folder - Script Function

Parameters and execution flow:

  • These folders have different purposes. The script outputs both lines without changing the configuration or profile.
return  RunScenario();
 object? RunScenario()
{
    var client = UO.ClientPath();
    var profile = UO.ClientProfilePath();
    UO.Print("Client: " + client);
    if (Truth(profile == ""))
    {
        UO.Print("No current profile");
    }
    else
    {
        UO.Print("Profile: " + profile);
    }

    return null;
}

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

3. Complete function for building the path to your file - script class

Parameters and execution flow:

  • ChildPath is shown in its entirety: folder is the resulting directory, leaf is the file name. This is a string concatenation for a given name, not a universal path normalizer.
  • The file is not created or read; First you can check the resulting string.
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 folder = UO.ClientPath();
        var filePath = ChildPath(folder, "sample.json");
        if (Truth(filePath != ""))
        {
            UO.Print("Example path: " + filePath);
        }

        return null;
    }

    dynamic ChildPath(dynamic folder, dynamic leaf)
    {
        if (Truth(folder == ""))
        {
            return "";
        }

        var last = Right(folder, 1);
        if (Truth(last == "/") || Truth(last == "\\"))
        {
            return folder + leaf;
        }

        return folder + "/" + leaf;
    }

    string Right(object? value, int count)
    {
        string text = Convert.ToString(value) ?? "";
        return text[Math.Max(0, text.Length - count)..];
    }

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

Command implementation

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

UO.ClientPath() — UO.ClientPath()

Parameters: No parameters.

Result: string / String.

During a call:

Internal implementation code; this is not a standalone script.

case "clientpath": return new InjectionValue(bridge.ClientPath);

UO.ClientProfilePath

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

C# signatures

string UO.ClientProfilePath();

Returns the current client profile directory.

Parameters

There are no parameters.

Return value

string — path to the directory. It's not a bool, it's not an array, and it's not ID. An empty path means the value is not available; don't use it as your default current working folder.

Behavior

  • Read ProfileManager.ProfilePath; if the profile has not yet been selected, an empty string is returned. The call itself does not create a profile and does not transfer settings.
  • The command only reads the path, does not open, create or save anything. The trailing delimiter should not be assumed; the helper example adds it if necessary.
  • The name is the game/client name API and is spelled with UO. ClientPath returns the client directory, ClientProfilePath returns the active profile directory.

Standalone C# scripts

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

Simple example

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

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

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

1. Read path - direct script

Parameters and execution flow:

  • There are no arguments. folder - string; an empty value is processed separately.
var folder = UO.ClientProfilePath();
if (Truth(folder == ""))
{
    UO.Print("Folder is not available");
    return null;
}
UO.Print(folder);

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

2. Compare Client Folder to Profile Folder - Script Function

Parameters and execution flow:

  • These folders have different purposes. The script outputs both lines without changing the configuration or profile.
return  RunScenario();
 object? RunScenario()
{
    var client = UO.ClientPath();
    var profile = UO.ClientProfilePath();
    UO.Print("Client: " + client);
    if (Truth(profile == ""))
    {
        UO.Print("No current profile");
    }
    else
    {
        UO.Print("Profile: " + profile);
    }

    return null;
}

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

3. Complete function for building the path to your file - script class

Parameters and execution flow:

  • ChildPath is shown in its entirety: folder is the resulting directory, leaf is the file name. This is a string concatenation for a given name, not a universal path normalizer.
  • The file is not created or read; First you can check the resulting string.
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 folder = UO.ClientProfilePath();
        var filePath = ChildPath(folder, "sample.json");
        if (Truth(filePath != ""))
        {
            UO.Print("Example path: " + filePath);
        }

        return null;
    }

    dynamic ChildPath(dynamic folder, dynamic leaf)
    {
        if (Truth(folder == ""))
        {
            return "";
        }

        var last = Right(folder, 1);
        if (Truth(last == "/") || Truth(last == "\\"))
        {
            return folder + leaf;
        }

        return folder + "/" + leaf;
    }

    string Right(object? value, int count)
    {
        string text = Convert.ToString(value) ?? "";
        return text[Math.Max(0, text.Length - count)..];
    }

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

Command implementation

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

UO.ClientProfilePath() — UO.ClientProfilePath()

Parameters: No parameters.

Result: string / String.

During a call:

Internal implementation code; this is not a standalone script.

case "shardpath":

                case "clientprofilepath": return new InjectionValue(bridge.CurrentProfilePath);

UO.ExtChangeProfile

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

C# signatures

dynamic UO.ExtChangeProfile(object? profileName);
dynamic UO.ExtChangeProfile(object? profileName, object? shardName);
dynamic UO.ExtChangeProfile(object? profileName, object? shardName, object? charName);

Changes the selected profile for the next self-client connection when the session is disconnected.

Parameters

  • profileName — Saved profile/character name resolved by TryResolveProfileCharacter for the selected shard. An empty/unknown name gives -4.
  • shardName — Optional shard name. An empty value uses CurrentProfile.ServerName, World.ServerName, or LastServerName.
  • charName - Optional character name. An empty value uses the saved profile name.

Return value

int: 0 — selection is prepared; -2 — manager session or connection/game world is active; -3 — more than one script is executed; -4 - profile name/shard is not allowed.

Behavior

  • ChangeProfile passes empty shard/character; ExtChangeProfile allows explicit shard and character. In the manager session, you need to select another session in ClassicUO Manager - the running session saves its profile.
  • If successful, saves and unloads the current profile, changes LastServerName, saves the settings and assigns the next character. The connection itself does not start; Connect is called for it separately.

Standalone C# scripts

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

Simple example

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

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

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

1. Check failure code - direct script

Parameters and execution flow:

  • Use the actual saved profile name; a negative code describes a failure.
var status = UO.ExtChangeProfile("ExampleProfile");
UO.Print(Convert.ToString(status));

2. Empty name - script function

Parameters and execution flow:

  • A disabled standalone client with no other violation returns -4 for an empty name.
return  RunScenario();
 object? RunScenario()
{
    var status = UO.ExtChangeProfile("");
    UO.Print(Convert.ToString(status));
    return null;
}

3. Connection after successful selection - script class

Parameters and execution flow:

  • Connect is called only after the code 0; The server response has not yet been confirmed.
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 status = UO.ExtChangeProfile("ExampleProfile");
        if (Truth(status == 0))
        {
            UO.Connect();
        }

        return null;
    }

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

Command implementation

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

UO.ExtChangeProfile(profileName) — UO.ExtChangeProfile(Any)

Parameters: profileName (Any)

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "extchangeprofile":

                {

                    string requestedProfile = Text(0);

                    string requestedShard = arguments.Length > 1 ? Text(1) : string.Empty;

                    string requestedCharacter = arguments.Length > 2 ? Text(2) : string.Empty;

                    return new InjectionValue(bridge.ChangeProfileSelection(requestedProfile, requestedShard, requestedCharacter));

                }

UO.ExtChangeProfile(profileName, shardName) — UO.ExtChangeProfile(Any,Any)

Parameters: profileName (Any), shardName (Any)

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "extchangeprofile":

                {

                    string requestedProfile = Text(0);

                    string requestedShard = arguments.Length > 1 ? Text(1) : string.Empty;

                    string requestedCharacter = arguments.Length > 2 ? Text(2) : string.Empty;

                    return new InjectionValue(bridge.ChangeProfileSelection(requestedProfile, requestedShard, requestedCharacter));

                }

UO.ExtChangeProfile(profileName, shardName, charName) — UO.ExtChangeProfile(Any,Any,Any)

Parameters: profileName (Any), shardName (Any), charName (Any)

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "extchangeprofile":

                {

                    string requestedProfile = Text(0);

                    string requestedShard = arguments.Length > 1 ? Text(1) : string.Empty;

                    string requestedCharacter = arguments.Length > 2 ? Text(2) : string.Empty;

                    return new InjectionValue(bridge.ChangeProfileSelection(requestedProfile, requestedShard, requestedCharacter));

                }

UO.GListClear

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

C# signatures

void UO.GListClear();

Clears the entire temporary list before a new series of actions.

Parameters

There are no parameters.

Return value

void - no result. After clearing, GListSize() returns 0.

Behavior

  • The list belongs to the runtime instance. Other script runs have their own lists. GList is not shared cross-profile storage; these commands do not write a file and do not enter a saved profile state. The new runtime gets an empty list. It is also not var/variable declaration and not UO.SetGlobal.
  • The new name is added to the end. Repeating a case-insensitive name replaces the meaning and spelling of the name in its original place. Reading does not delete anything. You cannot clear or add records in the middle of a search if you need stable indexes.
  • Operations are local: no packets, no object searches, no latency. Set/Get search for the name sequentially; for larger sets use Dictionary. There is no separate command for deleting one key in this family; Clear clears all entries.

Standalone C# scripts

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

Simple example

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

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

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

1. GListClear - 1 - direct script

Parameters and execution flow:

  • Clear removes both rules, Size confirms emptiness. The character's items remain in place.
UO.GListClear();
UO.GListSet("bandage", 0x0E21);
UO.GListSet("gold", 0x0EED);
UO.GListClear();
if (Truth(UO.GListSize() == 0))
{
    UO.Print("Batch rules cleared");
}

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

2. GListClear — 2 — script function

Parameters and execution flow:

  • Old rules are removed before ore is added; search only shows the new rule with graphic 0x19B9.
return  RunScenario();
 object? RunScenario()
{
    UO.GListClear();
    UO.GListSet("bandage", 0x0E21);
    UO.GListSet("gold", 0x0EED);
    UO.GListClear();
    UO.GListSet("ore", 0x19B9);
    var i = 0;
    while (Truth(i < UO.GListSize()))
    {
        var name = UO.GListPosName(i);
        var graphic = UO.GListPosValue(i);
        UO.Print(name + " | graphic: " + Convert.ToString(graphic));
        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;

3. GListClear - 3 - scenario class

Parameters and execution flow:

  • A number previously read into retained remains available after the list is cleared. The list already contains 0 entries.
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.GListClear();
        UO.GListSet("bandage", 0x0E21);
        UO.GListSet("gold", 0x0EED);
        var retained = UO.GListGet("bandage");
        UO.GListClear();
        UO.Print("Retained graphic: " + Convert.ToString(retained));
        UO.Print("Remaining entries: " + Convert.ToString(UO.GListSize()));
        return null;
    }
}

Command implementation

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

UO.GListClear() — UO.GListClear()

Parameters: No parameters.

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

public void GListClear() => globalList.Clear();

UO.GListGet

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

C# signatures

dynamic UO.GListGet(object? nameValue);

Reads a value from a temporary list by rule or counter name.

Parameters

  • nameValue — object? is converted to a string. Names are compared case-insensitively: "bandage" and "BANDAGE" are one key. A non-empty string name is recommended; an empty name is also acceptable.

Return value

object? — saved value with the same type. If there is no key, int 0. A stored 0 is indistinguishable from a missing one GListGet; check the names.

Behavior

  • The list belongs to the runtime instance. Other script runs have their own lists. GList is not shared cross-profile storage; these commands do not write a file and do not enter a saved profile state. The new runtime gets an empty list. It is also not var/variable declaration and not UO.SetGlobal.
  • The new name is added to the end. Repeating a case-insensitive name replaces the meaning and spelling of the name in its original place. Reading does not delete anything. You cannot clear or add records in the middle of a search if you need stable indexes.
  • Operations are local: no packets, no object searches, no latency. Set/Get search for the name sequentially; for larger sets use Dictionary. There is no separate command for deleting one key in this family; Clear clears all entries.

Standalone C# scripts

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

Simple example

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

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

UO.GListSet("simple_value", 42);
object? result = UO.GListGet("simple_value");
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));

1. GListGet - 1 - direct script

Parameters and execution flow:

  • BANDAGE finds the bandage key. 0x0E21 — graphic of the bandage, not its unique serial.
UO.GListClear();
UO.GListSet("bandage", 0x0E21);
UO.GListSet("gold", 0x0EED);
var graphic = UO.GListGet("BANDAGE");
if (Truth(graphic == 0x0E21))
{
    UO.Print("Bandage rule selected");
}

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

2. GListGet — 2 — script function

Parameters and execution flow:

  • The complete function HasEntry iterates through names; so 0 in processed is different from missing. For own keys, ASCII-names are used here.
return  RunScenario();
 object? RunScenario()
{
    UO.GListClear();
    UO.GListSet("processed", 0);
    if (Truth(HasEntry("processed")))
    {
        var count = UO.GListGet("processed");
        UO.Print("Recorded count: " + Convert.ToString(count));
    }

    if (!(Truth(HasEntry("missing"))))
    {
        UO.Print("No entry named missing");
    }

    return null;
}

dynamic HasEntry(dynamic name)
{
    var i = 0;
    while (Truth(i < UO.GListSize()))
    {
        if (Truth(Convert.ToString(UO.GListPosName(i)) == Convert.ToString(name)))
        {
            return true;
        }

        i = i + 1;
    }

    return false;
}

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

3. GListGet - 3 - scenario class

Parameters and execution flow:

  • delay — number of milliseconds; UO.Wait is called only for a value in the range 50–5000. The example waits for 350 ms.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
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;
    }

    async public Task<object?> RunScenarioAsync()
    {
        UO.GListClear();
        UO.GListSet("delay", 350);
        var delayMs = UO.GListGet("delay");
        if (Truth(delayMs >= 50) && Truth(delayMs <= 5000))
        {
            await Delay(delayMs);
        }
        else
        {
            UO.Print("Delay outside the accepted range");
        }

        return null;
    }

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

Command implementation

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

UO.GListGet(nameValue) — UO.GListGet(Any)

Parameters: nameValue (Any)

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

public InjectionValue GListGet(InjectionValue nameValue)

        {

            string name = nameValue.ToString();

            int index = globalList.FindIndex(pair => pair.Key.Equals(name, StringComparison.OrdinalIgnoreCase));

            return index >= 0 ? globalList[index].Value : InjectionValue.Zero;

        }

UO.GListPosName

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

C# signatures

string UO.GListPosName(object? index);

Reads the record name by its position to enumerate the rules.

Parameters

  • index - int: index from 0 to GListSize()-1 inclusive. It's not serial, graphic, or the number of units in a stack.

Return value

string is the name in the last recorded form of the register. Invalid index returns ""; an empty key also returns "".

Behavior

  • The list belongs to the runtime instance. Other script runs have their own lists. GList is not shared cross-profile storage; these commands do not write a file and do not enter a saved profile state. The new runtime gets an empty list. It is also not var/variable declaration and not UO.SetGlobal.
  • The new name is added to the end. Repeating a case-insensitive name replaces the meaning and spelling of the name in its original place. Reading does not delete anything. You cannot clear or add records in the middle of a search if you need stable indexes.
  • Operations are local: no packets, no object searches, no latency. Set/Get search for the name sequentially; for larger sets use Dictionary. There is no separate command for deleting one key in this family; Clear clears all entries.

Standalone C# scripts

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

Simple example

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

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

UO.GListClear();
UO.GListSet("simple_value", 42);
var result = UO.GListPosName(0);
UO.Print("GListPosName: " + Convert.ToString(result));

1. GListPosName - 1 - direct script

Parameters and execution flow:

  • The index 0 means the first rule. Before reading, it is checked that the list is not empty.
UO.GListClear();
UO.GListSet("bandage", 0x0E21);
UO.GListSet("gold", 0x0EED);
if (Truth(UO.GListSize() > 0))
{
    var first = UO.GListPosName(0);
    UO.Print("First rule: " + first);
}

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

2. GListPosName — 2 — script function

Parameters and execution flow:

  • HasEntry returns true for a null counter written and false for a missing name.
return  RunScenario();
 object? RunScenario()
{
    UO.GListClear();
    UO.GListSet("processed", 0);
    if (Truth(HasEntry("processed")))
    {
        var count = UO.GListGet("processed");
        UO.Print("Recorded count: " + Convert.ToString(count));
    }

    if (!(Truth(HasEntry("missing"))))
    {
        UO.Print("No entry named missing");
    }

    return null;
}

dynamic HasEntry(dynamic name)
{
    var i = 0;
    while (Truth(i < UO.GListSize()))
    {
        if (Truth(Convert.ToString(UO.GListPosName(i)) == Convert.ToString(name)))
        {
            return true;
        }

        i = i + 1;
    }

    return false;
}

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

3. GListPosName - 3 - scenario class

Parameters and execution flow:

  • Repeating BANDAGE changes the spelling of the name in the first position; gold remains 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.GListClear();
        UO.GListSet("bandage", 0x0E21);
        UO.GListSet("gold", 0x0EED);
        UO.GListSet("BANDAGE", 0x0E21);
        var i = 0;
        while (Truth(i < UO.GListSize()))
        {
            var name = UO.GListPosName(i);
            var graphic = UO.GListPosValue(i);
            UO.Print(name + " | graphic: " + Convert.ToString(graphic));
            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;
}

Command implementation

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

UO.GListPosName(index) — UO.GListPosName(Integer)

Parameters: index (Integer)

Result: string / String.

During a call:

Internal implementation code; this is not a standalone script.

public string GListPosName(int index) => index >= 0 && index < globalList.Count ? globalList[index].Key : string.Empty;

UO.GListPosValue

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

C# signatures

dynamic UO.GListPosValue(object? index);

Reads the value of an entry by position, for example graphic, from a pre-populated list.

Parameters

  • index - int: index from 0 to GListSize()-1 inclusive. It's not serial, graphic, or the number of units in a stack.

Return value

object? — value with preserved type; invalid index returns int 0. Check the boundaries, as true 0 is acceptable.

Behavior

  • The list belongs to the runtime instance. Other script runs have their own lists. GList is not shared cross-profile storage; these commands do not write a file and do not enter a saved profile state. The new runtime gets an empty list. It is also not var/variable declaration and not UO.SetGlobal.
  • The new name is added to the end. Repeating a case-insensitive name replaces the meaning and spelling of the name in its original place. Reading does not delete anything. You cannot clear or add records in the middle of a search if you need stable indexes.
  • Operations are local: no packets, no object searches, no latency. Set/Get search for the name sequentially; for larger sets use Dictionary. There is no separate command for deleting one key in this family; Clear clears all entries.

Standalone C# scripts

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

Simple example

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

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

UO.GListClear();
UO.GListSet("simple_value", 42);
object? result = UO.GListPosValue(0);
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));

1. GListPosValue - 1 - direct script

Parameters and execution flow:

  • Index 1 selects the second rule gold. Bounds checking precedes reading the value.
UO.GListClear();
UO.GListSet("bandage", 0x0E21);
UO.GListSet("gold", 0x0EED);
var index = 1;
if (Truth(index >= 0) && Truth(index < UO.GListSize()))
{
    var graphic = UO.GListPosValue(index);
    UO.Print("Second rule graphic: " + Convert.ToString(graphic));
}

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

2. GListPosValue — 2 — script function

Parameters and execution flow:

  • The search looks for a graphic bandage in the rules, not an object in the world; no game requests are sent.
return  RunScenario();
 object? RunScenario()
{
    UO.GListClear();
    UO.GListSet("bandage", 0x0E21);
    UO.GListSet("gold", 0x0EED);
    var total = UO.GListSize();
    var i = 0;
    while (Truth(i < total))
    {
        var graphic = UO.GListPosValue(i);
        if (Truth(graphic == 0x0E21))
        {
            UO.Print("Bandage rule at index " + Convert.ToString(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;

3. GListPosValue - 3 - scenario class

Parameters and execution flow:

  • The index 0 exists, so the value 0 is a valid counter; checking the value for non-null would be an error here.
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.GListClear();
        UO.GListSet("processed", 0);
        var index = 0;
        if (Truth(index < UO.GListSize()))
        {
            var count = UO.GListPosValue(index);
            UO.Print("Valid zero count: " + Convert.ToString(count));
        }

        return null;
    }

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

Command implementation

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

UO.GListPosValue(index) — UO.GListPosValue(Integer)

Parameters: index (Integer)

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

public InjectionValue GListPosValue(int index) => index >= 0 && index < globalList.Count ? globalList[index].Value : InjectionValue.Zero;

UO.GListSet

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

C# signatures

void UO.GListSet(object? nameValue, object? value);

Writes a named value to a temporary list: for example, graphic loot rules or a counter for processed items.

Parameters

  • nameValue — object? is converted to a string. Names are compared case-insensitively: "bandage" and "BANDAGE" are one key. A non-empty string name is recommended; an empty name is also acceptable.

Return value

void - no result; a separate command, without assignment.

Behavior

  • The list belongs to the runtime instance. Other script runs have their own lists. GList is not shared cross-profile storage; these commands do not write a file and do not enter a saved profile state. The new runtime gets an empty list. It is also not var/variable declaration and not UO.SetGlobal.
  • The new name is added to the end. Repeating a case-insensitive name replaces the meaning and spelling of the name in its original place. Reading does not delete anything. You cannot clear or add records in the middle of a search if you need stable indexes.
  • Operations are local: no packets, no object searches, no latency. Set/Get search for the name sequentially; for larger sets use Dictionary. There is no separate command for deleting one key in this family; Clear clears all entries.

Standalone C# scripts

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

Simple example

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

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

UO.Print("Calling UO.GListSet");
UO.GListSet("gold", 0x0EED);

1. GListSet - 1 - direct script

Parameters and execution flow:

  • bandage and gold are the names of the rules, numbers are graphic. BANDAGE replaces the first entry, does not create a third; the output shows the order.
UO.GListClear();
UO.GListSet("bandage", 0x0E21);
UO.GListSet("gold", 0x0EED);
UO.GListSet("BANDAGE", 0x0E21);
var i = 0;
while (Truth(i < UO.GListSize()))
{
    var name = UO.GListPosName(i);
    var graphic = UO.GListPosValue(i);
    UO.Print(name + " | graphic: " + Convert.ToString(graphic));
    i = i + 1;
}

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

2. GListSet — 2 — script function

Parameters and execution flow:

  • processed starts with 0. Three steps increment the stored counter to 3; game items do not move here.
return  RunScenario();
 object? RunScenario()
{
    UO.GListClear();
    UO.GListSet("processed", 0);
    for (int i = (int)(1); i <= 3; i += (int)(1))
    {
        UO.GListSet("processed", UO.GListGet("processed") + 1);
    }

    UO.Print("Recorded count: " + Convert.ToString(UO.GListGet("processed")));
    return null;
}

3. GListSet - 3 - scenario class

Parameters and execution flow:

  • mode — string, limit — number 2. The mode selects the branch, the number limits the processing to two steps.
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.GListClear();
        UO.GListSet("mode", "inspect");
        UO.GListSet("limit", 2);
        if (Truth(UO.GListGet("mode") == "inspect"))
        {
            for (int i = (int)(1); i <= UO.GListGet("limit"); i += (int)(1))
            {
                UO.Print("Inspect batch: " + Convert.ToString(i));
            }
        }

        return null;
    }

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

Command implementation

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

UO.GListSet(nameValue, value) — UO.GListSet(Any,Any)

Parameters: nameValue (Any), value (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

public void GListSet(InjectionValue nameValue, InjectionValue value)

        {

            string name = nameValue.ToString();

            int index = globalList.FindIndex(pair => pair.Key.Equals(name, StringComparison.OrdinalIgnoreCase));

            var entry = new KeyValuePair<string, InjectionValue>(name, value);

            if (index >= 0)

                globalList[index] = entry;

            else

                globalList.Add(entry);

        }

UO.GListSize

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

C# signatures

int UO.GListSize();

Counts named entries in a temporary list to check for emptiness or limit brute force.

Parameters

There are no parameters.

Return value

int >= 0 — the number of unique names, not the number of items or units in the stacks.

Behavior

  • The list belongs to the runtime instance. Other script runs have their own lists. GList is not shared cross-profile storage; these commands do not write a file and do not enter a saved profile state. The new runtime gets an empty list. It is also not var/variable declaration and not UO.SetGlobal.
  • The new name is added to the end. Repeating a case-insensitive name replaces the meaning and spelling of the name in its original place. Reading does not delete anything. You cannot clear or add records in the middle of a search if you need stable indexes.
  • Operations are local: no packets, no object searches, no latency. Set/Get search for the name sequentially; for larger sets use Dictionary. There is no separate command for deleting one key in this family; Clear clears all entries.

Standalone C# scripts

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

Simple example

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

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

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

1. GListSize - 1 - direct script

Parameters and execution flow:

  • An empty set stops the procedure before the rules are processed.
UO.GListClear();
if (Truth(UO.GListSize() == 0))
{
    UO.Print("No batch rules; stop here");
    return null;
}

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

2. GListSize — 2 — script function

Parameters and execution flow:

  • The two rules are iterated over the indices 0 and 1; the condition i < Size does not allow access to the index 2.
return  RunScenario();
 object? RunScenario()
{
    UO.GListClear();
    UO.GListSet("bandage", 0x0E21);
    UO.GListSet("gold", 0x0EED);
    var i = 0;
    while (Truth(i < UO.GListSize()))
    {
        var name = UO.GListPosName(i);
        var graphic = UO.GListPosValue(i);
        UO.Print(name + " | graphic: " + Convert.ToString(graphic));
        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;

3. GListSize - 3 - scenario class

Parameters and execution flow:

  • Substitution BANDAGE does not increase the number of names; before and after Size is 2.
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.GListClear();
        UO.GListSet("bandage", 0x0E21);
        UO.GListSet("gold", 0x0EED);
        var before = UO.GListSize();
        UO.GListSet("BANDAGE", 0x0E21);
        if (Truth(UO.GListSize() == before))
        {
            UO.Print("Existing rule updated without an extra entry");
        }

        return null;
    }

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

Command implementation

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

UO.GListSize() — UO.GListSize()

Parameters: No parameters.

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int GListSize() => globalList.Count;

UO.GetEasyUO

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

C# signatures

string UO.GetEasyUO(object? number);

Reads a string from the user's Windows registry EasyUO.

Parameters

  • number is the int/value to be converted by NumberConversions.ToInt. Forms the decimal name registry value.

Return value

string — value HKCU\Software\EasyUO<number>; if it is not present, the name * is checked. If the key/value is missing or outside of Windows, an empty string is returned.

Behavior

  • Reading does not create a key or access the game world. The legacy registry interface is different from GetGlobal. System registry access error may spread; there is no separate catch in bridge.

Standalone C# scripts

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

Simple example

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

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

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

1. Read entry 1 - direct script

Parameters and execution flow:

  • The name is read first 1, then *1.
var value = UO.GetEasyUO(1);
UO.Print(value);

2. Check for empty result - script function

Parameters and execution flow:

  • An empty string can be no value or stored empty text.
return  RunScenario();
 object? RunScenario()
{
    var value = UO.GetEasyUO(999);
    if (Truth(Len(value) == 0))
    {
        UO.Print("empty");
    }

    return null;
}

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

3. Saved number - script class

Parameters and execution flow:

  • The number determines the registry value, not the serial of the object.
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 number = 2;
        var value = UO.GetEasyUO(number);
        UO.Print(value);
        return null;
    }
}

Command implementation

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

UO.GetEasyUO(number) — UO.GetEasyUO(Any)

Parameters: number (Any)

Result: string / String.

During a call:

Internal implementation code; this is not a standalone script.

public string GetEasyUO(InjectionValue number) => bridge.GetEasyUO(NumberConversions.ToInt(number));

UO.GetGlobal

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

C# signatures

string UO.GetGlobal(object? name);
dynamic UO.GetGlobal(object? globalRegion, object? varName);

Parameters

  • name — Name in short form. Case is important: "Loot" and "loot" are different keys. This is not a file path.
  • globalRegion - GlobalRegion - custom area label, VarName - name inside it; both are converted to strings. In this form, the case of both parts is not important. The labels 0 and 1 are valid, but do NOT enable cross-profile sharing and do NOT select server storage. Do not use the U+001F control delimiter in these names.
  • varName - GlobalRegion - custom area label, VarName - name inside it; both are converted to strings. In this form, the case of both parts is not important. The labels 0 and 1 are valid, but do NOT enable cross-profile sharing and do NOT select server storage. Do not use the U+001F control delimiter in these names.

Return value

Always string: GetGlobal(name) returns the stored string or "N/A" if the key is missing. GetGlobal(GlobalRegion, VarName) actually returns a string or "" if absent, although registered as object?. This is not bool or an automatically recovered number.

Behavior

  • The short form and the region form are two independent stores in the current runtime state. SetGlobal("x", value) does not write to GetGlobal(0, "x"). The snapshot includes both stores, but the call itself does not save the file: writing to disk is done by the profile saving mechanism. The other profile does not automatically receive these values. Global var/variable declaration and GList are separate mechanisms.
  • The retained "N/A" (short form) and "" (regional form) are indistinguishable from the absence of one GetGlobal. For settings, select valid values ​​other than the absence marker, or create a separate presence key. Check the string first, then convert the number.
  • UO.GetGlobal · UO.SetGlobal · UO.GListGet

Standalone C# scripts

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

Simple example

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

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

var result = UO.GetGlobal("manual.delay");
UO.Print("GetGlobal: " + Convert.ToString(result));

1. GetGlobal - 1 - direct script

Parameters and execution flow:

  • Delay: manual.delay - name; 350/600 - milliseconds. GetGlobal reads the line, IsNumeric checks it before Val. UO.Wait pauses only this script. The example does not change the network speed.
var text = UO.GetGlobal("manual.delay");
var delayMs = 350;
if (Truth(text != "N/A") && Truth(IsNumeric(text)))
{
    var parsed = Val(text);
    if (Truth(parsed >= 50) && Truth(parsed <= 5000))
    {
        delayMs = checked((int)parsed);
    }
}
await Delay(delayMs);

Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
bool IsNumeric(object? value) => double.TryParse(Convert.ToString(value), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out _);
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
double Val(object? value) => double.TryParse(Convert.ToString(value), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out var number) ? number : 0;

2. GetGlobal — 2 — script function

Parameters and execution flow:

  • Mode: manual and gather - different area labels; mode - key. Reading MANUAL/MODE finds manual/mode. Only hide mode triggers the Hiding skill; SetGlobal itself does nothing in the game.
return  RunScenario();
 object? RunScenario()
{
    UO.SetGlobal("manual", "mode", "hide");
    UO.SetGlobal("gather", "mode", "idle");
    var mode = UO.GetGlobal("MANUAL", "MODE");
    if (Truth(mode == "hide"))
    {
        UO.UseSkill("Hiding");
    }

    return null;
}

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

3. GetGlobal - 3 - scenario class

Parameters and execution flow:

  • ReadDelay(name, fallback) is shown in full: returns spare 350 ms for missing, non-numeric, or outside the range 50–5000 setting. The cycle is limited to three waiting attempts, not infinite.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
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;
    }

    async public Task<object?> RunScenarioAsync()
    {
        for (int attempt = (int)(1); attempt <= 3; attempt += (int)(1))
        {
            await Delay(ReadDelay("manual.delay", 350));
        }

        return null;
    }

    dynamic ReadDelay(dynamic name, dynamic fallback)
    {
        var text = UO.GetGlobal(name);
        if (Truth(text == "N/A"))
        {
            return fallback;
        }

        if (!(Truth(IsNumeric(text))))
        {
            return fallback;
        }

        var value = Val(text);
        if (Truth(value < 50) || Truth(value > 5000))
        {
            return fallback;
        }

        return value;
    }

    Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
    bool IsNumeric(object? value) => double.TryParse(Convert.ToString(value), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out _);
    bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
    double Val(object? value) => double.TryParse(Convert.ToString(value), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out var number) ? number : 0;
}

Command implementation

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

UO.GetGlobal(name) — UO.GetGlobal(String)

Parameters: name (String)

Result: string / String.

During a call:

Internal implementation code; this is not a standalone script.

public string GetGlobal(string name)
        {
            lock (globalsLock)
                return globals.TryGetValue(name, out var value) ? value : "N/A";
        }

UO.GetGlobal(globalRegion, varName) — UO.GetGlobal(Any,Any)

Parameters: globalRegion (Any), varName (Any)

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "getglobal":

                    return new InjectionValue(state.GlobalVariables.TryGetValue(Text(0) + "\u001F" + Text(1), out string globalValue)

                        ? globalValue : string.Empty);

UO.GetProfile

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

C# signatures

string UO.GetProfile(object? serial);

Reads the public character description that the server sends for the Profile window. Useful for reading notes or searching for text in the description of the selected character. These are not manager profile settings.

Parameters

  • serial — Character Serial: a number, a string with ID 0x... or an object selector such as "self" or "lasttarget". This is not a body type, a file name, or a manager profile.

Return value

string — text of the main description, without title and signature. Empty description is legal; an empty result is also possible if there is no response in 3 seconds. It's not true/false. A request is sent on every call; if the description is already saved in the session, it is returned immediately, including a draft of the open window. This is not a guarantee of a fresh server response.

Behavior

  • The description and its draft belong to the session. Closing the game window saves them without publishing them, opening them restores the Profile window. Explicitly closing your own Profile sends the modified text once; someone else's text is not sent. The new server response replaces the old data, disconnecting the connection clears it. GetProfile does not edit anything itself.

Standalone C# scripts

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

Simple example

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

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

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

1. Direct application - direct script

Parameters and execution flow:

  • "self" - description of your character; not account configuration. The text received from the server or already saved in the session is displayed.
var note = UO.GetProfile("self");
if (Truth(note != ""))
{
    UO.Print(note);
}

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

2. Game condition - scenario function

Parameters and execution flow:

  • Requires an existing lasttarget. FindText searches for the case-sensitive word "Healer" in free text. If there is a match, AddObject saves the selected serial under the name healerNote. This is a user note, not proof of profession NPC.
return  RunScenario();
 object? RunScenario()
{
    if (!(Truth(UO.Exists("lasttarget"))))
    {
        return null;
    }

    var note = UO.GetProfile("lasttarget");
    if (Truth(FindText(note, "Healer") > 0))
    {
        UO.AddObject("healerNote", "lasttarget");
    }

    return null;
}

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

3. Full Helper Function - Script Class

Parameters and execution flow:

  • The entire function HasPublicNote is given below. Checks the existence of an object and a substring, returns true/false. "Guild" - demo text; an empty response does not confirm the absence of such a record on the server.
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(HasPublicNote("lasttarget", "Guild")))
        {
            UO.AddObject("guildNote", "lasttarget");
        }

        return null;
    }

    dynamic HasPublicNote(dynamic serial, dynamic phrase)
    {
        if (!(Truth(UO.Exists(serial))))
        {
            return false;
        }

        return FindText(UO.GetProfile(serial), phrase) > 0;
    }

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

Command implementation

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

UO.GetProfile(serial) — UO.GetProfile(Any)

Parameters: serial (Any)

Result: string / String.

During a call:

Internal implementation code; this is not a standalone script.

public string GetProfile(InjectionValue serial) => bridge.GetProfile(GetObject(serial));

UO.LoadHotkeys

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

C# signatures

void UO.LoadHotkeys();

Loads saved macros and hotkeys.

Parameters

There are no parameters.

Return value

void - no value. Call on a separate line; completion does not confirm the server's action.

Behavior

  • LoadHotkeys calls _world.Macros.Load via Invoke. The current macro table is replaced with local profile data.
  • Modifies or displays only the specified local data. This command does not have server confirmation.

Standalone C# scripts

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

Simple example

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

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

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

1. Direct call - direct script

Parameters and execution flow:

  • Loads saved macros and hotkeys.
UO.LoadHotkeys();

2. Explicit option - script function

Parameters and execution flow:

  • LoadHotkeys calls _world.Macros.Load via Invoke. The current macro table is replaced with local profile data.
return  RunScenario();
 object? RunScenario()
{
    UO.Print(UO.ProfileName());
    UO.LoadHotkeys();
    return null;
}

3. Full Helper Function - Script Class

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.LoadHotkeys();
        UO.Print("Macros loaded");
        return null;
    }
}

Command implementation

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

UO.LoadHotkeys() — UO.LoadHotkeys()

Parameters: No parameters.

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "loadhotkeys": bridge.LoadHotkeys(); break;

UO.ProfileName

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

C# signatures

dynamic UO.ProfileName();

Reads the name of the current profile.

Parameters

There are no parameters.

Return value

string — text of the bridge field.ProfileName; without available data, an empty string is possible. This is not a connection sign and is not a numeric ID.

Behavior

  • ExecuteClientApiCompatibility returns bridge.ProfileName without changing the profile or server selection.
  • Reads the current local state. There is no package, target or automatic update; individual reads may see different states.

Standalone C# scripts

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

Simple example

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

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

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

1. Direct call - direct script

Parameters and execution flow:

  • Reads the name of the current profile.
var value = UO.ProfileName();
UO.Print(value);

2. Explicit option - script function

Parameters and execution flow:

  • ExecuteClientApiCompatibility returns bridge.ProfileName without changing the profile or server selection.
return  RunScenario();
 object? RunScenario()
{
    var value = UO.ProfileName();
    if (Truth(Len(value) > 0))
    {
        UO.TextPrint(value);
    }

    return null;
}

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

3. Full Helper Function - Script Class

Parameters and execution flow:

  • Reads the current local state. There is no package, target or automatic update; individual reads may see different states.
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 before = UO.ProfileName();
        UO.Wait(500);
        var after = UO.ProfileName();
        UO.Print(before = after);
        return null;
    }
}

Command implementation

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

UO.ProfileName() — UO.ProfileName()

Parameters: No parameters.

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "profilename": return new InjectionValue(bridge.ProfileName);

UO.ProfileShardName

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

C# signatures

dynamic UO.ProfileShardName();

Reads the shard name.

Parameters

There are no parameters.

Return value

string — text of the bridge field.ShardName; without available data, an empty string is possible. This is not a connection sign and is not a numeric ID.

Behavior

  • ExecuteClientApiCompatibility returns bridge.ShardName without changing the profile or server selection.
  • Reads the current local state. There is no package, target or automatic update; individual reads may see different states.

Standalone C# scripts

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

Simple example

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

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

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

1. Direct call - direct script

Parameters and execution flow:

  • Reads the shard name.
var value = UO.ProfileShardName();
UO.Print(value);

2. Explicit option - script function

Parameters and execution flow:

  • ExecuteClientApiCompatibility returns bridge.ShardName without changing the profile or server selection.
return  RunScenario();
 object? RunScenario()
{
    var value = UO.ProfileShardName();
    if (Truth(Len(value) > 0))
    {
        UO.TextPrint(value);
    }

    return null;
}

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

3. Full Helper Function - Script Class

Parameters and execution flow:

  • Reads the current local state. There is no package, target or automatic update; individual reads may see different states.
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 before = UO.ProfileShardName();
        UO.Wait(500);
        var after = UO.ProfileShardName();
        UO.Print(before = after);
        return null;
    }
}

Command implementation

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

UO.ProfileShardName() — UO.ProfileShardName()

Parameters: No parameters.

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "shardname":

                case "profileshardname": return new InjectionValue(bridge.ShardName);

UO.ReqProfile

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

C# signatures

void UO.ReqProfile();
void UO.ReqProfile(object? mobile);

Prints the character's known profile text.

Parameters

  • mobile — Optional serial/alias. Without argument - "lasttarget". This is not a local ClassicUO settings profile.

Return value

void - no value. Call on a separate line; completion does not confirm the server's action.

Behavior

  • ExecuteLegacyManualAlias calls GetProfile, then SystemMessage. Bridge.GetProfile sends RequestProfile, then up to 3 seconds checks CharacterPanels.Profile.CurrentText with pauses 25 ms. Already existing text can be returned immediately; with timeout it displays a message and gives an empty line. This command prints the text but does not return it.
  • For string value use UO.GetProfile. The presence of text is not proof of successful renaming or character status.

Standalone C# scripts

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

Simple example

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

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

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

1. Direct call - direct script

Parameters and execution flow:

  • Prints the character's known profile text.
UO.ReqProfile();

2. Explicit option - script function

Parameters and execution flow:

  • ExecuteLegacyManualAlias calls GetProfile, then SystemMessage. Bridge.GetProfile sends RequestProfile, then up to 3 seconds checks CharacterPanels.Profile.CurrentText with pauses 25 ms. Already existing text can be returned immediately; with timeout it displays a message and gives an empty line. This command prints the text but does not return it.
return  RunScenario();
 object? RunScenario()
{
    UO.ReqProfile("self");
    return null;
}

3. Full Helper Function - Script Class

Parameters and execution flow:

  • For string value use UO.GetProfile. The presence of text is not proof of successful renaming or character status.
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 = UO.GetSerial("lasttarget");
        if (Truth(UO.Exists(id)))
        {
            UO.ReqProfile(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;
}

Command implementation

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

UO.ReqProfile() — UO.ReqProfile()

Parameters: No parameters.

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "reqprofile":

                    SystemMessage(GetProfile(arguments.Length > 0 ? arguments[0] : new InjectionValue("lasttarget")));

                    break;

UO.ReqProfile(mobile) — UO.ReqProfile(Any)

Parameters: mobile (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "reqprofile":

                    SystemMessage(GetProfile(arguments.Length > 0 ? arguments[0] : new InjectionValue("lasttarget")));

                    break;

UO.ResetProfile

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

C# signatures

void UO.ResetProfile();

Resets the active profile to default values.

Parameters

There are no parameters.

Return value

void - no value. Call on a separate line; completion does not confirm the server's action.

Behavior

  • ResetProfile calls ProfileManager.ResetCurrentProfileToDefault; if there is no active profile, an error is displayed. Changes local settings, so saved user values ​​may be lost.
  • Modifies or displays only the specified local data. This command does not have server confirmation.

Standalone C# scripts

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

Simple example

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

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

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

1. Direct call - direct script

Parameters and execution flow:

  • Resets the active profile to default values.
UO.ResetProfile();

2. Explicit option - script function

Parameters and execution flow:

  • ResetProfile calls ProfileManager.ResetCurrentProfileToDefault; if there is no active profile, an error is displayed. Changes local settings, so saved user values ​​may be lost.
return  RunScenario();
 object? RunScenario()
{
    UO.Print(UO.ProfileName());
    UO.ResetProfile();
    return null;
}

3. Full Helper Function - Script Class

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.ResetProfile();
        UO.SaveConfig();
        return null;
    }
}

Command implementation

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

UO.ResetProfile() — UO.ResetProfile()

Parameters: No parameters.

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "resetprofile": bridge.ResetProfile(); break;

UO.SaveConfig

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

C# signatures

void UO.SaveConfig();

Saves the current ClassicUO profile.

Parameters

There are no parameters.

Return value

void - no value. Call on a separate line; completion does not confirm the server's action.

Behavior

  • SaveConfig calls ProfileManager.SaveCurrentProfile via Invoke. The command writes the local profile settings; the path is taken from ProfileManager.
  • Modifies or displays only the specified local data. This command does not have server confirmation.

Standalone C# scripts

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

Simple example

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

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

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

1. Direct call - direct script

Parameters and execution flow:

  • Saves the current ClassicUO profile.
UO.SaveConfig();

2. Explicit option - script function

Parameters and execution flow:

  • SaveConfig calls ProfileManager.SaveCurrentProfile via Invoke. The command writes the local profile settings; the path is taken from ProfileManager.
return  RunScenario();
 object? RunScenario()
{
    UO.Print(UO.ProfileName());
    UO.SaveConfig();
    return null;
}

3. Full Helper Function - Script Class

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.SaveConfig();
        UO.Print(UO.ShardPath());
        return null;
    }
}

Command implementation

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

UO.SaveConfig() — UO.SaveConfig()

Parameters: No parameters.

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

public void SaveConfig() => bridge.SaveConfig();

UO.SaveHotkeys

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

C# signatures

void UO.SaveHotkeys();

Saves macros and hotkeys.

Parameters

There are no parameters.

Return value

void - no value. Call on a separate line; completion does not confirm the server's action.

Behavior

  • SaveHotkeys calls _world.Macros.Save via Invoke. The local macro table of the current profile is saved.
  • Modifies or displays only the specified local data. This command does not have server confirmation.

Standalone C# scripts

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

Simple example

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

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

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

1. Direct call - direct script

Parameters and execution flow:

  • Saves macros and hotkeys.
UO.SaveHotkeys();

2. Explicit option - script function

Parameters and execution flow:

  • SaveHotkeys calls _world.Macros.Save via Invoke. The local macro table of the current profile is saved.
return  RunScenario();
 object? RunScenario()
{
    UO.Print(UO.ProfileName());
    UO.SaveHotkeys();
    return null;
}

3. Full Helper Function - Script Class

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.SaveHotkeys();
        UO.LoadHotkeys();
        return null;
    }
}

Command implementation

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

UO.SaveHotkeys() — UO.SaveHotkeys()

Parameters: No parameters.

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "savehotkeys": bridge.SaveHotkeys(); break;

UO.Set

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

C# signatures

void UO.Set(object? name, object? value);

Changes one of three legacy settings.

Parameters

  • name — Case insensitive string: "finddistance", "grabdelay" or "equipfordress". The unknown name is silently ignored.
  • value — int or double/0x-text. For the string form TryStr2Int; incorrect text becomes 0, not an error.

Return value

void - no value. Call on a separate line; completion does not confirm the server's action.

Behavior

  • finddistance calls bridge.SetFindDistance, grabdelay calls bridge.SetGrabDelay, equipfordress assigns state.UseEquipForDress. These are three separate settings; There is no universal setter for arbitrary properties.
  • The string value is first converted TryStr2Int with fallback=0. Therefore, a typo may write 0 into the recognized setting. Set itself does not look for objects and does not change clothes.

Standalone C# scripts

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

Simple example

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

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

UO.Print("Calling UO.Set");
UO.Set("finddistance", 10);

1. Direct call - direct script

Parameters and execution flow:

  • Changes one of three legacy settings.
UO.Set("finddistance", 10);

2. Explicit option - script function

Parameters and execution flow:

  • finddistance calls bridge.SetFindDistance, grabdelay calls bridge.SetGrabDelay, equipfordress assigns state.UseEquipForDress. These are three separate settings; There is no universal setter for arbitrary properties.
return  RunScenario();
 object? RunScenario()
{
    UO.Set("grabdelay", "250");
    return null;
}

3. Full Helper Function - Script Class

Parameters and execution flow:

  • The string value is first converted TryStr2Int with fallback=0. Therefore, a typo may write 0 into the recognized setting. Set itself does not look for objects and does not change clothes.
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.Set("equipfordress", 1);
        UO.Print(UO.FindDistance());
        return null;
    }
}

Command implementation

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

UO.Set(name, value) — UO.Set(String,Integer)

Parameters: name (String), value (Integer/String)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

public void Set(string name, int value)

        {

            if (name.Equals("finddistance", StringComparison.OrdinalIgnoreCase))

            {

                bridge.SetFindDistance(value);

            }

            else if (name.Equals("grabdelay", StringComparison.OrdinalIgnoreCase))

            {

                bridge.SetGrabDelay(value);

            }

            else if (name.Equals("equipfordress", StringComparison.OrdinalIgnoreCase))

            {

                state.UseEquipForDress = value;

            }

        }

UO.Set(name, value) — UO.Set(String,String)

Parameters: name (String), value (Integer/String)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

public void Set(string name, string valueStr)

        {

            int valueInt = NumberConversions.TryStr2Int(valueStr, out var value) ? value : 0;

            Set(name, valueInt);

        }

UO.SetDefault

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

C# signatures

void UO.SetDefault(object? name, object? @object);

Saves the named alias serial in the runtime state.

Parameters

  • name — Name alias as text, case handles Objects dictionary.
  • object — Serial/alias via Arg/GetObject. Name and serial come in that order.

Return value

void - no value. Call on a separate line; completion does not confirm the server's action.

Behavior

  • ExecuteLegacyManualAlias calls state.Objects.Set(Text(0),Arg(1)). There is no interactive choice; the existence of serial is not checked.
  • This is recording the object name, not resetting the profile or changing all settings to defaults. On subsequent calls, the alias is resolved again.
  • 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.

Standalone C# scripts

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

Simple example

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

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

UO.Print("Calling UO.SetDefault");
UO.SetDefault("manualObject", UO.Self());

1. Direct call - direct script

Parameters and execution flow:

  • Saves the named alias serial in the runtime state.
UO.SetDefault("manualObject", UO.Self());

2. Explicit option - script function

Parameters and execution flow:

  • ExecuteLegacyManualAlias calls state.Objects.Set(Text(0),Arg(1)). There is no interactive choice; the existence of serial is not checked.
return  RunScenario();
 object? RunScenario()
{
    UO.SetDefault("manualBag", UO.Backpack());
    UO.Print(UO.GetSerial("manualBag"));
    return null;
}

3. Full Helper Function - Script Class

Parameters and execution flow:

  • This is recording the object name, not resetting the profile or changing all settings to defaults. On subsequent calls, the alias is resolved 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 id = UO.GetSerial("lasttarget");
        if (Truth(UO.Exists(id)))
        {
            UO.SetDefault("manualTarget", id);
            UO.Print(UO.GetName("manualTarget"));
        }

        return null;
    }

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

Command implementation

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

UO.SetDefault(name, object) — UO.SetDefault(Any,Any)

Parameters: name (Any), object (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "setdefault":

                    if (arguments.Length > 1) state.Objects.Set(Text(0), Arg(1));

                    break;

UO.SetEasyUO

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

C# signatures

void UO.SetEasyUO(object? number, object? value);

Writes a string value to the Windows registry EasyUO.

Parameters

  • number — int value number, formatted double without *-prefix.
  • value — Text through ToString; saved as transmitted.

Return value

void - no value. Call on a separate line; completion does not confirm the server's action.

Behavior

  • On Windows, opens/creates HKCU\Software\EasyUO with write permission, SetValue(decimalNumber,value,RegistryValueKind.string). On other OSes it displays a message and does not record it.
  • This is an external permanent entry in the registry of the current user, not scoped global runtime and not game serial. Registry access errors are not hidden by this function.

Standalone C# scripts

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

Simple example

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

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

UO.Print("Calling UO.SetEasyUO");
UO.SetEasyUO(9001, "manual-example");

1. Direct call - direct script

Parameters and execution flow:

  • Writes a string value to the Windows registry EasyUO.
UO.SetEasyUO(9001, "manual-example");

2. Explicit option - script function

Parameters and execution flow:

  • On Windows, opens/creates HKCU\Software\EasyUO with write permission, SetValue(decimalNumber,value,RegistryValueKind.String). On other OSes it displays a message and does not record it.
return  RunScenario();
 object? RunScenario()
{
    UO.SetEasyUO(9001, "");
    return null;
}

3. Full Helper Function - Script Class

Parameters and execution flow:

  • This is an external permanent entry in the registry of the current user, not scoped global runtime and not game serial. Registry access errors are not hidden by this function.
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.SetEasyUO(9001, "manual-example");
        UO.Print(UO.GetEasyUO(9001));
        return null;
    }
}

Command implementation

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

UO.SetEasyUO(number, value) — UO.SetEasyUO(Any,Any)

Parameters: number (Any), value (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

public void SetEasyUO(InjectionValue number, InjectionValue value)

            => bridge.SetEasyUO(NumberConversions.ToInt(number), value.ToString());

UO.SetGlobal

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

C# signatures

void UO.SetGlobal(object? name, object? value);
void UO.SetGlobal(object? globalRegion, object? varName, object? varValue);

Writes a named script setting for later reading via UO.GetGlobal. A repeated entry replaces the value of the same key.

Parameters

  • name — Name in short form. Case is important: "Loot" and "loot" are different keys. This is not a file path.
  • globalRegion - GlobalRegion - custom area label, VarName - name inside it; both are converted to strings. In this form, the case of both parts is not important. The labels 0 and 1 are valid, but do NOT enable cross-profile sharing and do NOT select server storage. Do not use the U+001F control delimiter in these names.
  • varName - GlobalRegion - custom area label, VarName - name inside it; both are converted to strings. In this form, the case of both parts is not important. The labels 0 and 1 are valid, but do NOT enable cross-profile sharing and do NOT select server storage. Do not use the U+001F control delimiter in these names.

Return value

void - no return value. Call as a separate line, without assigning the result and comparing with true.

Behavior

  • The short form and the region form are two independent stores in the current runtime state. SetGlobal("x", value) does not write to GetGlobal(0, "x"). The snapshot includes both stores, but the call itself does not save the file: writing to disk is done by the profile saving mechanism. The other profile does not automatically receive these values. Global var/variable declaration and GList are separate mechanisms.
  • The retained "N/A" (short form) and "" (regional form) are indistinguishable from the absence of one GetGlobal. For settings, select valid values ​​other than the absence marker, or create a separate presence key. Check the string first, then convert the number.
  • UO.GetGlobal · UO.SetGlobal · UO.GListGet
  • 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.

Standalone C# scripts

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

Simple example

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

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

UO.Print("Calling UO.SetGlobal");
UO.SetGlobal("manual.delay", 350);

1. SetGlobal - 1 - direct script

Parameters and execution flow:

  • Delay: manual.delay - name; 350/600 - milliseconds. GetGlobal reads the line, IsNumeric checks it before Val. UO.Wait pauses only this script. The example does not change the network speed.
UO.SetGlobal("manual.delay", 350);
UO.SetGlobal("manual.delay", 600);
var text = UO.GetGlobal("manual.delay");
if (Truth(IsNumeric(text)))
{
    await Delay(Val(text));
}

Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
bool IsNumeric(object? value) => double.TryParse(Convert.ToString(value), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out _);
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
double Val(object? value) => double.TryParse(Convert.ToString(value), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out var number) ? number : 0;

2. SetGlobal — 2 — script function

Parameters and execution flow:

  • Mode: manual and gather - different area labels; mode - key. Reading MANUAL/MODE finds manual/mode. Only hide mode triggers the Hiding skill; SetGlobal itself does nothing in the game.
return  RunScenario();
 object? RunScenario()
{
    UO.SetGlobal("manual", "mode", "idle");
    UO.SetGlobal("gather", "mode", "hide");
    UO.SetGlobal("MANUAL", "MODE", "hide");
    if (Truth(UO.GetGlobal("manual", "mode") == "hide"))
    {
        UO.UseSkill("Hiding");
    }

    return null;
}

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

3. SetGlobal - 3 - scenario class

Parameters and execution flow:

  • ReadDelay(name, fallback) is shown in full: returns spare 350 ms for missing, non-numeric, or outside the range 50–5000 setting. The cycle is limited to three waiting attempts, not infinite.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
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;
    }

    async public Task<object?> RunScenarioAsync()
    {
        UO.SetGlobal("manual.delay", "invalid");
        for (int attempt = (int)(1); attempt <= 3; attempt += (int)(1))
        {
            await Delay(ReadDelay("manual.delay", 350));
        }

        return null;
    }

    dynamic ReadDelay(dynamic name, dynamic fallback)
    {
        var text = UO.GetGlobal(name);
        if (Truth(text == "N/A"))
        {
            return fallback;
        }

        if (!(Truth(IsNumeric(text))))
        {
            return fallback;
        }

        var value = Val(text);
        if (Truth(value < 50) || Truth(value > 5000))
        {
            return fallback;
        }

        return value;
    }

    Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
    bool IsNumeric(object? value) => double.TryParse(Convert.ToString(value), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out _);
    bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
    double Val(object? value) => double.TryParse(Convert.ToString(value), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out var number) ? number : 0;
}

Command implementation

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

UO.SetGlobal(name, value) — UO.SetGlobal(String,Decimal)

Parameters: name (String), value (Decimal/Integer/String)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

public void SetGlobal(string name, double value) => SetGlobal(name, value.ToString());

UO.SetGlobal(name, value) — UO.SetGlobal(String,Integer)

Parameters: name (String), value (Decimal/Integer/String)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

public void SetGlobal(string name, int value) => SetGlobal(name, value.ToString());

UO.SetGlobal(name, value) — UO.SetGlobal(String,String)

Parameters: name (String), value (Decimal/Integer/String)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

public void SetGlobal(string name, string value)
        {
            lock (globalsLock)
                globals[name] = value;
        }

UO.SetGlobal(globalRegion, varName, varValue) — UO.SetGlobal(Any,Any,Any)

Parameters: globalRegion (Any), varName (Any), varValue (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "setglobal":

                    state.GlobalVariables[Text(0) + "\u001F" + Text(1)] = Text(2);

                    return InjectionValue.Unit;

UO.SetMulPath

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

C# signatures

void UO.SetMulPath(object? pathValue);

Saves the path string mulPath at runtime.

Parameters

  • pathValue — Text through ToString; saved as transmitted.

Return value

void - no value. Call on a separate line; completion does not confirm the server's action.

Behavior

  • Assigns mulPath = ToString or the empty string. The file does not open, map data is not reloaded, and path availability is not checked by this function.
  • 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.

Standalone C# scripts

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

Simple example

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

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

UO.Print("Calling UO.SetMulPath");
UO.SetMulPath("C:\\Ultima Online");

1. Direct call - direct script

Parameters and execution flow:

  • Saves the path string mulPath at runtime.
UO.SetMulPath("C:\\Ultima Online");

2. Explicit option - script function

Parameters and execution flow:

  • Assigns mulPath = ToString or the empty string. The file does not open, map data is not reloaded, and path availability is not checked by this function.
return  RunScenario();
 object? RunScenario()
{
    UO.SetMulPath("");
    return null;
}

3. Full Helper Function - Script Class

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("C:\\Ultima Online");
        return null;
    }

    void ApplyValue(dynamic value)
    {
        UO.SetMulPath(value);
    }
}

Command implementation

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

UO.SetMulPath(pathValue) — UO.SetMulPath(Any)

Parameters: pathValue (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

public void SetMulPath(InjectionValue pathValue) => mulPath = pathValue.ToString() ?? string.Empty;

Clone this wiki locally