EN UO Topic diagnostics introspection - LIHACHTETAN/ClassicUO-Bad-Newbie-CSharp-Scripts-IDE GitHub Wiki

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

Diagnostics & Introspection

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

Inspection of objects, tiles and gumps, checking names, parameters and signatures API. The presence of a signature does not confirm the possibility of a game action in the current state.

Sections

Topic Commands and explanations
Help UO.Help
Dump UO.Dump
Info UO.Info
InfoTile UO.InfoTile
InfoGump UO.InfoGump
API Name Exists UO.ApiNameExists
API Signature Exists UO.ApiSignatureExists
API Parameter Exists UO.ApiParameterExists
Version UO.Version

All theme commands

Inspection

UO.Help · UO.Dump · UO.Info · UO.InfoColor · UO.GetInfo · UO.ExtendedInfo · UO.InfoTile · UO.InfoGump · UO.InfoGumps · UO.ApiNameExists · UO.ApiParameterExists · UO.ApiSignatureExists · UO.Version · UO.ClientInfo

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.InfoGump

Parameters, result and all scenarios

UO.InfoGump();

UO.ApiNameExists

Parameters, result and all scenarios

return UO.ApiNameExists("UO.GetType");

Complete command reference


UO.ApiNameExists

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

C# signatures

int UO.ApiNameExists(object? name);

Checks the registration of the name of the native function being called.

Parameters

  • name — Required string: exact registered name, not a calling expression. Case and edge spaces are not important; UO. is not added automatically. An empty or unknown name gives 0. User procedures are not taken into account.

Return value

int: 1 means the name is registered; 0 means it is not. In C#, use result != 0 or result == 0. Comparing int with true or false is invalid. Registration does not confirm a server action.

Behavior

Standalone C# scripts

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

Simple example

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

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

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

1. UO.ApiNameExists - 1 - direct script

Parameters and execution flow:

  • The first example tests the game name with an explicit UO. and returns 1. The exact name being tested and the number of arguments when it is required are visible in the call.
return UO.ApiNameExists("UO.GetType");

2. UO.ApiNameExists — 2 — script function

This checks native name registration only. Convert.ToInt32 is a .NET method, not a UO API entry, so ApiNameExists returns 0. The method remains available in normal C#.

return  RunScenario();
 object? RunScenario()
{
    var name = "Convert.ToInt32";
    return UO.ApiNameExists(name);
    return null;
}

3. UO.ApiNameExists - 3 - scenario class

Each numeric result is compared with 0; && then combines two bool values. For these names, the result is false.

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()
    {
        return HasBoth("GetType", "UO.GetType");
        return null;
    }

    dynamic HasBoth(dynamic first, dynamic second)
    {
        return UO.ApiNameExists(first) != 0 && UO.ApiNameExists(second) != 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.ApiNameExists(name) — UO.ApiNameExists(String)

Parameters: name (String)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int ApiNameExists(string name)

        {

            string normalized = NormalizeApiName(name);

            return metadata.NativeSubrutines.Any(definition =>

                definition.Name.Equals(normalized, StringComparison.OrdinalIgnoreCase)) ? 1 : 0;

        }

UO.ApiParameterExists

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

C# signatures

int UO.ApiParameterExists(object? name);

Checks whether a runtime value or named object is registered.

Parameters

  • name — Required string: exact registered name, not a calling expression. Case and edge spaces are not important; UO. is not added automatically. An empty or unknown name gives 0. User procedures are not taken into account.

Return value

int: 1 means the name is registered; 0 means it is not. In C#, use result != 0 or result == 0. Comparing int with true or false is invalid. Registration does not confirm a server action.

Behavior

Standalone C# scripts

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

Simple example

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

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

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

1. UO.ApiParameterExists - 1 - direct script

Parameters and execution flow:

  • The first example tests the game name with an explicit UO. and returns 1. The exact name being tested and the number of arguments when it is required are visible in the call.
return UO.ApiParameterExists("UO.GetHP");

2. UO.ApiParameterExists — 2 — script function

The registered backpack selector is checked and returns 1. This does not inspect C# method parameters or prove that a backpack exists in the game world.

return  RunScenario();
 object? RunScenario()
{
    var name = "backpack";
    return UO.ApiParameterExists(name);
    return null;
}

3. UO.ApiParameterExists - 3 - scenario class

Parameters and execution flow:

  • The third example contains a complete helper function. It compares the removed short form or unsupported arity with the available form. The parameters name, first, second and count pass names/counts unchanged. The result is 0 for call checks and 0:1 for value checks.
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()
    {
        return CompareNames("GetHP", "UO.GetHP");
        return null;
    }

    dynamic CompareNames(dynamic first, dynamic second)
    {
        return Convert.ToString(UO.ApiParameterExists(first)) + ":" + Convert.ToString(UO.ApiParameterExists(second));
    }
}

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.ApiParameterExists(name) — UO.ApiParameterExists(String)

