Skip to content

EN UO Topic search Part 2

Codex edited this page Oct 12, 2026 · 3 revisions

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

Search — 2

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

Reference parts

1 · 2

Complete command reference


UO.FindMan

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

C# signatures

void UO.FindMan();
dynamic UO.FindMan(object? notoriety);
dynamic UO.FindMan(object? notoriety, object? distance);
dynamic UO.FindMan(object? notoriety, object? distance, object? nearest);
dynamic UO.FindMan(object? notoriety, object? distance, object? nearest, object? maxZ);
dynamic UO.FindMan(object? notoriety, object? distance, object? nearest, object? maxZ, object? body);
dynamic UO.FindMan(object? notoriety, object? distance, object? nearest, object? maxZ, object? body, object? color);
dynamic UO.FindMan(object? notoriety, object? distance, object? nearest, object? maxZ, object? body, object? color, object? includeSelf);

Finds one serial by notoriety, distance, height, body and hue. Used to pre-select a target without automatic attack.

Parameters

  • notoriety — Relationship status to the character received from the server: 0 — unknown, 1 — Innocent, 2 — Ally, 3 — Gray, 4 — Criminal, 5 — Enemy, 6 — Murderer, 7 - Invulnerable. The number means one status; "5|6" or an array of numbers - any of the above. It's not the color of the clothes or the class. A negative number (usually -1), 0xFFFF, "any", an empty string or an empty array separately disables this filter. An invalid string without valid numbers does not find anyone. The order of statuses does not set priority. The 5 filter selects Enemy rather than automatically selecting any NPC/monster; actual values ​​depend on the server.
  • distance — Horizontal radius in cells inclusive: 5 allows distance 0..5. The distance is max(abs(dx),abs(dy)), so the adjacent diagonal is also 1. By default or if the number is negative, UO.FindDistance() is taken rather than unlimited search. 0 leaves the same X/Y cell. Not the length of the route; obstacles and floors are not checked by this parameter.
  • nearest - true/1 by default - the closest, if the distance is equal, the smaller serial; false/0 - first in the client’s list, not the furthest.
  • maxZ — Maximum abs(target's Z - own character's Z), inclusive, in world Z units. This is not the number of floors or X/Y cells. maxZ=4 with Z player 10 allows Z target 6..14; 0 requires exactly the same height. By default/for a negative number, UO.FindVertical() is taken. On the stairs, an equal Z can eliminate the desired target. Even a small difference in Z does not prove the accessibility of the floor.
  • body - Graphic of the character's body/NPC, not ID of a specific character and not type of the armor worn. A number, a hex string, the string "0x0190|0x0191" or an array of numbers. 0x0190 (400) - human male; 0x0191 (401) - female human. The mask unites both bodies. The list does not automatically include other races, ghosts, or transformations; table of standard graphic body types. A negative number (-1 by default), 0xFFFF, "any", an empty string or an empty array alone - any body. Unknown text without a valid number produces an empty result.
  • color — Hue of the mobile itself: int or numeric/hex string. Negative number (-1 by default) and 0xFFFF - any hue; 0 is precisely the hue of 0, and not any meaning. Not the color of the notoriety strip or the shade of the clothing. This parameter does not check the color of the item being worn.
  • includeSelf — true/1 allows self subject to other filters; false/0 excludes by default. Ignore also works for self.

Return value

int serial, or 0 without result. Check id != 0; it is not bool and not a quantity. Does not change FindItem/FindCount/GetFoundItems and does not initiate an attack.

Behavior

  • Local search: only already downloaded mobiles. Ignore is taken into account; self is excluded, except for the explicit includeSelf=true in commands that support it. Containers and items are not mobiles.
  • The conditions apply together (AND). Valid alternatives within body/notoriety are combined via OR. The search does not change FindItem, FindCount and GetFoundItems.
  • In body/notoriety, a mask with valid numbers uses exactly these: "any|5" still limits it to the value 5. Blank/invalid elements next to valid numbers are ignored. For no restriction, pass -1 separately. Do not carry this rule to classMask: unknown class name rejects the entire list.
  • Teams do not open an area of ​​the world, do not run to the goal, and do not check the passability of the route. Between the selection and the server's processing, the state of the world may change.
  • Passing true and 1 is equivalent for flags, false and 0 as well. Other non-zero numbers also convert to true, but 8/9 are not separate modes; use clear true/false.
  • Exact order: notoriety, distance, nearest, maxZ, body, color, includeSelf. Different from AttackNearest and GetMobiles.
  • There are no parameters classMask, aliveOnly or visibleOnly. If necessary, check the found ID separately; to select among all living/visible ones, use GetMobiles so that the closest dead one does not obscure the others.

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

1. Find and save closest ally - direct script

Parameters and execution flow:

  • 2 - Ally, 12 - radius. The rest: nearest=true, maxZ=FindVertical(), any body/hue, self excluded. The team only saves the target, does not attack.
var ally = UO.FindMan(2, 12);
if (Truth(ally == 0))
{
    return null;
}
UO.AddObject("ally_nearby", ally);

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

2. Specify each condition before further action - script function

Parameters and execution flow:

  • The IsDead check was performed separately. body specifies bodies; bodyHue=-1 does not limit their hue. This team does not classify by clothing.
return  RunScenario();
 object? RunScenario()
{
    var status = 5;
    var radius = 8;
    dynamic nearest = true;
    var height = 4;
    var bodies = "0x0190|0x0191";
    var bodyHue = -1;
    dynamic includeMe = false;
    var enemy = UO.FindMan(status, radius, nearest, height, bodies, bodyHue, includeMe);
    if (Truth(enemy != 0))
    {
        if (Truth(UO.IsDead(enemy) == 0))
        {
            UO.Attack(enemy);
        }
    }

    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. Find the first mobile with a specific hue - script class

Parameters and execution flow:

  • The first -1 disables notoriety, the second -1 disables body. false in the third position disables sorting; the last false excludes self. Hue of clothing is not checked.
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 chosenHue = 0x0455;
        var mobile = UO.FindMan(-1, 10, false, 8, -1, chosenHue, false);
        if (Truth(mobile == 0))
        {
            return null;
        }

        UO.AddObject("body_hue_match", mobile);
        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.FindMan() — UO.FindMan()

Parameters: No parameters.

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "findman":

                {

                    int mobile = bridge.GetMobiles().FirstOrDefault();

                    if (mobile != 0) state.Objects.Set(arguments.Length > 0 ? Text(0) : "findman", mobile);

                    break;

                }

UO.FindMan(notoriety) — UO.FindMan(Any)

Parameters: notoriety (Any)

Result: dynamic / Any.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => new InjectionValue(CompactFindMan(values))

UO.FindMan(notoriety, distance) — UO.FindMan(Any,Any)

Parameters: notoriety (Any), distance (Any)

Result: dynamic / Any.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => new InjectionValue(CompactFindMan(values))

UO.FindMan(notoriety, distance, nearest) — UO.FindMan(Any,Any,Any)

Parameters: notoriety (Any), distance (Any), nearest (Any)

Result: dynamic / Any.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => new InjectionValue(CompactFindMan(values))

UO.FindMan(notoriety, distance, nearest, maxZ) — UO.FindMan(Any,Any,Any,Any)

Parameters: notoriety (Any), distance (Any), nearest (Any), maxZ (Any)

Result: dynamic / Any.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => new InjectionValue(CompactFindMan(values))

UO.FindMan(notoriety, distance, nearest, maxZ, body) — UO.FindMan(Any,Any,Any,Any,Any)

Parameters: notoriety (Any), distance (Any), nearest (Any), maxZ (Any), body (Any)

Result: dynamic / Any.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => new InjectionValue(CompactFindMan(values))

UO.FindMan(notoriety, distance, nearest, maxZ, body, color) — UO.FindMan(Any,Any,Any,Any,Any,Any)

Parameters: notoriety (Any), distance (Any), nearest (Any), maxZ (Any), body (Any), color (Any)

Result: dynamic / Any.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => new InjectionValue(CompactFindMan(values))

UO.FindMan(notoriety, distance, nearest, maxZ, body, color, includeSelf) — UO.FindMan(Any,Any,Any,Any,Any,Any,Any)

Parameters: notoriety (Any), distance (Any), nearest (Any), maxZ (Any), body (Any), color (Any), includeSelf (Any)

Result: dynamic / Any.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => new InjectionValue(CompactFindMan(values))

UO.FindMobile

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

C# signatures

int UO.FindMobile();
int UO.FindMobile(object? stateFilter);
int UO.FindMobile(object? stateFilter, object? rangeFilter);
int UO.FindMobile(object? stateFilter, object? rangeFilter, object? verticalFilter);
int UO.FindMobile(object? stateFilter, object? rangeFilter, object? verticalFilter, object? directionOrKind);
int UO.FindMobile(object? stateFilter, object? rangeFilter, object? verticalFilter, object? directionFilter, object? kindFilter);

Finds one closest loaded character/creature using joint string filters. The player himself is excluded.

Parameters

  • stateFilter - Usually all / alive / dead; optional. All arguments in the implementation are filter strings, so it is acceptable to combine multiple words in one argument.
  • rangeFilter - Typically all / near (0..4) / medium (5..9) / far (from 10 to total radius). Numerical radius is not accepted at this position; the overall limit changes through UO.FindDistance(value).
  • verticalFilter - all / above / below. above: candidate.Z > self.Z, below: candidate.Z < self.Z. This is not a floor or a Z numerical tolerance.
  • directionOrKind — The fourth position of the form with four arguments: all, north/south/east/west or human/npc/mob. Can be a compound string.
  • directionFilter — The fourth position of the form with five arguments: all or comparison X/Y north/south/east/west. This is the location relative to the self, not the direction of gaze.
  • kindFilter - Fifth position: all / human / npc / mob. human includes male and female bodies: 0x0190 - male human, 0x0191 - female human, as well as the standard elf/gargoyle and ghost bodies. Full list: human. npc - IsNpc and human; mob - IsNpc and NOT human. The words monster and female are not accepted.

Return value

int: serial of one mobile, or 0 if there are no matches. It is not a quantity, not an array, not type and not bool. Check found != 0 means the presence of the result; comparison found == true is not valid in C#: int is not comparable to bool.

Behavior

  • Applies to UO.FindMobile: 0 to 5 arguments. The missing tail arguments are all. Each argument can contain one word or several words separated by space, tab, comma, semicolon, | or +. All conditions are combined through AND; symbol | does not mean OR here.
  • The search looks only at downloaded mobiles, excludes self and limits the distance to max(1, UO.FindDistance()). The distance is measured according to the rule max(abs(dx), abs(dy)); a diagonal square counts as one. For moving objects, the distance can take into account the queue of steps, and the X/Y/Z comparisons read the current coordinates.
  • The closest one is selected from those that are suitable; with equal distance - smaller serial. Returns int serial or 0, not true/false, count or array.
  • UO.FindMobile does not change FindItem/FindCount/GetFoundItems, does not apply Ignore and UO.FindVertical, and does not check visibility, passability or line of sight. It does not move, target, or load remote objects.
  • Numeric radii/Z/directions, words monster, northeast, northwest, southeast, southwest are not filters. An unknown word causes an error when checking a candidate; if there are no candidates, this section may not be executed. For a diagonal area, combine north east, etc.; for numerical verification, use properties of found objects or UO.GetMobiles().

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.FindMobile("all", "all", "above");
UO.Print("FindMobile: " + Convert.ToString(result));

1. Search and check the result - direct script

Parameters and execution flow:

  • Passed all, all, above: The object's height is strictly greater than the character's Z. Equal Z is not suitable.
  • 0 is processed before properties are read. Print shows ID, name and altitude; no game action is triggered.
var found = UO.FindMobile("all", "all", "above");
if (Truth(found == 0))
{
    UO.Print("No matching mobile");
    return null;
}
UO.Print("ID: " + Convert.ToString(found) + " | Name: " + UO.GetName(found));
UO.Print("Z: " + Convert.ToString(UO.GetZ(found)) + " | Self Z: " + Convert.ToString(UO.GetZ("self")));

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

2. Combination of conditions with time radius - script function

Parameters and execution flow:

