Skip to content

EN UO Topic localization

Codex edited this page Oct 12, 2026 · 4 revisions

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

Localization

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

Retrieving localized cliloc text and encoding information. The command names API are not translated when changing the language.

Sections

Topic Commands and explanations
Cliloc UO.GetCliloc
Cliloc by ID UO.GetClilocByID
Codepage UO.GetUserCodepage

All theme commands

Localization

UO.GetCliloc · UO.GetClilocByID · UO.GetUserCodepage

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

Parameters, result and all scenarios

var item = UO.FindType(0x0EED, -1, "backpack");
if (Truth(item != ""))
{
    UO.Print(UO.GetCliloc(item));
}

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

UO.GetClilocByID

Parameters, result and all scenarios

var text = UO.GetClilocByID(1042971, "");
UO.Print(text);

Complete command reference


UO.GetCliloc

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

C# signatures

dynamic UO.GetCliloc(object? objID);

Reads the finished object properties text from OPL. GetTooltip and GetCliloc are synonyms.

Parameters

  • objID — Required serial/ID object, not type and not cliloc. Allows int, decimal/hex string, self, backpack, lasttarget, finditem or name AddObject. 0 means no object.

Return value

string — name and text of properties, separated by line feed, or only the non-empty part. Empty string if ObjID=0 or if properties are not received. This is a ready-made text; numeric ID cliloc and parameters are returned by GetTooltipRec.

Behavior

  • If the entry already exists in OPL, its text is returned immediately. If there is no entry, a property request is sent and a response is expected up to 200 ms with a check every 10 ms. A pause does not guarantee a response.
  • We need an accessible object and support for properties by the server. An empty result is not proof that the object does not exist: use Exists separately.
  • The text may contain server markup. Don't parse numeric properties by line position; use GetTooltipRec for this.

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

1. Properties of an item in a backpack - direct script

Parameters and execution flow:

  • FindType: gold 0x0EED, any hue=-1, direct contents of the backpack. ObjID=item — found serial.
  • The getter result is text, not the amount of gold. For quantity use FindCount(item).
var item = UO.FindType(0x0EED, -1, "backpack");
if (Truth(item != ""))
{
    UO.Print(UO.GetCliloc(item));
}

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

2. Handle No Response - Script Function

Parameters and execution flow:

  • ObjID=lasttarget must point to the desired object.
  • An empty string is processed separately; There is no need to automatically repeat the request in an endless loop.
return  RunScenario();
 object? RunScenario()
{
    var text = UO.GetCliloc("lasttarget");
    if (Truth(text == ""))
    {
        UO.Print("No properties received");
    }
    else
    {
        UO.Print(text);
    }

    return null;
}

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

3. Save text until next action - script class

Parameters and execution flow:

  • id and saved are separate variables: the unique ID of the object and a snapshot of its text.
  • saved will not change automatically if the properties on the server later change.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        var id = UO.GetSerial("lasttarget");
        var saved = UO.GetCliloc(id);
        UO.Print("Object: 0x" + Hex(id));
        UO.Print(saved);
        return null;
    }

    string Hex(object? value) => Convert.ToInt64(value).ToString("X");
}

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.GetCliloc(objID) — UO.GetCliloc(Any)

Parameters: objID (Any)

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "getcliloc":

                case "gettooltip":

                    return new InjectionValue(bridge.GetTooltip(Arg(0)));

UO.GetClilocByID

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

C# signatures

dynamic UO.GetClilocByID(object? clilocID, object? @params);

Translates the cliloc template from game files and substitutes the passed parameters.

Parameters

  • clilocID - Required int - ID localized message, not a serial object and not a graphic. For example, the number from row[0] of the result GetTooltipRec.
  • params — Mandatory Array of substitutions in order 1_..., 2_.... One scalar value is allowed: it becomes an array of one string. For a template without parameters, you can pass an empty string. The #number element refers to another cliloc. Elements are converted to strings; It's preferable to pass strings explicitly.

Return value

string - translated template with substitutions from Params. If there is no cliloc loader, an empty string is returned. If ID is unknown, loaded ClilocLoader returns the diagnostic text MegaCliloc: missing with this number and substituted parameters. Does not return cliloc ID or a success sign.

Behavior

  • For object properties, first GetTooltipRec(ObjID): message number and object are different ID. For ready-made text of all properties, use GetTooltip(ObjID).

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

1. Template without wildcards - direct script

Parameters and execution flow:

  • ClilocID=1042971 — example number; replace with what you need. Params is an empty string passed as a single empty value.
  • For a pattern without wildcard markers, an empty parameter does not change the text. If the template expects data, pass an array as in the following example.
var text = UO.GetClilocByID(1042971, "");
UO.Print(text);

2. Pass two values ​​- script function

Parameters and execution flow:

  • ClilocID=1042971 is an example of a template. args[0] and args[1] occupy the positions of the first and second parameters.
  • The index variable declaration[1] creates two elements: 0 through 1. Use the ID template, which expects appropriate parameters.
return  RunScenario();
 object? RunScenario()
{
    dynamic[] args = new dynamic[checked((int)(1) + 1)];
    args[0] = "iron";
    args[1] = "ingot";
    UO.Print(UO.GetClilocByID(1042971, args));
    return null;
}

3. Translate first real property - script class

Parameters and execution flow:

  • The first argument is clilocID properties; the second is its ready-made array of Params.
  • The presence of at least one record is checked. All parameters are received from the server and transmitted along with their ID.
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 rows = UO.GetTooltipRec("lasttarget");
        if (Truth(ArrayLength(rows) > 0))
        {
            var row = rows[0];
            UO.Print(UO.GetClilocByID(row[0], row[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;
}

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.GetClilocByID(clilocID, params) — UO.GetClilocByID(Any,Any)

Parameters: clilocID (Any), params (Any)

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "getclilocbyid":

                    return new InjectionValue(bridge.GetClilocById(Arg(0), StringArrayArg(1)));

UO.GetUserCodepage

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

C# signatures

int UO.GetUserCodepage();

Returns Encoding.Default.CodePage without reading profile settings.

Parameters

There are no parameters.

Return value

int — Encoding.Default.CodePage of the current process. This is the .NET encoding, not the selected speech encoding UO.

Behavior

  • Returns Encoding.Default.CodePage without reading profile settings. Value depends on environment .NET; it cannot be considered guaranteed Windows ANSI.
  • 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.

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

1. Direct call - direct script

Parameters and execution flow:

  • Returns Encoding.Default.CodePage without reading profile settings.
UO.Print(UO.GetUserCodepage());

2. Explicit option - script function

Parameters and execution flow:

  • Returns Encoding.Default.CodePage without reading profile settings. Value depends on environment .NET; it cannot be considered guaranteed Windows ANSI.
return  RunScenario();
 object? RunScenario()
{
    var codepage = UO.GetUserCodepage();
    if (Truth(codepage == 65001))
    {
        UO.Print("UTF-8");
    }

    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. 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.GetUserCodepage();
        UO.Wait(500);
        var after = UO.GetUserCodepage();
        UO.Print(before);
        UO.Print(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.GetUserCodepage() — UO.GetUserCodepage()

Parameters: No parameters.

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int GetUserCodepage() => Encoding.Default.CodePage;

Clone this wiki locally