Parameters: name (String)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int ApiParameterExists(string name)

        {

            string value = (name ?? string.Empty).Trim();

            if (value.Length == 0)

                return 0;



            if (Metadata.ShortcutVariables.Any(item => item.Equals(value, StringComparison.OrdinalIgnoreCase)))

                return 1;



            return metadata.IntrinsicVariableExists(value) ? 1 : 0;

        }

UO.ApiSignatureExists

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

C# signatures

int UO.ApiSignatureExists(object? name, object? argumentCount);

Tests the registration of a name with the given number of arguments.

Parameters

  • name — Required string: exact registered name, not a calling expression. Case and edge spaces are not important; UO. is not added automatically. An empty or unknown name gives 0. User procedures are not taken into account.
  • argumentCount — Required int: the total number of positional arguments, including optional ones explicitly passed. A negative or unsupported quantity gives 0. The types of the arguments themselves are not checked.

Return value

int: 1 means the name is registered; 0 means it is not. In C#, use result != 0 or result == 0. Comparing int with true or false is invalid. Registration does not confirm a server action.

Behavior

Standalone C# scripts

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

Simple example

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

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

var result = UO.ApiSignatureExists("UO.GetType", 1);
UO.Print("ApiSignatureExists: " + Convert.ToString(result));

1. UO.ApiSignatureExists - 1 - direct script

Parameters and execution flow:

  • The first example tests the game name with an explicit UO. and returns 1. The exact name being tested and the number of arguments when it is required are visible in the call.
return UO.ApiSignatureExists("UO.GetType",1);

2. UO.ApiSignatureExists — 2 — script function

The one-argument and zero-argument forms of UO.FindType are checked. The result is the string "1:0"; the zero-argument form is not registered.

return  RunScenario();
 object? RunScenario()
{
    return Convert.ToString(UO.ApiSignatureExists("UO.FindType", 1)) + ":" + Convert.ToString(UO.ApiSignatureExists("UO.FindType", 0));
    return null;
}

3. UO.ApiSignatureExists - 3 - scenario class

Parameters and execution flow:

  • The third example contains a complete helper function. It compares the removed short form or unsupported arity with the available form. The parameters name, first, second and count pass names/counts unchanged. The result is 0 for call checks and 0:1 for value checks.
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()
    {
        return CheckForm("UO.GetType", 0);
        return null;
    }

    dynamic CheckForm(dynamic name, dynamic count)
    {
        return UO.ApiSignatureExists(name, count);
    }
}

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.ApiSignatureExists(name, argumentCount) — UO.ApiSignatureExists(String,Integer)

Parameters: name (String), argumentCount (Integer)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int ApiSignatureExists(string name, int argumentCount)

            => metadata.NativeSubrutineExists(NormalizeApiName(name), argumentCount) ? 1 : 0;

UO.ClientInfo

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

C# signatures

dynamic UO.ClientInfo();

Reads brief information about the running client.

Parameters

There are no parameters.

Return value