  • 18—external limit; alive, near, all, all, mob sets cooperative conditions. near remains the range up to 4, medium - 5..9, far - from 10.
  • Finally returns the previous radius on normal completion or a handled error. The script does not expand world loading.
return  RunScenario();
 object? RunScenario()
{
    var previous = UO.FindDistance();
    try
    {
        UO.FindDistance(18);
        var found = UO.FindMobile("alive", "near", "all", "all", "mob");
        if (Truth(found != 0))
        {
            UO.Print("Match: " + Convert.ToString(found));
            UO.Print("Distance: " + Convert.ToString(UO.GetDistance(found)));
        }
        else
        {
            UO.Print("No match in the loaded area");
        }
    }
    finally
    {
        UO.FindDistance(previous);
    }

    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 Composite Filter - Script Class

Parameters and execution flow:

  • The string "north east" is passed to helper. These are several conditions of one request, and not a sequential search for different goals.
  • FindAndDescribe is declared in its entirety. It returns ID/0 without changing the target or character.
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 = FindAndDescribe("north east");
        UO.Print("Returned ID: " + Convert.ToString(id));
        return null;
    }

    dynamic FindAndDescribe(dynamic filters)
    {
        var id = UO.FindMobile(filters);
        if (Truth(id == 0))
        {
            UO.Print("Nothing matched: " + filters);
            return 0;
        }

        UO.Print(UO.GetName(id) + " | " + Convert.ToString(id));
        return id;
    }

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

4. Find the creature and separately check the exact distance - direct script

Parameters and execution flow:

  • alive/all/all/all/mob - five supported positions. The distance 2 is checked after the closest result is obtained.
  • Such a script does not check the path to the creature and does not start moving.
var found = UO.FindMobile("alive", "all", "all", "all", "mob");
if (Truth(found == 0))
{
    UO.Print("No loaded creature");
    return null;
}
if (Truth(UO.GetDistance(found) <= 2))
{
    UO.Print("Creature within two tiles: " + Convert.ToString(found));
}
else
{
    UO.Print("Nearest creature is farther away");
}

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.FindMobile() — UO.FindMobile()

Parameters: No parameters.

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int FindMobile() => FindMobile(new InjectionValue("all"), new InjectionValue("all"),

            new InjectionValue("all"), new InjectionValue("all"));

UO.FindMobile(stateFilter) — UO.FindMobile(Any)

Parameters: stateFilter (Any)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int FindMobile(InjectionValue stateFilter) => FindMobile(stateFilter, new InjectionValue("all"),

            new InjectionValue("all"), new InjectionValue("all"));

UO.FindMobile(stateFilter, rangeFilter) — UO.FindMobile(Any,Any)

Parameters: stateFilter (Any), rangeFilter (Any)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int FindMobile(InjectionValue stateFilter, InjectionValue rangeFilter) => FindMobile(stateFilter,

            rangeFilter, new InjectionValue("all"), new InjectionValue("all"));

UO.FindMobile(stateFilter, rangeFilter, verticalFilter) — UO.FindMobile(Any,Any,Any)

Parameters: stateFilter (Any), rangeFilter (Any), verticalFilter (Any)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int FindMobile(InjectionValue stateFilter, InjectionValue rangeFilter, InjectionValue verticalFilter) =>

            FindMobile(stateFilter, rangeFilter, verticalFilter, new InjectionValue("all"));

UO.FindMobile(stateFilter, rangeFilter, verticalFilter, directionOrKind) — UO.FindMobile(Any,Any,Any,Any)

Parameters: stateFilter (Any), rangeFilter (Any), verticalFilter (Any), directionOrKind (Any)

Result: int / Integer.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => new InjectionValue(

                    FindMobile(values[0], values[1], values[2], values[3]))

UO.FindMobile(stateFilter, rangeFilter, verticalFilter, directionFilter, kindFilter) — UO.FindMobile(Any,Any,Any,Any,Any)

Parameters: stateFilter (Any), rangeFilter (Any), verticalFilter (Any), directionFilter (Any), kindFilter (Any)

Result: int / Integer.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => new InjectionValue(

                    FindMobile(values[0], values[1], values[2], values[3], values[4]))

UO.FindNotoriety

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

C# signatures

dynamic UO.FindNotoriety(object? @type, object? notoriety);
dynamic UO.FindNotoriety(object? @type, object? notoriety, object? distance);
dynamic UO.FindNotoriety(object? @type, object? notoriety, object? distance, object? nearest);
dynamic UO.FindNotoriety(object? @type, object? notoriety, object? distance, object? nearest, object? maxZ);
dynamic UO.FindNotoriety(object? @type, object? notoriety, object? distance, object? nearest, object? maxZ, object? color);
dynamic UO.FindNotoriety(object? @type, object? notoriety, object? distance, object? nearest, object? maxZ, object? color, object? container);

Searches for another mobile based on one body/type and allowed notoriety. Suitable when you need a certain kind of character with the right attitude; advanced shapes allow you to limit radius, height and hue. This is only an object selection, not an attack.

Parameters

  • type — One body numeric graphic or hex string; not serial, not type of the worn item and not the array. 0x0190 (400) - male human, 0x0191 (401) - female human; These are different precision filters. The two body require separate calls or GetMobiles with a mask. -1 or 0xFFFF - any body.
  • notoriety — Relationship status to the character received from the server: 0 — unknown, 1 — Innocent, 2 — Ally, 3 — Gray, 4 — Criminal, 5 — Enemy, 6 — Murderer, 7 - Invulnerable. The number means one status; "5|6" or an array of numbers - any of the above. It's not the color of the clothes or the class. A negative number (usually -1), 0xFFFF, "any", an empty string or an empty array separately disables this filter. An invalid string without valid numbers does not find anyone. The order of statuses does not set priority. The 5 filter selects Enemy rather than automatically selecting any NPC/monster; actual values ​​depend on the server. Multiple values ​​are combined as OR: the number 5, the string "5|6", or a flat array of numbers/numeric strings. You can mix flat array and individual arguments. The order of values ​​does not give priority. Non-numeric tokens are excluded; a completely erroneous mask finds nothing. Nested arrays are not numbers and are ignored as invalid elements; multidimensional masks are not supported. Feature of the two-argument numeric form: only a negative code disables the filter, the numeric 0xFFFF is considered a literal code and usually does not find anyone.
  • distance — Horizontal radius in cells inclusive: 5 allows distance 0..5. The distance is max(abs(dx),abs(dy)), so the adjacent diagonal is also 1. By default or if the number is negative, UO.FindDistance() is taken rather than unlimited search. 0 leaves the same X/Y cell. Not the length of the route; obstacles and floors are not checked by this parameter.
  • nearest - false/0 default: first matching in world enumeration order, no guarantee of closest or smaller ID. true/1: closest, if equal, smaller serial.
  • maxZ — Maximum abs(target's Z - own character's Z), inclusive, in world Z units. This is not the number of floors or X/Y cells. maxZ=4 with Z player 10 allows Z target 6..14; 0 requires exactly the same height. By default/for a negative number, UO.FindVertical() is taken. On the stairs, an equal Z can eliminate the desired target. Even a small difference in Z does not prove the accessibility of the floor.
  • color — Hue of the mobile itself: int or numeric/hex string. Negative number (-1 by default) and 0xFFFF - any hue; 0 is precisely the hue of 0, and not any meaning. Not the color of the notoriety strip or the shade of the clothing. This parameter does not check the color of the item being worn.
  • container - Absent by default: world. When specified, ground/"ground"/UO.Ground(), numbers 0/1, and -1/"my" are acceptable as compatible world designations in this particular command. An explicit container serial or "backpack" returns 0: there are no mobiles inside the container. Does not add search for things.

Return value

int - serial of the selected mobile or 0 if there is no suitable one. This is ID, not graphic/type, the number of objects found or true/false: use if (found != 0) { ... }, not found == true. A found ID can be passed to UO.AddObject, UO.Attack or UO.Follow, but each game action is called separately.

Behavior

  • The search only reads mobiles already downloaded by the client; destroyed entries and Ignore are excluded. The call itself does not open target, does not attack, does not go to the target, and does not request remote objects from the server.
  • The distance is geometric max(abs(dx),abs(dy)), not the route length. Proximity does not guarantee the absence of a wall or the accessibility of another floor. Condition may change upon return.
  • Life, stealth and line of sight are not automatically checked. If they are important, use GetMobiles with aliveOnly/visibleOnly or your own checks. Having a server with Enemy status does not make any NPC eligible.
  • From 2 to 7 arguments. To transmit maxZ you need to specify the previous distance and nearest. For multiple notoriety in this command, use a single mask "5|6" or a flat array in the second argument; the third argument is distance, not the second status.
  • An important difference in form: two arguments with NUMERIC notoriety call bridge.FindNotoriety, discarding the old FindItem/FindCount/GetFoundItems and recording all matches. Two STRING/ARARY arguments, as well as any forms with 3..7 arguments, return only ID, retaining the same Find* fields. Do not read FindCount as the result of an extended query.
  • All forms exclude self and Ignore, use the Z limit; live/visible filters and no line of sight. No matches returns 0. Unreadable type/distance/maxZ/color causes a conversion error.

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

1. Count men and women with Enemy reputation - direct script

Parameters and execution flow:

  • 0x0190 (400) is a male human body, 0x0191 (401) is a female human body. 5 - Enemy. Each call receives ONE body; the string 0x0190|0x0191 is not supported at this position. The current FindDistance/FindVertical are used.
  • After the second call, FindItem/FindCount/GetFoundItems refer to female bodies only; the first quantity is stored in menCount. The returned man/woman is the first serial or 0, not the number. NPC with such bodies can also be included in the result; ghosts and other races are not included in these two body.
var man = UO.FindNotoriety(0x0190, 5);
var menCount = UO.FindCount();
var woman = UO.FindNotoriety(0x0191, 5);
var womenCount = UO.FindCount();
UO.Print("Male humans: " + Convert.ToString(menCount));
UO.Print("Female humans: " + Convert.ToString(womenCount));
UO.Print("Total humans: " + Convert.ToString(menCount + womenCount));

2. Closest of two height-limited statuses - script function

Parameters and execution flow:

  • -1 in the first parameter — any body; -1 in the sixth - any hue. ground - world. FindCount has not been updated since this form; use found.
return  RunScenario();
 object? RunScenario()
{
    var found = UO.FindNotoriety(-1, "5|6", 12, true, 4, -1, "ground");
    if (Truth(found != 0))
    {
        UO.AddObject("near_enemy", found);
    }

    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. Array of statuses in the second parameter - scenario class

Parameters and execution flow:

  • The array contains two codes. Missing tail arguments mean the current radius/Z, nearest=false and any hue. This is not the notation UO.FindNotoriety(type,5,6): there 6 would be the radius.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        dynamic[] allowed = new dynamic[checked((int)(1) + 1)];
        allowed[0] = 5;
        allowed[1] = 6;
        var found = UO.FindNotoriety(0x0191, allowed);
        if (Truth(found != 0))
        {
            UO.AddObject("allowed_mobile", found);
            UO.Print("Selected ID: " + Convert.ToString(found));
        }

        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.FindNotoriety(type, notoriety) — UO.FindNotoriety(Any,Any)

Parameters: type (Any), notoriety (Any)

Result: dynamic / Any.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => new InjectionValue(CompactFindNotoriety(values))

UO.FindNotoriety(type, notoriety, distance) — UO.FindNotoriety(Any,Any,Any)

Parameters: type (Any), notoriety (Any), distance (Any)

Result: dynamic / Any.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => new InjectionValue(CompactFindNotoriety(values))

UO.FindNotoriety(type, notoriety, distance, nearest) — UO.FindNotoriety(Any,Any,Any,Any)

Parameters: type (Any), notoriety (Any), distance (Any), nearest (Any)

Result: dynamic / Any.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => new InjectionValue(CompactFindNotoriety(values))

UO.FindNotoriety(type, notoriety, distance, nearest, maxZ) — UO.FindNotoriety(Any,Any,Any,Any,Any)

Parameters: type (Any), notoriety (Any), distance (Any), nearest (Any), maxZ (Any)

Result: dynamic / Any.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => new InjectionValue(CompactFindNotoriety(values))

UO.FindNotoriety(type, notoriety, distance, nearest, maxZ, color) — UO.FindNotoriety(Any,Any,Any,Any,Any,Any)

Parameters: type (Any), notoriety (Any), distance (Any), nearest (Any), maxZ (Any), color (Any)

Result: dynamic / Any.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => new InjectionValue(CompactFindNotoriety(values))

UO.FindNotoriety(type, notoriety, distance, nearest, maxZ, color, container) — UO.FindNotoriety(Any,Any,Any,Any,Any,Any,Any)

Parameters: type (Any), notoriety (Any), distance (Any), nearest (Any), maxZ (Any), color (Any), container (Any)

Result: dynamic / Any.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => new InjectionValue(CompactFindNotoriety(values))

UO.FindQuantity

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

C# signatures

dynamic UO.FindQuantity();

Reads the current quantity in the first search result.

Parameters

There are no parameters.

Return value

int — current Amount of an item with serial FindItem, 1 for an existing character, 0 for a missing/deleted object. Other found stacks are not cumulative. Unlike FindFullQuantity, the quantity is read from the current object when called.

Behavior