Array of three strings: [0] - product name, [1] - version of the running client, [2] - client directory. The indices start with 0. This is not the string JSON, nor is it a dictionary.

Behavior

  • Data is read from RuntimeProductName, RuntimeProductVersion and ClientPath. The command does not change anything and does not send anything to the server.
  • Use ArrayLength before indexing in a general helper function. Don't confuse client information with character stats or server version.
  • Reads information about the current ClassicUO client.

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.ClientInfo();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));

1. Read all three fields - direct script

Parameters and execution flow:

  • 0 - product, 1 - version, 2 - catalog. The version value is taken at startup; in the example it is not fixed.
var info = UO.ClientInfo();
UO.Print("Product: " + info[0]);
UO.Print("Client version: " + info[1]);
UO.Print("Client folder: " + info[2]);

2. Loop through array - script function

Parameters and execution flow:

  • ArrayLength returns the number of fields. The last valid index is equal to the length minus 1.
return  RunScenario();
 object? RunScenario()
{
    var info = UO.ClientInfo();
    var i = 0;
    while (Truth(i < ArrayLength(info)))
    {
        UO.Print(Convert.ToString(i) + ": " + info[i]);
        i = i + 1;
    }

    return null;
}

int ArrayLength(object? value) => value is System.Array array ? array.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. Complete Client Signature Retrieval Function - Script Class

Parameters and execution flow:

  • ClientCaption returns a string of title and version. The original array is not changed.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

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

    dynamic ClientCaption()
    {
        var info = UO.ClientInfo();
        if (Truth(ArrayLength(info) < 2))
        {
            return "Client information unavailable";
        }

        return info[0] + " / " + info[1];
    }

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

Command implementation

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

UO.ClientInfo() — UO.ClientInfo()

Parameters: No parameters.

Result: dynamic / Array.

During a call:

Internal implementation code; this is not a standalone script.

case "clientinfo":

                    return new InjectionValue(new[]

                    {

                        new InjectionValue(bridge.RuntimeProductName),

                        new InjectionValue(bridge.RuntimeProductVersion),

                        new InjectionValue(bridge.ClientPath)

                    });

UO.Dump

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

C# signatures

void UO.Dump();
void UO.Dump(object? @object);

Prints a diagnostic snapshot of an object known to the client.

Parameters

  • object — Optional serial/link. Without an argument, bridge.LastTarget is used.

Return value

void - no return value.

Behavior

  • The message contains serial as 0xXXXXXXXX, name, graphic/type, hue and X/Y/Z. The fields are read from the local model; a missing object gives an empty name and null fields. The command does not request the latest server properties.

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.Dump");
UO.Dump();

1. Snapshot of the last target - direct script

Parameters and execution flow:

  • A missing argument means LastTarget.
UO.Dump();

2. Self-shot - script function

Parameters and execution flow:

  • All fields are specific to your own character.
return  RunScenario();
 object? RunScenario()
{
    UO.Dump("self");
    return null;
}

3. Snapshot of Inspected Object - Script Class