  • The data belongs to the last normal search of this script. FindType with 1–5 arguments, FindTypeEx, Count/CountEx/CountGround replace the results. Advanced filtered character commands are not required to change this snapshot.
  • A new search with no matches clears FindItem, FindCount and FindFullQuantity and clears GetFoundItems. Reading a result by itself does not trigger a new search.

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.FindType(0x0EED, -1, "backpack");
object? result = UO.FindQuantity();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));

1. Measure gold search results - direct script

Parameters and execution flow:

  • type=0x0EED – gold; color=-1 — any hue; backpack - only the direct contents of the backpack in this form FindType.
  • int — current Amount of an item with serial FindItem, 1 for an existing character, 0 for a missing/deleted object. Other found stacks are not cumulative. Unlike FindFullQuantity, the quantity is read from the current object when called.
var found = UO.FindType(0x0EED, -1, "backpack");
var value = UO.FindQuantity();
UO.Print(Convert.ToString(value));

2. Compare Items and Units - Script Function

Parameters and execution flow:

  • All four reads belong to one search until another search is called in between.
  • For example, two stacks of 50: Items=2, First stack=50, All units=100; First ID contains the unique ID of one stack.
return  RunScenario();
 object? RunScenario()
{
    var found = UO.FindType(0x0EED, -1, "backpack");
    UO.Print("Items: " + Convert.ToString(UO.FindCount()));
    UO.Print("First stack: " + Convert.ToString(UO.FindQuantity()));
    UO.Print("All units: " + Convert.ToString(UO.FindFullQuantity()));
    UO.Print("First ID: 0x" + Hex(UO.FindItem()));
    return null;
}

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

3. Save result until next search - script class

Parameters and execution flow:

  • The first type is gold, the second 0x0F7A is a separate type of reagent. The new team changes the overall shot.
  • saved remains the number from the first search. The second reading applies to the reagent even if there is no match.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        var found = UO.FindType(0x0EED, -1, "backpack");
        var saved = UO.FindQuantity();
        found = UO.FindType(0x0F7A, -1, "backpack");
        UO.Print("Saved: " + Convert.ToString(saved));
        UO.Print("Current: " + Convert.ToString(UO.FindQuantity()));
        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.FindQuantity() — UO.FindQuantity()

Parameters: No parameters.

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "findquantity": return new InjectionValue(bridge.FindQuantity());

UO.FindType

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

C# signatures

string UO.FindType(object? @type);
string UO.FindType(object? @type, object? color);
string UO.FindType(object? @type, object? color, object? container);
string UO.FindType(object? @type, object? color, object? container, object? range);
string UO.FindType(object? @type, object? color, object? container, object? distance, object? recursive);
string UO.FindType(object? @type, object? color, object? container, object? distance, object? notoriety, object? nearest);
string UO.FindType(object? @type, object? color, object? container, object? distance, object? notoriety, object? nearest, object? maxZ);
string UO.FindType(object? @type, object? color, object? container, object? distance, object? notoriety, object? nearest, object? maxZ, object? mobileOnly);
string UO.FindType(object? @type, object? color, object? container, object? distance, object? notoriety, object? nearest, object? maxZ, object? mobileOnly, object? itemOnly);
string UO.FindType(object? @type, object? color, object? container, object? distance, object? notoriety, object? nearest, object? maxZ, object? mobileOnly, object? itemOnly, object? includeIgnored);
string UO.FindType(object? @type, object? color, object? container, object? distance, object? notoriety, object? nearest, object? maxZ, object? mobileOnly, object? itemOnly, object? includeIgnored, object? includeSelf);
string UO.FindType(object? @type, object? color, object? container, object? distance, object? notoriety, object? nearest, object? maxZ, object? mobileOnly, object? itemOnly, object? includeIgnored, object? includeSelf, object? aliveOnly);
string UO.FindType(object? @type, object? color, object? container, object? distance, object? notoriety, object? nearest, object? maxZ, object? mobileOnly, object? itemOnly, object? includeIgnored, object? includeSelf, object? aliveOnly, object? visibleOnly);
string UO.FindType(object? @type, object? color, object? container, object? distance, object? notoriety, object? nearest, object? maxZ, object? mobileOnly, object? itemOnly, object? includeIgnored, object? includeSelf, object? aliveOnly, object? visibleOnly, object? nameMask);

Searches among items and characters already downloaded by the client. You can search by type, color, container, distance and additional filters. The result is a hex string serial of the selected object; an empty string means no match. The command itself does not open containers, does not pick up an item, and does not attack the found target.

Parameters

  • type - One graphic item or body character: integer or number string. 0x0EED - gold; 0x0190 (400) - human male; 0x0191 (401) - female human. One type 0x0190 does not include 0x0191. To list characters of both genders, use GetMobiles with body="0x0190|0x0191"; the mask is not passed to this single argument FindType. A negative value or 0xFFFF clears the type filter.
  • color - Hue/color: integer or number string. -1 or 0xFFFF means any color; 0 - specifically hue 0. Feature of the two-argument form: the lines "ground", "backpack", "my" in the second position select the search area instead of the color. "my" enables traversal of loaded subcontainers.
  • container - Search area: "ground" - the world, "backpack" - the top level of your backpack, "my" - a backpack with loaded subcontainers in a short form; You can also pass serial of the container or the saved name of the object. Containers do not open automatically. The extended forms 7–14 of the arguments iterate over the direct contents of the given container and do not have a recursive flag.
  • range — The fourth argument of the four-argument form: distance in cells. A negative value uses the general setting FindDistance; 0 leaves only matches on the same cell. For an item in a container, the position of the container in the world is taken into account.
  • distance — Distance in cells at position 4 in forms of five arguments. -1 uses FindDistance; the number 0 and higher sets an explicit limit. This is the search radius, not the length of the route.
  • recursive - ONLY the fifth argument of the form of five arguments: 1/true - also search in loaded subcontainers, 0/false - only the top level. This is not notoriety. Changing to the six-argument form changes the meaning of position 5.
  • notoriety — Position of 5 in argument forms 6–14. Character reputation: 0 unknown, 1 innocent, 2 ally, 3 attackable, 4 criminal, 5 enemy, 6 murderer, 7 invulnerable. You can pass a number, the string "3|6" or an array of values. -1, 0xFFFF or "any" disables the filter. When the filter is active, items are excluded: they do not have notoriety.
  • nearest - Position 6: 1/true - select the closest suitable character, and in the extended form 7–14 - the closest candidate of any allowed type; if the distance is equal, serial is used. 0/false preserves the search order. In the six-argument form, the normal item search order is used when proceeding to find items.
  • maxZ - Position 7: maximum absolute Z height difference with own character. 0 - same height; -1 takes FindVertical. For items inside a container, the height of the container is checked. This is not a floor number.
  • mobileOnly — Position 8: 1/true — leave only characters and mobs; 0/false - also allow items. If there is no argument, false.
  • itemOnly — Position 9: 1/true — leave only objects; 0/false - also allow characters. If missing, false. Simultaneous mobileOnly=true and itemOnly=true give an empty result.
  • includeIgnored — Position 10: 1/true — allow objects from IgnoreList; 0/false - exclude them. Default is false. The IgnoreList command itself does not change.
  • includeSelf — Position 11: 1/true — allow your own character among the candidates mobile; 0/false - exclude. Default is false. Does not affect items.
  • aliveOnly - Position 12: 1/true - exclude dead characters; 0/false - allow both states. Default is false. This filter does not check item health.
  • visibleOnly - Position 13: 1/true - require positive check IsVisible; 0/false - do not use it. Default is false. The command still only works with objects known to the client.
  • nameMask — Position 14: text part of the name, case insensitive. The string "orc|troll" allows either of the two matches; delimiters can also be commas and semicolons. An empty string, "any" or "-1" removes the filter. This is a substring search, not a regular expression or a mask with *. If the argument is missing, the filter is disabled.

Return value

string: For example, "0x40001234". If nothing is found - "". Check the result by comparing it with an empty string. Do not confuse it with the number of objects found or the number of steps to them.

Behavior

  • There are forms with 1–14 arguments, but this is not one long signature with arbitrarily omitted parameters. Select the exact syntax line; arguments are passed positionally.
  • Forms 1–5 use normal search and update FindItem/FindCount/ list of results. For forms 6–14, use the returned string directly: character filtering is done in a separate way and does not promise to update these shared values.
  • For short forms, by default the search is in the world, any color, distance FindDistance, without recursion. The string "my" is a special shorthand form for a backpack with subcontainers.
  • The six-argument form first looks for a matching character; In the absence of a notoriety filter and a suitable character, searching for objects is possible. The forms 7–14 combine resolved candidates and apply additional filters.
  • The change in the number of arguments from five to six is ​​especially important: recursive is replaced by notoriety, and nearest becomes the sixth argument. The value 1 at position 5 then means innocent, not recursive traversal.

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.FindType(0x0EED, -1, "backpack");
UO.Print("FindType: " + Convert.ToString(result));

1. Find gold in the top level of the backpack and process the lack of result - direct script

Parameters and execution flow:

  • 1: type=0x0EED - looking for gold.
  • 2: color=-1 — any hue.
  • 3: container="backpack" - only the direct contents of your backpack.
  • gold gets the string serial. The gold="" check separates the missing item from the found item. Info(gold) displays information; the gold doesn't move.
var gold = UO.FindType(0x0EED, -1, "backpack");
if (Truth(gold == ""))
{
    UO.Print("Gold was not found in the loaded backpack");
}
else
{
    UO.Print("Gold serial: " + gold);
    UO.Info(gold);
}

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

2. Recursively search for an item in loaded backpack bags - script function

Parameters and execution flow:

  • 1: wantedType contains the graphic 0x0EED.
  • 2: -1 removes the color filter.
  • 3: "backpack" selects the root container.
  • 4: -1 uses the current FindDistance.
  • 5: recursive=1 enables traversal of subcontainers; this is a five-argument form. The contents of a closed bag that the server has not yet sent are not loaded this way.
  • AddObject saves the found serial under the name found_gold only after checking the result.
return  RunScenario();
 object? RunScenario()
{
    var wantedType = 0x0EED;
    var recursive = 1;
    var found = UO.FindType(wantedType, -1, "backpack", -1, recursive);
    if (Truth(found != ""))
    {
        UO.AddObject("found_gold", found);
        UO.Print("Saved object: " + found);
    }
    else
    {
        UO.Print("No matching item in loaded containers");
    }

    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. Find the nearest character with one of two reputations - scenario class

Parameters and execution flow:

  • 1: body=-1 allows any body.
  • 2: color=-1 allows any color.
  • 3: "ground" means loaded world objects.
  • 4: radius=10 limits the distance to ten cells.
  • 5: reputation="3|6" - attackable or murderer. It is notoriety, not recursive.
  • 6: nearest=1 asks you to choose the nearest one. The reputation filter excludes items. The example only displays information and does not attack the target.
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 body = -1;
        var radius = 10;
        var reputation = "3|6";
        var nearest = 1;
        var found = UO.FindType(body, -1, "ground", radius, reputation, nearest);
        if (Truth(found != ""))
        {
            UO.Print("Matching mobile: " + found);
            UO.Info(found);
        }
        else
        {
            UO.Print("No matching mobile within the radius");
        }

        return null;
    }

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

4. All fourteen parameters: a live visible mob with a suitable name - direct script

Parameters and execution flow:

  • 1 body=-1 and 2 hue=-1 do not limit the type and color.
  • 3 scope="ground" - search in the world; 4 radius=5 - no further than five cells.
  • 5 reputation=-1 allows any notoriety; 6 nearest=1 selects the nearest one.
  • 7 maxZ=16 allows absolute height differences of up to 16 units.
  • 8 mobileOnly=1 excludes items; 9 itemOnly=0 does not prohibit mobs.
  • 10 includeIgnored=0 retains the effect of IgnoreList.
  • 11 includeSelf=0 excludes your character.
  • 12 aliveOnly=1 and 13 visibleOnly=1 leave visible candidates alive.
  • 14 names="orc|troll" requires the substring orc or troll in a name already known to the client. All filters must be executed simultaneously.
var body = -1;
var hue = -1;
var scope = "ground";
var radius = 5;
var reputation = -1;
var nearest = 1;
var maxZ = 16;
var mobileOnly = 1;
var itemOnly = 0;
var includeIgnored = 0;
var includeSelf = 0;
var aliveOnly = 1;
var visibleOnly = 1;
var names = "orc|troll";
var found = UO.FindType(body, hue, scope, radius, reputation, nearest, maxZ, mobileOnly, itemOnly, includeIgnored, includeSelf, aliveOnly, visibleOnly, names);
if (Truth(found == ""))
{
    UO.Print("No loaded mobile satisfies every filter");
}
else
{
    UO.Print("Selected serial: " + found);
}

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

5. Short form of backpack search - script function

Parameters and execution flow:

  • 1 wantedType=0x0EED is gold.
  • 2 "my" is a special string of two-argument form: selects a backpack, enables recursion and any color. Here the second argument is not hue.
  • For the top level, pass "backpack" instead of "my"; for the world - "ground". The number in the second position, on the contrary, will be a color filter.
return  RunScenario();
 object? RunScenario()
{
    var wantedType = 0x0EED;
    var found = UO.FindType(wantedType, "my");
    if (Truth(found != ""))
    {
        UO.Print("Found in backpack or a loaded subcontainer: " + found);
    }
    else
    {
        UO.Print("Nothing found");
    }

    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.FindType(type) — UO.FindType(Any)

Parameters: type (Any)

Result: string / String.

During a call:

Internal implementation code; this is not a standalone script.

public string FindType(InjectionValue type)

            => FindType(ResolveType(type));

UO.FindType(type, color) — UO.FindType(Any,Any)

Parameters: type (Any), color (Any)

Result: string / String.

During a call:

Internal implementation code; this is not a standalone script.

public string FindType(InjectionValue type, InjectionValue color)

        {

            if (color.Kind == InjectionValueKind.String

                && (color.String.Equals("ground", StringComparison.OrdinalIgnoreCase)

                    || color.String.Equals("backpack", StringComparison.OrdinalIgnoreCase)

                    || color.String.Equals("my", StringComparison.OrdinalIgnoreCase)))

            {

                return FindType(ResolveType(type), -1, ConvertContainer(color), -1, color.String.Equals("my", StringComparison.OrdinalIgnoreCase));

            }



            return FindType(ResolveType(type), NumberConversions.ToInt(color), -1, -1, false);

        }

UO.FindType(type, color, container) — UO.FindType(Any,Any,Any)

Parameters: type (Any), color (Any), container (Any)

Result: string / String.

During a call:

Internal implementation code; this is not a standalone script.

public string FindType(InjectionValue type, InjectionValue color, InjectionValue container)

            => FindType(type, color, container, new InjectionValue(-1));

UO.FindType(type, color, container, range) — UO.FindType(Any,Any,Any,Any)

Parameters: type (Any), color (Any), container (Any), range (Any)

Result: string / String.

During a call:

Internal implementation code; this is not a standalone script.

public string FindType(InjectionValue type, InjectionValue color, InjectionValue container, InjectionValue range)

        {

            if (container.Kind == InjectionValueKind.String && container.String.Equals("my", StringComparison.OrdinalIgnoreCase))

                return FindType(ResolveType(type), NumberConversions.ToInt(color), ConvertContainer(container), NumberConversions.ToInt(range), true);

            else

                return FindType(ResolveType(type), NumberConversions.ToInt(color), ConvertContainer(container), NumberConversions.ToInt(range), false);

        }

UO.FindType(type, color, container, distance, recursive) — UO.FindType(Any,Any,Any,Any,Any)

Parameters: type (Any), color (Any), container (Any), distance (Any), recursive (Any)

Result: string / String.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values =>

                new InjectionValue(FindType(values[0], values[1], values[2], values[3], values[4]))

UO.FindType(type, color, container, distance, notoriety, nearest) — UO.FindType(Any,Any,Any,Any,Any,Any)

Parameters: type (Any), color (Any), container (Any), distance (Any), notoriety (Any), nearest (Any)

Result: string / String.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values =>