Parameters and execution flow:

  • The Exists check separates a missing model from an object with null fields.
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.LastTarget();
        if (Truth(UO.Exists(id)))
        {
            UO.Dump(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.Dump() — UO.Dump()

Parameters: No parameters.

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "dump":

                {

                    int id = Arg(0, bridge.LastTarget);

                    SystemMessage($"0x{id:X8} {bridge.GetName(id)} type=0x{bridge.GetGraphics(id):X4} hue=0x{bridge.GetColor(id):X4} xyz={bridge.GetX(id)},{bridge.GetY(id)},{bridge.GetZ(id)}");

                    break;

                }

UO.Dump(object) — UO.Dump(Any)

Parameters: object (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "dump":

                {

                    int id = Arg(0, bridge.LastTarget);

                    SystemMessage($"0x{id:X8} {bridge.GetName(id)} type=0x{bridge.GetGraphics(id):X4} hue=0x{bridge.GetColor(id):X4} xyz={bridge.GetX(id)},{bridge.GetY(id)},{bridge.GetZ(id)}");

                    break;

                }

UO.ExtendedInfo

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

C# signatures

dynamic UO.ExtendedInfo();

Returns four fields of the current client connection configuration.

Parameters

There are no parameters.

Return value

Array [ClientPath:string, CurrentProfilePath:string, GameServerAddress:string, GameServerPort:int].

Behavior

  • The order of the fields is fixed. ClientPath and CurrentProfilePath are client paths. GameServerAddress and GameServerPort read global Settings.GlobalSettings.IP/Port: This is the configured address, not checking the actual peer manager session. The list does not contain a password and does not prompt the server for information. Blank values ​​are possible before selecting a profile/connection.

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.ExtendedInfo();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));

1. Output fields - direct script

Parameters and execution flow:

  • The array contains mixed types, so Convert.ToString is used.
var info = UO.ExtendedInfo();
for (int i = (int)(0); i <= ArrayLength(info)-1; i += (int)(1))
{
    UO.Print(Convert.ToString(info[i]));
}

int ArrayLength(object? value) => value is System.Array array ? array.Length : 0;

2. Print address and port - script function

Parameters and execution flow:

  • The indices 2 and 3 are the address and port.
return  RunScenario();
 object? RunScenario()
{
    var info = UO.ExtendedInfo();
    UO.Print(Convert.ToString(info[2]) + ":" + Convert.ToString(info[3]));
    return null;
}

3. Read Profile Path - Script Class

Parameters and execution flow:

  • Index 1 — CurrentProfilePath, not ClientPath.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        var info = UO.ExtendedInfo();
        var path = info[1];
        UO.Print(path);
        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.ExtendedInfo() — UO.ExtendedInfo()

Parameters: No parameters.

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "extendedinfo":

                    return new InjectionValue(new[] { new InjectionValue(bridge.ClientPath), new InjectionValue(bridge.CurrentProfilePath), new InjectionValue(bridge.GameServerAddress), new InjectionValue(bridge.GameServerPort) });

UO.GetInfo

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

C# signatures

string UO.GetInfo(object? arg);

Returns the character name only for the exact character selector.

Parameters

  • arg — string. The exact case-sensitive value of character calls GetName("self"); any other value is not recognized.

Return value

string — name of your character for character; string literal UNKNOWN for all other arguments. If there is no character, the name may be empty.

Behavior

  • The comparison StringComparison.Ordinal is case sensitive. Only the character selector is supported. The command does not make network requests: it reads the name from the local character model. Window FillInfoWindow is controlled 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.

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

1. Character name - direct script

Parameters and execution flow:

  • The exact character literal reads self.
var name = UO.GetInfo("character");
UO.Print(name);

2. Other Case - Script Function

Parameters and execution flow:

  • Character does not match and returns UNKNOWN.
return  RunScenario();
 object? RunScenario()
{
    var value = UO.GetInfo("Character");
    UO.Print(value);
    return null;
}

3. Unknown selector - script class

Parameters and execution flow:

  • profile is not supported by this implementation.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        var value = UO.GetInfo("profile");
        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.GetInfo(arg) — UO.GetInfo(String)

Parameters: arg (String)

Result: string / String.

During a call:

Internal implementation code; this is not a standalone script.

private string GetInfo(string arg)

        {

            if (arg.Equals("character", StringComparison.Ordinal))

                return GetName("self");



            return "UNKNOWN";

        }

UO.Help

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

C# signatures

void UO.Help();

Parameters

There are no parameters.

Return value

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

Behavior

  • 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.Help");
UO.Help();

1. Direct call - direct script

Parameters and execution flow:

  • Shows local hint about C# IDE.
UO.Help();

2. Explicit option - script function

Parameters and execution flow:

  • ExecuteLegacyManualAlias displays a line about UO.*, the configured chat prefix and Options > C# IDE > Manual via SystemMessage. A help request is not sent to the server.
return  RunScenario();
 object? RunScenario()
{
    UO.Help();
    UO.OpenIDE();
    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.Help();
        UO.Print("Options > C# IDE > Manual");
        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.Help() — UO.Help()

Parameters: No parameters.

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "help": SystemMessage("C# Scripts IDE: use UO.* in scripts or the configured chat prefix. Open Options > C# Scripts IDE > Manual."); break;

UO.Info

C# signatures

string UO.Info();
string UO.Info(object? serial);
string UO.Info(object? type, object? x, object? y);
string UO.Info(object? type, object? x, object? y, object? z);

Behavior and result

Invocation origin controls presentation: graphical chat commands and bound console commands open a table with fields, values, Ctrl+C and scrolling. Ordinary C# scripts receive report strings without windows or target cursors, even with an open game window. Only client-known data is available.

Parameterless Info and InfoTile arm a target in graphical chat. In a script, Info() reads the last object target or the player; InfoTile() reads the land under the player. Explicit serial, type and coordinates query the chosen object or tile. The third argument of InfoTile(x,y,map) is a map number.

Parameters

  • serial — Object serial number or a saved alias.
  • type — Item graphic ID; -1 matches any type at the specified position.
  • x — World X coordinate.
  • y — World Y coordinate.
  • z — Z elevation; the shorter overload uses 0.

Configure the prefix in C# Scripts IDE; # below is an example. Separate parameters with spaces; quotes keep text in one argument. id means serial and type means graphic. xy x y [z] selects the first loaded object at the point; type alone resolves the first matching loaded object. The third argument of InfoTile(x,y,map) is a map number, not Z.

Chat commands

#info
#UO.Info id 0x40001234
#info type 0x0EED
#info xy 1450 1690
#info type 0x0EED xy 1450 1690 0

Complete C# examples

Each block is a complete standalone .csx. Replace demonstration serials, types and coordinates. Arguments follow the signature order; named C# arguments make their roles explicit.

1

string report = UO.Info(0x40001234);
UO.Print(report);

2

string InspectSelf() => UO.Info("self");
UO.Print(InspectSelf());

3

foreach (int serial in new[] { 0x40001234, 0x40005678 })
{
    string report = UO.Info(serial);
    UO.Print(report);
}

4

new CommandSample().Execute(UO);

sealed class CommandSample
{
    public void Execute(global::ClassicUO.CSharp.CSharpGameApi api)
    {
        string report = api.Info(0x40001234);
        api.Print(report);
    }
}

Internal calls

CSharpGameApi.Info
  -> CSharpScriptGlobals
  -> InjectionScript.Runtime.InjectionApiUO.Info
ClassicUOInjectionApiBridge -> YokoInfoReport -> YokoInfoGump


UO.InfoColor

C# signatures

string UO.InfoColor();
string UO.InfoColor(object? serial);

Behavior and result

Invocation origin controls presentation: graphical chat commands and bound console commands open a table with fields, values, Ctrl+C and scrolling. Ordinary C# scripts receive report strings without windows or target cursors, even with an open game window. Only client-known data is available.

Parameterless Info and InfoTile arm a target in graphical chat. In a script, Info() reads the last object target or the player; InfoTile() reads the land under the player. Explicit serial, type and coordinates query the chosen object or tile. The third argument of InfoTile(x,y,map) is a map number.

Parameters

  • serial — Object serial number or a saved alias.

Configure the prefix in C# Scripts IDE; # below is an example. Separate parameters with spaces; quotes keep text in one argument. id means serial and type means graphic. xy x y [z] selects the first loaded object at the point; type alone resolves the first matching loaded object. The third argument of InfoTile(x,y,map) is a map number, not Z.

Chat commands

#infocolor 0x40001234

Complete C# examples

Each block is a complete standalone .csx. Replace demonstration serials, types and coordinates. Arguments follow the signature order; named C# arguments make their roles explicit.

1

UO.Print(UO.InfoColor(0x40001234));

2

string report = UO.InfoColor();
UO.Print(report);

3

foreach (int serial in new[] { 0x40001234, 0x40005678 })
    UO.Print(UO.InfoColor(serial));

4

new CommandSample().Execute(UO);

sealed class CommandSample
{
    public void Execute(global::ClassicUO.CSharp.CSharpGameApi api)
    {
        api.Print(api.InfoColor(0x40001234));
    }
}

Internal calls

CSharpGameApi.InfoColor
  -> CSharpScriptGlobals
  -> InjectionScript.Runtime.InjectionApiUO.InfoColor
ClassicUOInjectionApiBridge -> YokoInfoReport -> YokoInfoGump


UO.InfoGump

C# signatures

string UO.InfoGump();
string UO.InfoGump(object? gump);

Behavior and result

Invocation origin controls presentation: graphical chat commands and bound console commands open a table with fields, values, Ctrl+C and scrolling. Ordinary C# scripts receive report strings without windows or target cursors, even with an open game window. Only client-known data is available.

InfoGump() reads the latest active server dialog or local client window. Supply an ID or index to choose one; last, LastGump and Last Gump mean the latest window. InfoGumps returns the list. Inspector windows are excluded. Only graphical commands open an inspector table.

Parameters

  • gump — Server gump ID or index; -1 selects the last active one.

Configure the prefix in C# Scripts IDE; # below is an example. Separate parameters with spaces; quotes keep text in one argument. id means serial and type means graphic. xy x y [z] selects the first loaded object at the point; type alone resolves the first matching loaded object. The third argument of InfoTile(x,y,map) is a map number, not Z.

Chat commands

#infogump
#infogump last
#info gump last gump
#infogump 0x12345678

Complete C# examples

Each block is a complete standalone .csx. Replace demonstration serials, types and coordinates. Arguments follow the signature order; named C# arguments make their roles explicit.

1

string report = UO.InfoGump();
UO.Print(report);

2

UO.Print(UO.InfoGump(0x12345678));

3

string ReadLatestWindow() => UO.InfoGump();
UO.Print(ReadLatestWindow());

4

new CommandSample().Execute(UO);

sealed class CommandSample
{
    public void Execute(global::ClassicUO.CSharp.CSharpGameApi api)
    {
        string report = api.InfoGump();
        api.Print(report);
    }
}

Internal calls

CSharpGameApi.InfoGump
  -> CSharpScriptGlobals
  -> InjectionScript.Runtime.InjectionApiUO.InfoGump
ClassicUOInjectionApiBridge -> YokoInfoReport -> YokoInfoGump


UO.InfoGumps

C# signatures

string UO.InfoGumps();
string UO.InfoGumps(object? gump);

Behavior and result

Invocation origin controls presentation: graphical chat commands and bound console commands open a table with fields, values, Ctrl+C and scrolling. Ordinary C# scripts receive report strings without windows or target cursors, even with an open game window. Only client-known data is available.

InfoGump() reads the latest active server dialog or local client window. Supply an ID or index to choose one; last, LastGump and Last Gump mean the latest window. InfoGumps returns the list. Inspector windows are excluded. Only graphical commands open an inspector table.

Parameters

  • gump — Server gump ID or index; -1 selects the last active one.

Configure the prefix in C# Scripts IDE; # below is an example. Separate parameters with spaces; quotes keep text in one argument. id means serial and type means graphic. xy x y [z] selects the first loaded object at the point; type alone resolves the first matching loaded object. The third argument of InfoTile(x,y,map) is a map number, not Z.

Chat commands

#infogumps

Complete C# examples

Each block is a complete standalone .csx. Replace demonstration serials, types and coordinates. Arguments follow the signature order; named C# arguments make their roles explicit.

1

UO.Print(UO.InfoGumps());

2

string report = UO.InfoGumps(0x12345678);
UO.Print(report);

3

string ReadAllWindows() => UO.InfoGumps();
UO.Print(ReadAllWindows());

4

new CommandSample().Execute(UO);

sealed class CommandSample
{
    public void Execute(global::ClassicUO.CSharp.CSharpGameApi api)
    {
        api.Print(api.InfoGumps());
    }
}

Internal calls

CSharpGameApi.InfoGumps
  -> CSharpScriptGlobals
  -> InjectionScript.Runtime.InjectionApiUO.InfoGumps
ClassicUOInjectionApiBridge -> YokoInfoReport -> YokoInfoGump


UO.InfoTile

C# signatures

string UO.InfoTile();
string UO.InfoTile(object? x);
string UO.InfoTile(object? x, object? y);
string UO.InfoTile(object? x, object? y, object? map);
string UO.InfoTile(object? type, object? x, object? y, object? z);
string UO.InfoTile(object? type, object? x, object? y, object? z, object? map);

Behavior and result

Invocation origin controls presentation: graphical chat commands and bound console commands open a table with fields, values, Ctrl+C and scrolling. Ordinary C# scripts receive report strings without windows or target cursors, even with an open game window. Only client-known data is available.

Parameterless Info and InfoTile arm a target in graphical chat. In a script, Info() reads the last object target or the player; InfoTile() reads the land under the player. Explicit serial, type and coordinates query the chosen object or tile. The third argument of InfoTile(x,y,map) is a map number.

Parameters

  • map — Map number; omitted means the current map.
  • type — Item graphic ID; -1 matches any type at the specified position.
  • x — World X coordinate.
  • y — World Y coordinate.
  • z — Z elevation; the shorter overload uses 0.

Configure the prefix in C# Scripts IDE; # below is an example. Separate parameters with spaces; quotes keep text in one argument. id means serial and type means graphic. xy x y [z] selects the first loaded object at the point; type alone resolves the first matching loaded object. The third argument of InfoTile(x,y,map) is a map number, not Z.

Chat commands

#infotile
#info tile xy 1450 1690
#infotile 1450 1690 0
#infotile type 0x0EED 1450 1690 0 0

Complete C# examples

Each block is a complete standalone .csx. Replace demonstration serials, types and coordinates. Arguments follow the signature order; named C# arguments make their roles explicit.

1

UO.Print(UO.InfoTile(1450, 1690));

2

string report = UO.InfoTile(1450, 1690, 0);
UO.Print(report);

3

UO.Print(UO.InfoTile(0x0EED, 1450, 1690, 0, 0));

4

new CommandSample().Execute(UO);

sealed class CommandSample
{
    public void Execute(global::ClassicUO.CSharp.CSharpGameApi api)
    {
        api.Print(api.InfoTile(1450, 1690));
    }
}

Internal calls

CSharpGameApi.InfoTile
  -> CSharpScriptGlobals
  -> InjectionScript.Runtime.InjectionApiUO.InfoTile
ClassicUOInjectionApiBridge -> YokoInfoReport -> YokoInfoGump


UO.Version

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

C# signatures

void UO.Version();

Prints the name and runtime version of the product.

Parameters

There are no parameters.

Return value

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

Behavior

  • ExecuteLegacyManualAlias outputs bridge.RuntimeProductName and bridge.RuntimeProductVersion via SystemMessage. This is a log string, not the version number returned.
  • 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.Version");
UO.Version();

1. Direct call - direct script

Parameters and execution flow:

  • Prints the name and runtime version of the product.
UO.Version();

2. Explicit option - script function

Parameters and execution flow:

  • ExecuteLegacyManualAlias outputs bridge.RuntimeProductName and bridge.RuntimeProductVersion via SystemMessage. This is a log string, not the version number returned.
return  RunScenario();
 object? RunScenario()
{
    UO.Version();
    UO.Help();
    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.Version();
        UO.Print(UO.GetUserCodepage());
        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.Version() — UO.Version()

Parameters: No parameters.

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "version": SystemMessage($"{bridge.RuntimeProductName} v{bridge.RuntimeProductVersion}"); break;
⚠️ **GitHub.com Fallback** ⚠️