                CompactFindType(values[0], values[1], values[2], values[3], values[4], values[5])

UO.FindType(type, color, container, distance, notoriety, nearest, maxZ) — UO.FindType(Any,Any,Any,Any,Any,Any,Any)

Parameters: type (Any), color (Any), container (Any), distance (Any), notoriety (Any), nearest (Any), maxZ (Any)

Result: string / String.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => CompactFindTypeExtended(values)

UO.FindType(type, color, container, distance, notoriety, nearest, maxZ, mobileOnly) — UO.FindType(Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: type (Any), color (Any), container (Any), distance (Any), notoriety (Any), nearest (Any), maxZ (Any), mobileOnly (Any)

Result: string / String.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => CompactFindTypeExtended(values)

UO.FindType(type, color, container, distance, notoriety, nearest, maxZ, mobileOnly, itemOnly) — UO.FindType(Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: type (Any), color (Any), container (Any), distance (Any), notoriety (Any), nearest (Any), maxZ (Any), mobileOnly (Any), itemOnly (Any)

Result: string / String.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => CompactFindTypeExtended(values)

UO.FindType(type, color, container, distance, notoriety, nearest, maxZ, mobileOnly, itemOnly, includeIgnored) — UO.FindType(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: type (Any), color (Any), container (Any), distance (Any), notoriety (Any), nearest (Any), maxZ (Any), mobileOnly (Any), itemOnly (Any), includeIgnored (Any)

Result: string / String.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => CompactFindTypeExtended(values)

UO.FindType(type, color, container, distance, notoriety, nearest, maxZ, mobileOnly, itemOnly, includeIgnored, includeSelf) — UO.FindType(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: type (Any), color (Any), container (Any), distance (Any), notoriety (Any), nearest (Any), maxZ (Any), mobileOnly (Any), itemOnly (Any), includeIgnored (Any), includeSelf (Any)

Result: string / String.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => CompactFindTypeExtended(values)

UO.FindType(type, color, container, distance, notoriety, nearest, maxZ, mobileOnly, itemOnly, includeIgnored, includeSelf, aliveOnly) — UO.FindType(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: type (Any), color (Any), container (Any), distance (Any), notoriety (Any), nearest (Any), maxZ (Any), mobileOnly (Any), itemOnly (Any), includeIgnored (Any), includeSelf (Any), aliveOnly (Any)

Result: string / String.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => CompactFindTypeExtended(values)

UO.FindType(type, color, container, distance, notoriety, nearest, maxZ, mobileOnly, itemOnly, includeIgnored, includeSelf, aliveOnly, visibleOnly) — UO.FindType(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: type (Any), color (Any), container (Any), distance (Any), notoriety (Any), nearest (Any), maxZ (Any), mobileOnly (Any), itemOnly (Any), includeIgnored (Any), includeSelf (Any), aliveOnly (Any), visibleOnly (Any)

Result: string / String.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => CompactFindTypeExtended(values)

UO.FindType(type, color, container, distance, notoriety, nearest, maxZ, mobileOnly, itemOnly, includeIgnored, includeSelf, aliveOnly, visibleOnly, nameMask) — UO.FindType(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: type (Any), color (Any), container (Any), distance (Any), notoriety (Any), nearest (Any), maxZ (Any), mobileOnly (Any), itemOnly (Any), includeIgnored (Any), includeSelf (Any), aliveOnly (Any), visibleOnly (Any), nameMask (Any)

Result: string / String.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => CompactFindTypeExtended(values)

UO.FindTypeEx

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

C# signatures

int UO.FindTypeEx(object? objType, object? color, object? container, object? inSub);

Searches for one graphic and color in a container or on the ground and returns one found ID.

Parameters

  • objType - Graphic/body, not serial item. 0..65534 - specific graphics; -1 or 0xFFFF - any. Other negative int in this client also remove the filter.
  • color — Hue, not the number of items. 0 - unpainted object; -1 or 0xFFFF - any hue. Other negative int also remove the color filter.
  • container - Ground: UO.Ground(), 0, -1, 0xFFFFFFFF or string ground. Backpack: string backpack or its serial. Decimal/hex serial and name AddObject are accepted. my selects his character's entire inventory, including equipment and attached bags. An unknown name causes a script error. Check the resulting serial: the explicit 0 selects the ground. The names ground/backpack are clearer than the numeric designations, which differ between command families.
  • inSub - Mandatory true/false (1/0). false - direct contents of a specific container; true – also loaded nested bags. For the earth, recursion does not change anything. my already selects all the character's inventory.

Return value

int: serial first match in local traversal order; 0 if there are no matches. Not graphic, count, array or bool. Check result != 0, not result == true or result == 1. A stack is considered one object; Mobile - one object and one unit. Order does not imply closeness and is not guaranteed between searches.

Behavior

  • All four positional arguments are needed. There are no optional arguments.
  • Earth uses the FindDistance and FindVertical of this script, excluding self and including the appropriate Item and Mobile. Searching within a specific container does not apply these distance/height limits. In both cases, Ignore and destroyed objects are excluded.
  • Before bypass, FindItem, FindCount, FindFullQuantity and GetFoundItems are cleared. They then relate to this search; empty search leaves zeros and an empty array. FindFullQuantity summarizes max(1, Amount) of items and by 1 for Mobile. FindQuantity reads the current quantity FindItem. Save GetFoundItems if, after another search, the previous list is still needed.
  • Bridge traverses loaded items once, then Mobile if land is selected. The type, color and at least one container must match. One object is counted once, even if it meets several conditions. There is no repeated complete traversal of the world for each combination.
  • Only data received by the client is read. Containers do not open, map cells do not load, there is no transfer. An empty result does not prove that the chest on the server is empty. If you need an active connection, check Connected: the search itself reads the local state.
  • The first local match is stored here; an unknown name does not switch the search to the backpack. Ground also accepts 0; your FindDistance default 18, maximum 255. These are the characteristics of this 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.

var result = UO.FindTypeEx(0x0EED, -1, "backpack", false);
UO.Print("FindTypeEx: " + Convert.ToString(result));

1. Direct backpack contents - direct script

Parameters and execution flow:

  • 0x0EED — gold, -1 — any hue; backpack/false excludes nested bags. The three lines output the first ID in hex without 0x, the number of objects and the sum of ones. Two stacks of 20 and 50: objects 2, units 70.
var item = UO.FindTypeEx(0x0EED, -1, "backpack", false);
UO.Print(Hex(item));
UO.Print(Convert.ToString(UO.FindCount()));
UO.Print(Convert.ToString(UO.FindFullQuantity()));

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

2. Full Time Ground Search Function - Script Function

Parameters and execution flow:

  • radius=5 and height=10 operate inside FindGoldNearSelf. Finally restores both limits even on return or error. The function returns serial gold or 0; Main checks != 0 before outputting.
return  RunScenario();
 object? RunScenario()
{
    var item = FindGoldNearSelf(5, 10);
    if (Truth(item != 0))
    {
        UO.Print(Hex(item));
    }
    else
    {
        UO.Print("Empty");
    }

    return null;
}

dynamic FindGoldNearSelf(dynamic radius, dynamic height)
{
    var oldDistance = UO.FindDistance();
    var oldVertical = UO.FindVertical();
    try
    {
        UO.FindDistance(radius);
        UO.FindVertical(height);
        return UO.FindTypeEx(0x0EED, -1, UO.Ground(), false);
    }
    finally
    {
        UO.FindDistance(oldDistance);
        UO.FindVertical(oldVertical);
    }
}

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

3. Container name and nested bags - script class

Parameters and execution flow:

  • GetSerial allows backpack; checking for zero prevents random ground selection. AddObject saves ID as search_bag. true includes nested bags. GetFoundItems stores a separate array; IsObjectExists rechecks every 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 bag = UO.GetSerial("backpack");
        if (Truth(bag != "0x00000000"))
        {
            UO.AddObject("search_bag", bag);
            UO.FindTypeEx(0x0EED, -1, "search_bag", true);
            var items = UO.GetFoundItems();
            foreach (var item in items)
            {
                if (Truth(UO.IsObjectExists(item)))
                {
                    UO.Print(Hex(item));
                }
            }
        }

        return null;
    }

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

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.FindTypeEx(objType, color, container, inSub) — UO.FindTypeEx(Any,Any,Any,Any)

Parameters: objType (Any), color (Any), container (Any), inSub (Any)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

case "findtypeex": return new InjectionValue(bridge.FindType(ResolveType(arguments[0]), Arg(1), StealthContainer(2), -1, Arg(3) != 0));

UO.FindTypesArrayEx

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

C# signatures

int UO.FindTypesArrayEx(object? objTypes, object? colors, object? containers, object? inSub);

In one traversal it searches for different graphics, colors and containers and returns the one found ID. The full list is read via GetFoundItems.

Parameters

  • objTypes - Graphic/body, not serial item. 0..65534 - specific graphics; -1 or 0xFFFF - any. Other negative int in this client also remove the filter.
  • colors — Hue, not the number of items. 0 - unpainted object; -1 or 0xFFFF - any hue. Other negative int also remove the color filter.
  • containers - Ground: UO.Ground(), 0, -1, 0xFFFFFFFF or string ground. Backpack: string backpack or its serial. Decimal/hex serial and name AddObject are accepted. my selects his character's entire inventory, including equipment and attached bags. An unknown name causes a script error. Check the resulting serial: the explicit 0 selects the ground. The names ground/backpack are clearer than the numeric designations, which differ between command families.
  • inSub - Mandatory true/false (1/0). false - direct contents of a specific container; true – also loaded nested bags. For the earth, recursion does not change anything. my already selects all the character's inventory.

Return value

int: serial first match in local traversal order; 0 if there are no matches. Not graphic, count, array or bool. Check result != 0, not result == true or result == 1. A stack is considered one object; Mobile - one object and one unit. Order does not imply closeness and is not guaranteed between searches.

Behavior

  • Array is passed; a single value is also treated as an array of one element. declaring the variable values[1] creates indices 0 and 1: fill each. Types and colors are independent options, not pairs by index. An “any” mask in any position or an empty array of types/colors removes this filter. An empty array of containers selects the character's inventory. Repetitions and intersections of containers do not duplicate ID.
  • All four positional arguments are needed. There are no optional arguments.
  • Earth uses the FindDistance and FindVertical of this script, excluding self and including the appropriate Item and Mobile. Searching within a specific container does not apply these distance/height limits. In both cases, Ignore and destroyed objects are excluded.
  • Before bypass, FindItem, FindCount, FindFullQuantity and GetFoundItems are cleared. They then relate to this search; empty search leaves zeros and an empty array. FindFullQuantity summarizes max(1, Amount) of items and by 1 for Mobile. FindQuantity reads the current quantity FindItem. Save GetFoundItems if, after another search, the previous list is still needed.
  • Bridge traverses loaded items once, then Mobile if land is selected. The type, color and at least one container must match. One object is counted once, even if it meets several conditions. There is no repeated complete traversal of the world for each combination.
  • Only data received by the client is read. Containers do not open, map cells do not load, there is no transfer. An empty result does not prove that the chest on the server is empty. If you need an active connection, check Connected: the search itself reads the local state.
  • The first local match is stored here; an unknown name does not switch the search to the backpack. Ground also accepts 0; your FindDistance default 18, maximum 255. These are the characteristics of this 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.

var result = UO.FindTypesArrayEx(new[] { 0x0EED }, new[] { -1 }, new[] { "backpack" }, false);
UO.Print("FindTypesArrayEx: " + Convert.ToString(result));

1. Two graphs on the ground - direct script

Parameters and execution flow:

  • types contains gold 0x0EED and black pearl 0x0F7A; one color=-1 - any hue, one Ground - earth. false on earth doesn't change anything. Current search limits apply. ID, the number of objects and the sum of units are output.
dynamic[] types = new dynamic[checked((int)(1) + 1)];
types[0] = 0x0EED;
types[1] = 0x0F7A;
dynamic[] colors = new dynamic[checked((int)(0) + 1)];
colors[0] = -1;
dynamic[] containers = new dynamic[checked((int)(0) + 1)];
containers[0] = UO.Ground();
var first = UO.FindTypesArrayEx(types, colors, containers, false);
UO.Print(Hex(first));
UO.Print(Convert.ToString(UO.FindCount()));
UO.Print(Convert.ToString(UO.FindFullQuantity()));

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

2. Gold in the backpack and on the ground - script function

Parameters and execution flow:

  • types - only gold; colors - any hue. Containers - backpack and ground; true includes nested bags. Objects/stacks and units from both areas are output, each object being counted once.
return  RunScenario();
 object? RunScenario()
{
    dynamic[] types = new dynamic[checked((int)(0) + 1)];
    types[0] = 0x0EED;
    dynamic[] colors = new dynamic[checked((int)(0) + 1)];
    colors[0] = -1;
    dynamic[] containers = new dynamic[checked((int)(1) + 1)];
    containers[0] = "backpack";
    containers[1] = UO.Ground();
    UO.FindTypesArrayEx(types, colors, containers, true);
    UO.Print(Convert.ToString(UO.FindCount()));
    UO.Print(Convert.ToString(UO.FindFullQuantity()));
    return null;
}

3. Complete Function with Result List - Script Class

Parameters and execution flow:

  • SearchTypesIn(container,firstType,secondType) returns an Array, whereas the builtin command returns a single int ID. The complete function above fills the arrays, searches recursively and immediately copies GetFoundItems. Main checks each stored ID and outputs it.
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 items = SearchTypesIn("backpack", 0x0EED, 0x0F7A);
        foreach (var item in items)
        {
            if (Truth(UO.IsObjectExists(item)))
            {
                UO.Print(Hex(item));
            }
        }

        return null;
    }

    dynamic SearchTypesIn(dynamic container, dynamic firstType, dynamic secondType)
    {
        dynamic[] types = new dynamic[checked((int)(1) + 1)];
        types[0] = firstType;
        types[1] = secondType;
        dynamic[] colors = new dynamic[checked((int)(0) + 1)];
        colors[0] = -1;
        dynamic[] containers = new dynamic[checked((int)(0) + 1)];
        containers[0] = container;
        UO.FindTypesArrayEx(types, colors, containers, true);
        return UO.GetFoundItems();
    }

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

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.FindTypesArrayEx(objTypes, colors, containers, inSub) — UO.FindTypesArrayEx(Any,Any,Any,Any)

Parameters: objTypes (Any), colors (Any), containers (Any), inSub (Any)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

case "findtypesarrayex":

                    InjectionValue[] searchContainers = arguments[2].Kind == InjectionValueKind.Array

                        ? arguments[2].Array : new[] { arguments[2] };

                    return new InjectionValue(bridge.FindTypes(arguments[0].Kind == InjectionValueKind.Array

                        ? arguments[0].Array.Select(ResolveType).ToArray() : new[] { ResolveType(arguments[0]) }, ArrayArg(1),

                        searchContainers.Select(ConvertClientSearchContainer).ToArray(), Arg(3) != 0));

UO.FindVertical

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

C# signatures

int UO.FindVertical();
void UO.FindVertical(object? value);

Reads or modifies the allowed height difference in the default search.

Parameters

  • value — Optional int. Without argument - reading; value — setting. The value is limited to the range 0..120; the negative becomes 0 rather than unlimited. In the new runtime: 2; the restored state may contain a different value. The fractional number is truncated to zero; double/0x numeric strings are also acceptable. Use int to avoid implicit conversion.

Return value

Without arguments: int - current limit (difference in world units Z), not found ID, number of objects or bool. 0 means zero limit, not failure. With value: void - no value; this is not true/false or the old setting. Once installed, read FindVertical() to find out the stored value.

Behavior

  • Height: abs(object.Z - player.Z), both ways, including border. For 0 only the same Z is suitable. This is not the floor number or the number of horizontal cells.
  • The setting is stored in the runtime of the current script; its procedures use a single value. Independent runtimes have separate settings. Read and write do not trigger a search, clear FindItem/FindCount/GetFoundItems, send a packet, move a character, or load distant objects.
  • FindTypeEx and FindTypesArrayEx use these limits when searching on the ground, but not inside the container. The remaining filters are type, hue, Ignore and the presence of a loaded object. FindAtCoord ignores both limits. In extended commands, explicit distance/maxZ can override settings; -1 in such parameters means to take the setting, as opposed to setting the setting itself to -1. FindList also filters Z when searching in containers; the specified container exception does not apply to it.
  • Before searching temporarily, save the value and restore it to Finally. The installation is not automatically canceled. Finally works on normal completion and a caught script error; The emergency stop cannot be used as a cleaning mechanism.

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.FindVertical();
UO.Print("FindVertical: " + Convert.ToString(result));

1. Read, Set and Range Limit - Direct Script

Parameters and execution flow:

  • previous saves the actual setting. value:=10 sets the normal limit; 1000 shows the limit to 120. Print reads the result as a separate call without an argument. Finally restores previous.
var previous = UO.FindVertical();
try
{
    UO.FindVertical(10);
    UO.Print(Convert.ToString(UO.FindVertical()));
    UO.FindVertical(1000);
    UO.Print(Convert.ToString(UO.FindVertical()));
}
finally
{
    UO.FindVertical(previous);
}

2. Temporary Ground Search - Script Function

Parameters and execution flow:

  • previous saves the calling code's setting. 10 changes only FindVertical; the second limit remains the same. 0x0EED - gold graphics, -1 - any hue, Container=-1 - world, false - without container recursion. id - one serial; != 0 checks for availability. FindCount counts entire objects/stacks. Finally restores the setting, not the list of results.
return  RunScenario();
 object? RunScenario()
{
    var previous = UO.FindVertical();
    try
    {
        UO.FindVertical(10);
        var id = UO.FindTypeEx(0x0EED, -1, -1, false);
        if (Truth(id != 0))
        {
            UO.Print(Hex(id) + ":" + Convert.ToString(UO.FindCount()));
        }
        else
        {
            UO.Print("0");
        }
    }
    finally
    {
        UO.FindVertical(previous);
    }

    return null;
}

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

3. Full function CountGroundInRange - script class

Parameters and execution flow:

  • CountGroundInRange(graphic, radius, height) stores both limits, sets radius=5 and height=10, looks for graphic=0x0EED and returns FindCount(). A stack is considered one object. The complete function is given after Main. Finally restores both limits even when exiting via return; the search result remains available.
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 count = CountGroundInRange(0x0EED, 5, 10);
        UO.Print(Convert.ToString(count));
        return null;
    }

    dynamic CountGroundInRange(dynamic graphic, dynamic radius, dynamic height)
    {
        var oldDistance = UO.FindDistance();
        var oldVertical = UO.FindVertical();
        try
        {
            UO.FindDistance(radius);
            UO.FindVertical(height);
            UO.FindTypeEx(graphic, -1, -1, false);
            return UO.FindCount();
        }
        finally
        {
            UO.FindDistance(oldDistance);
            UO.FindVertical(oldVertical);
        }
    }
}

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.FindVertical() — UO.FindVertical()

Parameters: No parameters.

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

case "findvertical":

                    if (arguments.Length > 0) { bridge.SetFindVertical(Arg(0)); return InjectionValue.Unit; }

                    return new InjectionValue(bridge.GetFindVertical());

UO.FindVertical(value) — UO.FindVertical(Any)

Parameters: value (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "findvertical":

                    if (arguments.Length > 0) { bridge.SetFindVertical(Arg(0)); return InjectionValue.Unit; }

                    return new InjectionValue(bridge.GetFindVertical());

UO.GetFindedList

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

C# signatures

dynamic UO.GetFindedList(object? userList);

Creates a copy of the list ID of the last normal search.

Parameters

  • userList — Required compatibility argument. In the current implementation, it is not populated or modified: the list is returned as the result of the command. You can pass 0. For a form without arguments, use GetFoundItems.

Return value

Array is a separate array of serial/ID in last search order. An empty Array if there were no matches. Does not contain graphic, hue or Amount. Changing the returned array does not edit the saved search list.

Behavior

  • Data already downloaded by the client is read. The command does not open the container, move items, or download objects from the entire server.
  • Array - array with indices starting from 0. Store it in var, check ArrayLength before accessing. Elements may disappear from the world after taking a snapshot: check Exists(serial) before taking action.
  • The data belongs to the last normal search of this script. FindType with 1–5 arguments, FindTypeEx, Count/CountEx/CountGround replace the results. Advanced filtered character commands are not required to change this snapshot.
  • A new search with no matches clears FindItem, FindCount and FindFullQuantity and clears GetFoundItems. Reading a result by itself does not trigger a new search.

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.FindType(0x0EED, -1, "backpack");
object? result = UO.GetFindedList(0);
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));

1. Get list size - direct script

Parameters and execution flow:

  • The usual FindType for gold in the backpack is pre-made. UserList=0 is not an output parameter.
  • Length - number of records/ID. This is not the amount of Amount in stacks. The empty list gives 0.
var found = UO.FindType(0x0EED, -1, "backpack");
var items = UO.GetFindedList(0);
UO.Print(Convert.ToString(ArrayLength(items)));

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

2. Traverse all found ID - script function

Parameters and execution flow:

  • The usual FindType for gold in the backpack is pre-made. UserList=0 is not an output parameter.
  • items[i] — numeric serial. Hex is used for output only. The loop does not access the last index.
return  RunScenario();
 object? RunScenario()
{
    var found = UO.FindType(0x0EED, -1, "backpack");
    var items = UO.GetFindedList(0);
    var i = 0;
    while (Truth(i < ArrayLength(items)))
    {
        UO.Print("0x" + Hex(items[i]));
        i = i + 1;
    }

    return null;
}

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

3. Check First Record Before Reading - Script Class

Parameters and execution flow:

  • The usual FindType for gold in the backpack is pre-made. UserList=0 is not an output parameter.
  • Two different things are checked: the record in the snapshot and the existence of the object now. Order without explicit sorting does not mean closeness.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        var found = UO.FindType(0x0EED, -1, "backpack");
        var items = UO.GetFindedList(0);
        if (Truth(ArrayLength(items) > 0))
        {
            var first = items[0];
            if (Truth(UO.Exists(first)))
            {
                UO.Print(UO.GetName(first));
            }
        }
        else
        {
            UO.Print("Empty list");
        }

        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.GetFindedList(userList) — UO.GetFindedList(Any)

Parameters: userList (Any)

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "getfindedlist":

                    return new InjectionValue(bridge.GetFoundItems().Select(serial => new InjectionValue(serial)).ToArray());

UO.GetFoundItems

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

C# signatures

dynamic UO.GetFoundItems();

Creates a copy of the list ID of the last normal search.

Parameters

There are no parameters.

Return value

Array is a separate array of serial/ID in last search order. An empty Array if there were no matches. Does not contain graphic, hue or Amount. Changing the returned array does not edit the saved search list.

Behavior

  • Data already downloaded by the client is read. The command does not open the container, move items, or download objects from the entire server.
  • Array - array with indices starting from 0. Store it in var, check ArrayLength before accessing. Elements may disappear from the world after taking a snapshot: check Exists(serial) before taking action.
  • The data belongs to the last normal search of this script. FindType with 1–5 arguments, FindTypeEx, Count/CountEx/CountGround replace the results. Advanced filtered character commands are not required to change this snapshot.
  • A new search with no matches clears FindItem, FindCount and FindFullQuantity and clears GetFoundItems. Reading a result by itself does not trigger a new search.

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.FindType(0x0EED, -1, "backpack");
object? result = UO.GetFoundItems();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));

1. Get list size - direct script

Parameters and execution flow:

  • The usual FindType for gold in the backpack is pre-made. There are no parameters.
  • Length - number of records/ID. This is not the amount of Amount in stacks. The empty list gives 0.
var found = UO.FindType(0x0EED, -1, "backpack");
var items = UO.GetFoundItems();
UO.Print(Convert.ToString(ArrayLength(items)));

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

2. Traverse all found ID - script function

Parameters and execution flow:

  • The usual FindType for gold in the backpack is pre-made. There are no parameters.
  • items[i] — numeric serial. Hex is used for output only. The loop does not access the last index.
return  RunScenario();
 object? RunScenario()
{
    var found = UO.FindType(0x0EED, -1, "backpack");
    var items = UO.GetFoundItems();
    var i = 0;
    while (Truth(i < ArrayLength(items)))
    {
        UO.Print("0x" + Hex(items[i]));
        i = i + 1;
    }

    return null;
}

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

3. Check First Record Before Reading - Script Class

Parameters and execution flow:

  • The usual FindType for gold in the backpack is pre-made. There are no parameters.
  • Two different things are checked: the record in the snapshot and the existence of the object now. Order without explicit sorting does not mean closeness.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        var found = UO.FindType(0x0EED, -1, "backpack");
        var items = UO.GetFoundItems();
        if (Truth(ArrayLength(items) > 0))
        {
            var first = items[0];
            if (Truth(UO.Exists(first)))
            {
                UO.Print(UO.GetName(first));
            }
        }
        else
        {
            UO.Print("Empty list");
        }

        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.GetFoundItems() — UO.GetFoundItems()

Parameters: No parameters.

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "getfounditems":

                    return new InjectionValue(bridge.GetFoundItems().Select(serial => new InjectionValue(serial)).ToArray());

UO.GetIgnoreList

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

C# signatures

dynamic UO.GetIgnoreList();

Shows specific ID added to the serial filter via Ignore. Helps to check which items have already been processed and are excluded from the re-search. The named type/hue rules from AddIgnoreList are not included in this array.

Parameters

There are no parameters.

Return value

Array — serial from the Ignore list in ascending numerical order ID. Empty Array when the list is empty. ID may no longer exist in the world; These are search rules, not a list of visible items.

Behavior

  • Data already downloaded by the client is read. The command does not open the container, move items, or download objects from the entire server.
  • Array - array with indices starting from 0. Store it in var, check ArrayLength before accessing. Elements may disappear from the world after taking a snapshot: check Exists(serial) before taking action.
  • In the client, the set belongs to the general state of the profile scripts. The array is a copy: IgnoreOff(serial) clears one exception, IgnoreReset clears all serial. They do not disable selected type/hue rules; they require SelectIgnoreList, DeleteIgnoreList or ClearIgnoreList. GetContent/GetEquipment and GetWorldItems without arguments do not apply this filter themselves.

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

1. Get list size - direct script

Parameters and execution flow:

  • There are no parameters; a snapshot of explicit serial exceptions is read. An empty array does not mean that there are no named type/hue rules.
  • Length - number of records/ID. This is not the amount of Amount in stacks. The empty list gives 0.
var items = UO.GetIgnoreList();
UO.Print(Convert.ToString(ArrayLength(items)));

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

2. Traverse all found ID - script function

Parameters and execution flow:

  • There are no parameters; a snapshot of explicit serial exceptions is read. An empty array does not mean that there are no named type/hue rules.
  • items[i] — numeric serial. Hex is used for output only. The loop does not access the last index.
return  RunScenario();
 object? RunScenario()
{
    var items = UO.GetIgnoreList();
    var i = 0;
    while (Truth(i < ArrayLength(items)))
    {
        UO.Print("0x" + Hex(items[i]));
        i = i + 1;
    }

    return null;
}

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

3. Check First Record Before Reading - Script Class

Parameters and execution flow:

  • There are no parameters; a snapshot of explicit serial exceptions is read. An empty array does not mean that there are no named type/hue rules.
  • Two different things are checked: the record in the snapshot and the existence of the object now. Order without explicit sorting does not mean closeness.
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 items = UO.GetIgnoreList();
        if (Truth(ArrayLength(items) > 0))
        {
            var first = items[0];
            if (Truth(UO.Exists(first)))
            {
                UO.Print(UO.GetName(first));
            }
        }
        else
        {
            UO.Print("Empty list");
        }

        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.GetIgnoreList() — UO.GetIgnoreList()

Parameters: No parameters.

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "getignorelist":

                    return new InjectionValue(bridge.GetIgnoreList().Select(value => new InjectionValue(value)).ToArray());

UO.GetWorldItems

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

C# signatures

dynamic UO.GetWorldItems();
dynamic UO.GetWorldItems(object? @type);
dynamic UO.GetWorldItems(object? @type, object? color);
dynamic UO.GetWorldItems(object? @type, object? color, object? distance);
dynamic UO.GetWorldItems(object? @type, object? color, object? distance, object? container);
dynamic UO.GetWorldItems(object? @type, object? color, object? distance, object? container, object? nearest);
dynamic UO.GetWorldItems(object? @type, object? color, object? distance, object? container, object? nearest, object? maxZ);

Returns an array ID of world items or the selected container.

Parameters

  • type — First argument of the filtered form: graphic/type, -1 or 0xFFFF — any. This is not serial. Without all arguments, a separate form without filtering is used.
  • color - Hue; default - 1, any color. 0xFFFF also allows any hue.
  • distance — Radius in cells along X/Y. Negative value or absence use FindDistance; 0 means the same cell. For a container, the distance to the container is checked, not its internal X/Y.
  • container - Default to ground. ground, numeric 0/1 and their strings are ground. backpack, my and numeric -1 are the direct contents of the backpack. Serial/hex-string/alias of the container - its direct contents; self selects items whose parent is a character. An unknown name and a missing backpack give an empty array, not land.
  • nearest — Default false. true sorts by distance, then by numeric serial. For one container, the distance for all results is the same.
  • maxZ — Permissible height difference relative to self. Negative value or absence use FindVertical; 0 requires the same height. In a container, the height of the container itself is taken.

Return value

Array - serial/ID items, not type, coordinates or Amount. An empty Array with no matches. GetWorldItems() returns all loaded items outside containers without Ignore/range/height; GetWorldItems(type,...) uses the listed filters and Ignore. NPC/players are not included in any form.

Behavior

  • Data already downloaded by the client is read. The command does not open the container, move items, or download objects from the entire server.
  • Array - array with indices starting from 0. Store it in var, check ArrayLength before accessing. Elements may disappear from the world after taking a snapshot: check Exists(serial) before taking action.
  • The photo FindItem/FindCount/GetFoundItems does not change. The team does not open the container or go through the enclosed bags.
  • To disable restrictions, -1 is not enough: this is the selection of the current setting, not the infinite radius. Specify the desired non-negative distance/maxZ or use the form without arguments for all loaded land items.

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

1. Count all loaded land items - direct script

Parameters and execution flow:

  • No parameters: special form without filters.
  • The result does not mean all map or server items. Ignore does not apply here.
var items = UO.GetWorldItems();
UO.Print(Convert.ToString(ArrayLength(items)));

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

2. Find the nearest stack of the desired type and color - script function

Parameters and execution flow:

  • type=0x0EED — gold, color=-1 — any; distance=5, container=ground, nearest=true, maxZ=3.
  • The first entry is the closest matching non-ignorable item; distance does not check walls or carry accessibility.
return  RunScenario();
 object? RunScenario()
{
    var items = UO.GetWorldItems(0x0EED, -1, 5, "ground", true, 3);
    if (Truth(ArrayLength(items) > 0))
    {
        var item = items[0];
        if (Truth(UO.Exists(item)))
        {
            UO.Print("Nearest ID: 0x" + Hex(item));
        }
    }

    return null;
}

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

3. Count direct contents of backpack - script class

Parameters and execution flow:

  • Any type/color; my chooses a backpack. The distance 20 and the difference Z 255 refer to the container. false preserves the original order.
  • Straight items are counted, not units in stacks and not the contents of nested bags. Without a backpack, an empty Array is returned.
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 items = UO.GetWorldItems(-1, -1, 20, "my", false, 255);
        UO.Print(Convert.ToString(ArrayLength(items)));
        return null;
    }

    int ArrayLength(object? value) => value is System.Array array ? array.Length : 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.GetWorldItems() — UO.GetWorldItems()

Parameters: No parameters.

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "getworlditems":

                    return new InjectionValue(bridge.GetWorldItems().Select(serial => new InjectionValue(serial)).ToArray());

UO.GetWorldItems(type) — UO.GetWorldItems(Any)

Parameters: type (Any)

Result: dynamic / Any.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => CompactGetWorldItems(values)

UO.GetWorldItems(type, color) — UO.GetWorldItems(Any,Any)

Parameters: type (Any), color (Any)

Result: dynamic / Any.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => CompactGetWorldItems(values)

UO.GetWorldItems(type, color, distance) — UO.GetWorldItems(Any,Any,Any)

Parameters: type (Any), color (Any), distance (Any)

Result: dynamic / Any.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => CompactGetWorldItems(values)

UO.GetWorldItems(type, color, distance, container) — UO.GetWorldItems(Any,Any,Any,Any)

Parameters: type (Any), color (Any), distance (Any), container (Any)

Result: dynamic / Any.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => CompactGetWorldItems(values)

UO.GetWorldItems(type, color, distance, container, nearest) — UO.GetWorldItems(Any,Any,Any,Any,Any)

Parameters: type (Any), color (Any), distance (Any), container (Any), nearest (Any)

Result: dynamic / Any.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => CompactGetWorldItems(values)

UO.GetWorldItems(type, color, distance, container, nearest, maxZ) — UO.GetWorldItems(Any,Any,Any,Any,Any,Any)

Parameters: type (Any), color (Any), distance (Any), container (Any), nearest (Any), maxZ (Any)

Result: dynamic / Any.

During a call:

The call executes the stored handler delegate. The registration method creates this delegate while building the API.

Internal implementation code; this is not a standalone script.

values => CompactGetWorldItems(values)

UO.Ignore

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

C# signatures

void UO.Ignore(object? objID);
void UO.Ignore(object? id, object? stateValue);

Adds or removes serial to the normal search ignore list.

Parameters

  • id — Serial/ID object: int, numeric/hex string or set alias, for example "lasttarget". This is not a graphic/type. Check the loaded object before taking action.
  • objID — Serial/ID object: int, numeric/hex string or set alias, for example "lasttarget". This is not a graphic/type. Check the loaded object before taking action.
  • stateValue — Optional mode. The number 0 turns off, non-zero turns on. The lines "off", "false" (case insensitive) and exactly "0" are turned off; any other line includes. Without a mode argument - add.

Return value

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

Behavior

  • Ignore(id) calls bridge.Ignore(serial), which adds serial to State.IgnoredSerials. Ignore(id,stateValue) selects either Ignore or Unignore. Any non-empty string cannot be considered true: the listed escape words are processed separately.
  • This is a search filter, not hiding or deleting an object. Named filters of types AddIgnoreList are stored separately.
  • 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.Ignore");
UO.Ignore("lasttarget");

1. Direct call - direct script

Parameters and execution flow:

  • Adds or removes serial to the normal search ignore list.
UO.Ignore("lasttarget");

2. Explicit option - script function

Parameters and execution flow:

  • Ignore(id) calls bridge.Ignore(serial), which adds serial to State.IgnoredSerials. Ignore(id,stateValue) selects either Ignore or Unignore. Any non-empty string cannot be considered true: the listed escape words are processed separately.
return  RunScenario();
 object? RunScenario()
{
    UO.Ignore("lasttarget", "off");
    return null;
}

3. Full Helper Function - Script Class

Parameters and execution flow:

  • This is a search filter, not hiding or deleting an object. Named filters of types AddIgnoreList are stored separately.
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.Ignore(id, 1);
            UO.Print(UO.GetIgnoreList());
            UO.Ignore(id, 0);
        }

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

Parameters: objID (Any/Integer/String)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "ignore": bridge.Ignore(Arg(0)); return InjectionValue.Unit;

UO.Ignore(objID) — UO.Ignore(Integer)

Parameters: objID (Any/Integer/String)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

public void Ignore(int id) => bridge.Ignore(id);

UO.Ignore(objID) — UO.Ignore(String)

Parameters: objID (Any/Integer/String)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

public void Ignore(string id) => Ignore(GetObject(id));

UO.Ignore(id, stateValue) — UO.Ignore(Any,Any)

Parameters: id (Any), stateValue (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

public void Ignore(InjectionValue id, InjectionValue stateValue)

        {

            int serial = GetObject(id);

            bool enabled = stateValue.Kind != InjectionValueKind.String

                ? NumberConversions.ToInt(stateValue) != 0

                : !stateValue.String.Equals("off", StringComparison.OrdinalIgnoreCase)

                    && !stateValue.String.Equals("false", StringComparison.OrdinalIgnoreCase)

                    && stateValue.String != "0";



            if (enabled)

                bridge.Ignore(serial);

            else

                bridge.Unignore(serial);

        }

UO.IgnoreOff

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

C# signatures

void UO.IgnoreOff(object? objID);

Removes one serial from the normal ignore list.

Parameters

  • objID — Serial/ID object: int, numeric/hex string or set alias, for example "lasttarget". This is not a graphic/type. Check the loaded object before taking action.

Return value

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

Behavior

  • Bridge.Unignore removes ID from State.IgnoredSerials. Other serial and named filters AddIgnoreList are not cleared; items are not removed from the world.
  • Local change of search filter; packets are not sent.
  • 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.IgnoreOff");
UO.IgnoreOff(UO.GetSerial("lasttarget"));

1. Direct call - direct script

Parameters and execution flow:

  • Removes one serial from the normal ignore list.
var id = UO.GetSerial("lasttarget");
if (Truth(UO.Exists(id)))
{
    UO.IgnoreOff(id);
}

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

2. Explicit option - script function

Parameters and execution flow:

  • Bridge.Unignore removes ID from State.IgnoredSerials. Other serial and named filters AddIgnoreList are not cleared; items are not removed from the world.
return  RunScenario();
 object? RunScenario()
{
    var id = UO.GetSerial("self");
    if (Truth(UO.Exists(id)))
    {
        UO.IgnoreOff(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;

3. Full Helper Function - Script Class

Parameters and execution flow:

  • Local change of search filter; packets are not sent.
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()
    {
        ApplyToLoaded(UO.GetSerial("lasttarget"));
        return null;
    }

    void ApplyToLoaded(dynamic id)
    {
        if (Truth(UO.Exists(id)))
        {
            UO.IgnoreOff(id);
        }
    }

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

Parameters: objID (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "ignoreoff": bridge.Unignore(Arg(0)); return InjectionValue.Unit;

UO.IgnoreReset

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

C# signatures

void UO.IgnoreReset();

Clears the normal list of ignored serial.

Parameters

There are no parameters.

Return value

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

Behavior

  • Bridge.IgnoreReset calls State.IgnoredSerials.Clear. Removes all serial from this filter, including those added by another search in the overall bridge session.
  • Does not clear named AddIgnoreList, delete objects, or reset the results of FindType.
  • 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.IgnoreReset");
UO.IgnoreReset();

1. Direct call - direct script

Parameters and execution flow:

  • Clears the normal list of ignored serial.
UO.IgnoreReset();

2. Explicit option - script function

Parameters and execution flow:

  • Bridge.IgnoreReset calls State.IgnoredSerials.Clear. Removes all serial from this filter, including those added by another search in the overall bridge session.
return  RunScenario();
 object? RunScenario()
{
    UO.Print(UO.GetIgnoreList());
    UO.IgnoreReset();
    return null;
}

3. Full Helper Function - Script Class

Parameters and execution flow:

  • Does not clear named AddIgnoreList, delete objects, or reset the results of FindType.
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.Ignore("lasttarget");
        UO.IgnoreReset();
        UO.Print(UO.GetIgnoreList());
        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.IgnoreReset() — UO.IgnoreReset()

Parameters: No parameters.

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

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

UO.InfoFindList

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

C# signatures

void UO.InfoFindList();

Outputs saved definitions AddFindList to the client's local log. Useful for checking name, order, type and hue after adding or removing rules. Does not show objects found in the world.

Parameters

There are no parameters.

Return value

void: No return value. Do not assign the call to a variable and do not test it on true/1. The state of the definitions can be output UO.InfoFindList(); the search itself is launched separately via UO.FindList().

Behavior

  • Does not accept arguments; prints all sets of the current runtime in one line.
  • The list|type|color entry has no color if AddFindList was called with two arguments. "|" is used between entries. Numeric literals are displayed in decimal text; the order corresponds to addition.
  • Does not run FindList and does not change FindItem/FindCount. For an empty store, an empty string is passed to the message channel; this is not an explicit "list is empty" message.
  • Definitions are in the state of the given script runtime. An independent other runtime has its own set; closing the IDE window does not clear these rules. This is not a settings file or a list of global game objects.
  • AddFindList appends the entry to the end; repetitions are not deleted. To re-provision your kit, first call ClearFindList("name"). Changing definitions does not clear FindItem/FindCount/GetFoundItems that have already been received.
  • The record stores text fields. The numeric literal 0x0EED is stored as "3821", the string "0x0EED" is stored as "0x0EED". The search converts both options into a number, and DeleteFindList compares the stored text. Use the same form when adding and deleting.
  • The unknown name in FindList is not an empty registered set: the engine attempts to parse it as a list of numeric types. A non-numeric name causes a conversion error. After deleting the last entry, create a new set before searching for that name.
  • 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.InfoFindList");
UO.InfoFindList();

1. Check created rules - direct script

Parameters and execution flow:

  • For this set the line loot|3821|-1 | loot|3962|-1: 3821 = 0x0EED, 3962 = 0x0F7A. This is the type, not the serial, of the item found.
BuildLoot();
UO.InfoFindList();

void BuildLoot()
{
    UO.ClearFindList("loot");
    UO.AddFindList("loot", 0x0EED, -1);
    UO.AddFindList("loot", 0x0F7A, -1);
}

2. Compare definitions before and after deletion - script function

Parameters and execution flow:

  • The Before/After output allows you to see the removal of only one color; other named sets will also be shown if they exist.
return  RunScenario();
 object? RunScenario()
{
    UO.ClearFindList("check");
    UO.AddFindList("check", 0x0EED, 0);
    UO.AddFindList("check", 0x0EED, 0x0044);
    UO.Print("Before:");
    UO.InfoFindList();
    UO.DeleteFindList("check", 0x0EED, 0x0044);
    UO.Print("After:");
    UO.InfoFindList();
    return null;
}

3. Distinguish between rules and the actual presence of things - scenario class

Parameters and execution flow:

  • The presence of stock|3821 confirms the rule, but not the presence of gold. The number of serial and the sum of units are read after a successful search.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        UO.ClearFindList("stock");
        UO.AddFindList("stock", 0x0EED);
        UO.InfoFindList();
        var first = UO.FindList("stock", "backpack");
        if (Truth(first == ""))
        {
            UO.Print("Rule exists, but no matching item is loaded");
        }
        else
        {
            UO.Print("Objects: " + Convert.ToString(UO.FindCount()));
            UO.Print("Units: " + Convert.ToString(UO.FindFullQuantity()));
        }

        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.InfoFindList() — UO.InfoFindList()

Parameters: No parameters.

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "infofindlist": SystemMessage(string.Join(" | ", LegacyList("AddFindList"))); break;

UO.MFGI

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

C# signatures

void UO.MFGI();

Prints the current list of search results.

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 reads GetFoundItems, formats each serial as 0xXXXXXXXX and concatenates the lines with a "|" delimiter. No new search is performed; an empty list gives an empty string.
  • 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.MFGI");
UO.MFGI();

1. Direct call - direct script

Parameters and execution flow:

  • Prints the current list of search results.
UO.MFGI();

2. Explicit option - script function

Parameters and execution flow:

  • ExecuteLegacyManualAlias reads GetFoundItems, formats each serial as 0xXXXXXXXX and concatenates the lines with a "|" delimiter. No new search is performed; an empty list gives an empty string.
return  RunScenario();
 object? RunScenario()
{
    UO.FindType("0x0E21");
    UO.MFGI();
    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.MFGI();
        UO.Print(UO.GetArrayLength(UO.GetFoundItems()));
        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.MFGI() — UO.MFGI()

Parameters: No parameters.

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "mfgi":

                    SystemMessage(string.Join(" | ", bridge.GetFoundItems().Select(id => $"0x{id:X8}")));

                    break;

UO.SelectIgnoreList

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

C# signatures

void UO.SelectIgnoreList(object? list);

Toggles the active named search filter. It is useful to change the set of exceptions between mining, sorting and targeting without deleting the saved rules. This command does not perform the search itself.

Parameters

  • list — Arbitrary non-empty name, for example "loot_skip". The name is not case sensitive. This is not the name of the item, not the serial container, and not the name of FindList. The empty string "" is also acceptable here: disable named rules.

Return value

void - no value. Use on a separate line without var result = and without checking =true. The command changes the local filter; does not return the number of items and does not send anything to the server.

Behavior

  • A non-existent name selects an empty filter. The late AddIgnoreList with this name will start acting in the next searches. Regular Ignore(serial) continues to operate regardless of choice.
  • The named list contains the graphic/type + hue rules, and the regular Ignore list contains the specific serial. These are different filters: they are combined when the search supports them. Objects remain visible and accessible to direct UseObject/MoveItem; This is not Hide or a ban on actions.
  • The list name is not case sensitive; edge spaces are removed. One named list is active, initially default. AddIgnoreList does not select it automatically. SelectIgnoreList("") disables the named filter only.
  • The rules apply to new searches, including items uploaded AFTER they were added. The already received array and the previous result FindCount are not recalculated until a new search. Don't select a list with the rule -1,-1 unless you want to exclude everything.
  • The filter takes into account FindType/FindTypeEx/FindTypesArrayEx, FindList, FindAtCoord, FindNotoriety, Count/CountEx and extended selections GetMobiles, GetWorldItems, UseType, WaitTarget, Attack/AttackNearest/FindMan. includeIgnored=true, where provided, bypasses both serial and type/hue. The full enumeration GetContent/GetEquipment, GetWorldItems() without arguments, and the verbal FindMobile(human,near,...) do not use these rules.
  • GetIgnoreList returns only explicitly added serial; the rows of the named list are not included in this array. IgnoreReset clears the entire serial filter, IgnoreOff(serial) removes one serial exception; the named rules are preserved. ClearIgnoreList() without arguments clears both views.
  • The state belongs to the general state of the client profile scripts; the change affects other scripts with this state. The settings are included in the saved snapshot. After changing the rules, another script can already perform a search with the previously taken snapshot - the next search will see the update.
  • 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.SelectIgnoreList");
UO.SelectIgnoreList("SORT");

1. Switch sorting mode - direct script

Parameters and execution flow:

  • SORT and sort are one list. The search selects the first allowed backpack object; saving the name does not transfer it.
UO.AddIgnoreList("sort", 0x0EED);
UO.SelectIgnoreList("SORT");
var item = UO.FindType(-1, -1, "backpack");
if (Truth(item != ""))
{
    UO.AddObject("sort_candidate", item);
}

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

2. Turn off type rules while preserving the sets themselves - script function

Parameters and execution flow:

  • An empty line disables only the named filter. To restore it later, pass the set name again.
return  RunScenario();
 object? RunScenario()
{
    UO.SelectIgnoreList("");
    var gold = UO.FindType(0x0EED, -1, "backpack");
    if (Truth(gold != ""))
    {
        UO.AddObject("gold_candidate", gold);
    }

    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. Prepare a filter after choosing a name - script class

Parameters and execution flow:

  • Before adding the rule later is empty. Once added, no stack of gold passes the next search, even if it just appeared.
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.SelectIgnoreList("later");
        UO.AddIgnoreList("later", 0x0EED);
        var item = UO.FindType(0x0EED, -1, "ground");
        if (Truth(item == ""))
        {
            UO.Print("Gold is excluded by the selected rule");
        }

        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.SelectIgnoreList(list) — UO.SelectIgnoreList(Any)

Parameters: list (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "selectignorelist": state.SelectedIgnoreList = Text(0).Trim(); break;

UO.SetBadLocation

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

C# signatures

void UO.SetBadLocation(object? x, object? y);

Adds X/Y to the list of prohibited cells for the following routes MoveXY, NewMoveXY, MoveXYZ, PMove and requests GetPathArray/GetPathArray3D.

Parameters

  • x — World X of excluded cell.
  • y — World Y of excluded cell.

Return value

void - no return value. Call on a separate line; it's not true/false or number of steps.

Behavior

  • The key consists of X/Y, no map and Z. The coordinates must be integers within 0..65535; going out of range causes a script error.
  • Prohibitions apply to the runtime of the calling script. The new route or request receives a snapshot of it. An already running route saves its snapshot, including internal recalculation. After changing the list, start a new route.
  • This is not a map change: normal manual movement and other runtime routes do not receive this ban. You can leave the original square, even if it is marked as forbidden.
  • 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.SetBadLocation");
UO.SetBadLocation(UO.GetX() + 1, UO.GetY());

1. Exclude neighboring cell from calculation - direct script

Parameters and execution flow:

  • X/Y - cell east of the character.
  • If a traversal is possible, another full path is returned; the character doesn't move.
UO.SetBadLocation(UO.GetX() + 1, UO.GetY());
var path = UO.GetPathArray(UO.GetX() + 3, UO.GetY(), true, 0);
UO.Print(Convert.ToString(ArrayLength(path)));

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

2. Add two cells - script function

Parameters and execution flow:

  • Each call adds one X/Y pair.
  • Repeating a pair does not create a second separate prohibition; Z is not a parameter.
return  RunScenario();
 object? RunScenario()
{
    UO.SetBadLocation(1445, 1690);
    UO.SetBadLocation(1445, 1691);
    return null;
}

3. Set a known obstacle in an adjacent cell - scenario class

Parameters and execution flow:

  • Replace the coordinates with a really impassable cell. The command sets up local route data and does not create an object in the world.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        int x = UO.GetX() + 1;
        int y = UO.GetY();
        UO.SetBadLocation(x, y);
        UO.Print($"Marked known blocked location: {x},{y}");
        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.SetBadLocation(x, y) — UO.SetBadLocation(Any,Any)

Parameters: x (Any), y (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "setbadlocation":

                {

                    int x = Arg(0), y = Arg(1);

                    if (x < 0 || x > ushort.MaxValue || y < 0 || y > ushort.MaxValue)

                        throw new NativeSubrutineException("UO.SetBadLocation requires world X/Y in 0..65535.");

                    state.BadLocations.Add(x + "," + y);

                    return InjectionValue.Unit;

                }

UO.SetBadObject

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

C# signatures

void UO.SetBadObject(object? objType, object? color, object? radius);

Excludes from the following routes and queries the paths of cells around loaded world objects selected by graphic and hue.

Parameters

  • objType - Graphic/type of the item, 0..65535. 0xFFFF or -1 allows any type. This is not a serial specific instance.
  • color — Hue of the item, 0..65535. 0xFFFF or -1 allows any color; 0 means exactly hue 0.
  • radius — Radius in cells, 0..255 inclusive. 0 excludes an item cell. R excludes the square max(abs(dx),abs(dy)) <= R around it, including the diagonal cells.

Return value

void - no return value. Call on a separate line; it's not true/false or number of steps.

Behavior

  • Parameters are required. An inappropriate range causes a script error rather than silent number truncation.
  • The rules are accumulated in the current runtime. Matching rules are combined: the largest radius is applied to one item. ClearBadObjectList removes all these rules.
  • Loaded dynamic items with Container=0 are taken into account, including doors accessible to the client. Items inside containers, NPC and map statics are not selected by this filter. For characters use avoidMobiles, for individual cells use SetBadLocation.
  • When you start MoveXY/NewMoveXY/MoveXYZ/PMove or GetPathArray/GetPathArray3D, a snapshot of the rules and positions of the items is created. Further changes to the world and list do not change this snapshot; a new launch receives new data.
  • The filter does not send anything to the server, does not force the closed container to load content, and does not change manual movement. X/Y rules do not have a separate Z limit.
  • 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.SetBadObject");
UO.SetBadObject(0x398C, 0xFFFF, 1);

1. Bypass objects of a certain type - direct script

Parameters and execution flow:

  • ObjType=0x398C — graphic example: replace with the type of obstacle on your server. Color=0xFFFF selects any color; Radius=1 eliminates a 3×3 square around each matching item.
  • NewMoveXY goes five cells to the east, with exact X/Y, on foot, without callback and with timeout=5000 ms. ok=1 means achieving the goal; 0 does not confirm bypass.
UO.SetBadObject(0x398C, 0xFFFF, 1);
var ok = UO.NewMoveXY(UO.GetX() + 5, UO.GetY(), true, 0, false, 0, 5000);
UO.Print(Convert.ToString(ok));

2. Check path with exact color without movement - script function

Parameters and execution flow:

  • Color=0x0044 selects only that hue, and Radius=0 excludes only the cell occupied by the item. ClearBadObjectList removes the previous type and color rules.
  • GetPathArray returns the entries [x,y,z], including the origin. An empty array means there is no full path given the current constraints. The character remains in place.
return  RunScenario();
 object? RunScenario()
{
    UO.ClearBadObjectList();
    UO.SetBadObject(0x398C, 0x0044, 0);
    var path = UO.GetPathArray(UO.GetX() + 4, UO.GetY(), true, 0);
    UO.Print("Path records: " + Convert.ToString(ArrayLength(path)));
    return null;
}

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

3. Temporarily exclude cells of any objects in the world - script class

Parameters and execution flow:

  • ObjType=-1 and Color=-1 are both wildcards. Radius=0 excludes the cells of all loaded world items, but not NPC or the contents of the bags.
  • The cleanup applies to future requests. The already received path is saved; this is an array of coordinates, not an active route.
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.SetBadObject(-1, -1, 0);
        var path = UO.GetPathArray(UO.GetX() + 2, UO.GetY(), true, 0);
        UO.ClearBadObjectList();
        UO.Print(Convert.ToString(ArrayLength(path)));
        return null;
    }

    int ArrayLength(object? value) => value is System.Array array ? array.Length : 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.SetBadObject(objType, color, radius) — UO.SetBadObject(Any,Any,Any)

Parameters: objType (Any), color (Any), radius (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "setbadobject":

                {

                    int type = ResolveType(arguments[0]), hue = Arg(1), radius = Arg(2);

                    if (type < -1 || type > ushort.MaxValue || hue < -1 || hue > ushort.MaxValue || radius < 0 || radius > byte.MaxValue)

                        throw new NativeSubrutineException("UO.SetBadObject requires type/color 0..65535 (or -1) and radius 0..255.");

                    state.BadObjects.Add(type + "," + hue + "," + radius);

                    return InjectionValue.Unit;

                }

Clone this wiki locally