Skip to content

EN UO Topic search

Codex edited this page Oct 12, 2026 · 4 revisions

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

Search

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

Selecting a search area and filters, processing the result, list of items found and exceptions. Check the “not found” value using the command card: serial, quantity and list - different results.

Sections

Topic Commands and explanations
Search Items UO.FindType · UO.FindTypeEx · UO.FindTypesArrayEx · UO.FindAnyType
Search Mobiles UO.FindMobile · UO.FindType
Search Players UO.FindMobile · UO.FindType
Search NPC UO.FindMobile · UO.FindType
Search Monsters UO.FindMobile · UO.FindType
Search by Serial UO.Exists · UO.GetSerial
Search by Type UO.FindType · UO.FindTypeEx · UO.FindTypesArrayEx
Search by Notoriety UO.FindByNotoriety · UO.FindNotoriety
Search by Distance UO.FindDistance · UO.FindType
Search by Coordinates UO.FindAtCoord
Search by Z UO.FindVertical · UO.FindType
Search Ground UO.FindType · UO.CountGround
Search Containers UO.FindTypeEx · UO.OpenContainer
FindList UO.AddFindList · UO.FindList · UO.GetFindedList · UO.GetFoundItems · UO.FindItem · UO.FindCount · UO.FindQuantity · UO.FindFullQuantity
Ignore Lists UO.Ignore · UO.IgnoreOff · UO.IgnoreReset · UO.AddIgnoreList · UO.SelectIgnoreList
Bad Objects UO.SetBadObject · UO.ClearBadObjectList
Bad Locations UO.SetBadLocation · UO.ClearBadLocationList

All theme commands

Search Items

UO.FindType · UO.FindTypeEx · UO.FindTypesArrayEx · UO.FindAnyType · UO.FindAtCoord · UO.FindItem · UO.FindCount · UO.FindQuantity · UO.FindFullQuantity · UO.Count · UO.CountEx · UO.CountGround · UO.GetWorldItems · UO.GetFoundItems · UO.GetFindedList

Search Mobiles

UO.FindMobile · UO.FindMan · UO.FindByNotoriety · UO.FindNotoriety

Search by Distance / Z

UO.FindDistance · UO.FindVertical

FindList

UO.AddFindList · UO.ClearFindList · UO.DeleteFindList · UO.FindList · UO.InfoFindList · UO.MFGI

Ignore Lists

UO.Ignore · UO.IgnoreOff · UO.IgnoreReset · UO.AddIgnoreList · UO.ClearIgnoreList · UO.DeleteIgnoreList · UO.SelectIgnoreList · UO.GetIgnoreList

Bad Objects

UO.SetBadObject · UO.ClearBadObjectList

Bad Locations

UO.SetBadLocation · UO.ClearBadLocationList

Examples on the topic

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

UO.FindType

Parameters, result and all scenarios

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;

UO.FindFullQuantity

Parameters, result and all scenarios

var found = UO.FindType(0x0EED, -1, "backpack");
var value = UO.FindFullQuantity();
UO.Print(Convert.ToString(value));

Reference parts

1 · 2

Complete command reference


UO.AddFindList

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

C# signatures

void UO.AddFindList(object? list, object? @type);
void UO.AddFindList(object? list, object? @type, object? color);

Adds the type/hue rule to the named set for UO.FindList. The set allows you to repeatedly search for several types of objects or mobiles and set the priority of the types by the order of addition.

Parameters

  • list — The name of the ruleset, for example "loot". Pass the string without the |: this character is used as a separator within the record. The name is not case sensitive. This is not a serial container or an array of found items.
  • type — Graphic/type of the item or body mobile, not its serial. Typically int 0..65535, including 0x0EED; -1 or 0xFFFF means any type when searching. Provide one value per entry. Several types are added by separate calls.
  • color — Hue of an object/body, not RGB. int 0..65535; 0 - regular hue 0, -1 or 0xFFFF - any. In AddFindList, skipping color means any hue when searching.

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

  • 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.
  • The arguments are stored immediately; the numeric type/hue check is performed at FindList. AddFindList does not search for, transfer items or add serial to Ignore.

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.AddFindList");
UO.AddFindList("simple_loot", 0x0EED);

1. Prepare your own loot set and get results - direct script

Parameters and execution flow:

  • 0x0EED - gold, 0x0F7A - second graphic of the set. For other server data, replace graphics. The complete BuildLoot procedure is given above.
  • FindCount(item) reads the number of units of a particular stack; GetFoundItems contains distinct serial. This example does not perform any transfer.
BuildLoot();
var first = UO.FindList("loot", "ground", 2, -1, false, 5, false);
if (Truth(first == ""))
{
    UO.Print("No matching loot nearby");
    return null;
}
var items = UO.GetFoundItems();
foreach (var item in items)
{
    UO.Print(UO.GetName(item) + " | stack: " + Convert.ToString(UO.FindCount(item)));
}

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

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

2. Search only for an item of the desired color in the backpack - script function

Parameters and execution flow:

  • 0x0044 filters hue; this is not serial. backpack searches for the direct contents of the backpack. AddObject saves the selected object under a name in this runtime.
return  RunScenario();
 object? RunScenario()
{
    UO.ClearFindList("colored");
    UO.AddFindList("colored", 0x0EED, 0x0044);
    var first = UO.FindList("colored", "backpack");
    if (Truth(first != ""))
    {
        UO.AddObject("colored_item", first);
    }

    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. Body types and multiple notoriety values ​​- script class

Parameters and execution flow:

  • In each entry, the missing color means any hue. The line "5|6" allows two notoriety codes; this filter excludes regular Items. Search does not attack or launch Follow.
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("watch");
        UO.AddFindList("watch", 0x0190);
        UO.AddFindList("watch", 0x0191);
        var nearby = UO.FindList("watch", "ground", 12, "5|6", true, 10);
        if (Truth(nearby != ""))
        {
            UO.AddObject("watched_mobile", nearby);
        }

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

Parameters: list (Any), type (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "adddir":

                case "addfindlist":

                case "addgate":

                case "addrecall":

                case "addstep":

                    LegacyList(name).Add(string.Join("|", arguments.Select(value => value.ToString())));

                    break;

UO.AddFindList(list, type, color) — UO.AddFindList(Any,Any,Any)

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

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "adddir":

                case "addfindlist":

                case "addgate":

                case "addrecall":

                case "addstep":

                    LegacyList(name).Add(string.Join("|", arguments.Select(value => value.ToString())));

                    break;

UO.AddIgnoreList

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

C# signatures

void UO.AddIgnoreList(object? list, object? @type);
void UO.AddIgnoreList(object? list, object? @type, object? color);

Prepares a named set of things that should be skipped when searching: for example, do not select gold or do not select things of a certain color. The rule is specified by type and hue, so it applies to all suitable objects, including those that appear later. After setting, enable dialing via SelectIgnoreList.

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.
  • type - Graphic/type of an item or body mobile. For example, 0x0EED is gold, 0x0191 is a female human body. Number or numeric string ("0x0EED", "3821"); -1/other negative/0xFFFF - any type. Values ​​greater than 65535 are not allowed. For multiple type add multiple rules.
  • color - Hue: 0 - uncolored only, 0x0044 - example of exact color; negative or 0xFFFF - any. Values ​​greater than 65535 are not allowed. In Add the default is 1. Type and hue within one rule are connected by an AND condition; different rules - OR.

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

  • Adds to the list specified by the FIRST argument, regardless of the currently selected list. Repeated numerically identical pairs are not duplicated.
  • 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.

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.AddIgnoreList");
UO.AddIgnoreList("simple_skip", 0x0EED);

1. Skip all stacks of gold when searching on the ground - direct script

Parameters and execution flow:

  • loot_skip — set name. The missing color means any hue. FindType returns the hex string ID or the empty string; here the result is stored under next_loot, and the item is not moved. Land search can also be found by mobile.
UO.AddIgnoreList("loot_skip", 0x0EED);
UO.SelectIgnoreList("loot_skip");
var item = UO.FindType(-1, -1, "ground");
if (Truth(item == ""))
{
    UO.Print("No unignored ground object found");
    return null;
}
UO.AddObject("next_loot", item);

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

2. Exclude only one color of the robe - script function

Parameters and execution flow:

  • 0x1F03 - graphic robe; 0x0044 is an example of a protected color. Robu of another hue search allows. This is protection from selection by filtering search, not from direct MoveItem by the known ID.
return  RunScenario();
 object? RunScenario()
{
    UO.AddIgnoreList("keep_colored", 0x1F03, 0x0044);
    UO.SelectIgnoreList("keep_colored");
    var robe = UO.FindType(0x1F03, -1, "backpack");
    if (Truth(robe != ""))
    {
        UO.AddObject("candidate_robe", robe);
    }

    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. Create two independent sets and include one - the script class

Parameters and execution flow:

  • Rules are stored in both lists. To exclude both gold and robes at the same time, add both type to the same list.
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.AddIgnoreList("skip_gold", 0x0EED);
        UO.AddIgnoreList("skip_robes", 0x1F03);
        UO.SelectIgnoreList("skip_gold");
        UO.SelectIgnoreList("skip_robes");
        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.AddIgnoreList(list, type) — UO.AddIgnoreList(Any,Any)

Parameters: list (Any), type (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "addignorelist":

                    state.IgnoreTypeLists.Add(Text(0), ResolveType(arguments[1]),

                        arguments.Length > 2 ? NumberConversions.ToInt(arguments[2]) : -1);

                    break;

UO.AddIgnoreList(list, type, color) — UO.AddIgnoreList(Any,Any,Any)

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

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "addignorelist":

                    state.IgnoreTypeLists.Add(Text(0), ResolveType(arguments[1]),

                        arguments.Length > 2 ? NumberConversions.ToInt(arguments[2]) : -1);

                    break;

UO.ClearBadLocationList

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

C# signatures

void UO.ClearBadLocationList();

Deletes all pairs saved by SetBadLocation.

Parameters

There are no parameters.

Return value

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

Behavior

  • Does not change the map, characters or obstacles on the server. Only the application runtime list is cleared.
  • The already received path array and the snapshot of the prohibitions of the running route are not changed. For a new result, repeat the path request or start the movement again. The list SetBadObject is cleared separately.

Standalone C# scripts

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

Simple example

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

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

1. Clear list - direct script

Parameters and execution flow:

  • There are no parameters.
  • There is no return value.
UO.ClearBadLocationList();

2. Start a new set of prohibitions - script function

Parameters and execution flow:

  • First, the previous pairs are deleted, then a new one is added.
  • This is not a physical obstacle or a change to the client card.
return  RunScenario();
 object? RunScenario()
{
    UO.ClearBadLocationList();
    UO.SetBadLocation(1445, 1690);
    return null;
}

3. Repeat calculation after cleaning - scenario class

Parameters and execution flow:

  • The goal is four cells to the east, Optimized=true, Accuracy=0.
  • An empty array after clearing may be due to a common obstruction or search limit.
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.ClearBadLocationList();
        var path = UO.GetPathArray(UO.GetX() + 4, UO.GetY(), true, 0);
        if (Truth(ArrayLength(path) == 0))
        {
            UO.Print("No complete path under current constraints");
        }

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

Parameters: No parameters.

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "clearbadlocationlist": state.BadLocations.Clear(); return InjectionValue.Unit;

UO.ClearBadObjectList

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

C# signatures

void UO.ClearBadObjectList();

Removes all type/hue/radius rules added by SetBadObject in the current runtime.

Parameters

There are no parameters.

Return value

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

Behavior

  • There are no parameters. Calling again when the list is empty is safe.
  • Does not cleanse SetBadLocation or remove natural obstructions. A new movement or path request uses the cleared list; the previously started route saves its own snapshot.

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

1. Reset Item Rules - Direct Script

Parameters and execution flow:

  • There are no arguments; the call is recorded on a separate line.
  • There is no true/false result and no number of rules removed.
UO.ClearBadObjectList();

2. Replace Rule Set - Script Function

Parameters and execution flow:

  • After clearing, only type=0x398C of any color is added.
  • Radius=2 excludes a 5×5 square around suitable items in the next route.
return  RunScenario();
 object? RunScenario()
{
    UO.ClearBadObjectList();
    UO.SetBadObject(0x398C, -1, 2);
    return null;
}

3. Recalculate path after complete reset of application prohibitions - script class

Parameters and execution flow:

  • The two lists are independent: both commands are called to reset both.
  • The three squares to the east are an example of a target. Map passability, altitude and search limit are preserved; an empty array is still a valid result.
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.ClearBadObjectList();
        UO.ClearBadLocationList();
        var path = UO.GetPathArray(UO.GetX() + 3, UO.GetY(), true, 0);
        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.ClearBadObjectList() — UO.ClearBadObjectList()

Parameters: No parameters.

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "clearbadobjectlist": state.BadObjects.Clear(); return InjectionValue.Unit;

UO.ClearFindList

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

C# signatures

void UO.ClearFindList();
void UO.ClearFindList(object? list);

Removes the definitions of one named search set or all sets AddFindList of the current runtime. Used before re-configuring filters to prevent rules from piling up.

Parameters

  • list — The name of the ruleset, for example "loot". Pass the string without the |: this character is used as a separator within the record. The name is not case sensitive. This is not a serial container or an array of found items. If the argument is missing, ALL definitions of AddFindList in this runtime are removed.

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

  • 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.
  • A non-existent name is safe: nothing is deleted. The command does not remove game items, clear Ignore, or cancel movement.

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

1. Re-configuring one set - direct script

Parameters and execution flow:

  • Inside BuildLoot only loot is cleared. Other named sets of this script are preserved.
BuildLoot();
BuildLoot();
UO.InfoFindList();

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

2. Replace seasonal set, keep spare - script function

Parameters and execution flow:

  • The SEASON register is not important. reserve remains; in season there is now only a new type/hue. After cleaning, the record is first added, then search by name is allowed.
return  RunScenario();
 object? RunScenario()
{
    UO.AddFindList("reserve", 0x0EED);
    UO.AddFindList("season", 0x0F7A);
    UO.ClearFindList("SEASON");
    UO.AddFindList("season", 0x0EED, 0x0044);
    UO.InfoFindList();
    return null;
}

3. Full reset before new script mode - script class

Parameters and execution flow:

  • ClearFindList() affects all definitions of the current runtime, so a self-named form is usually better for a library procedure.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        UO.AddFindList("old_loot", 0x0EED);
        UO.AddFindList("old_watch", 0x0190);
        UO.AddFindList("old_watch", 0x0191);
        UO.ClearFindList();
        UO.AddFindList("current", 0x0F7A, -1);
        var found = UO.FindList("current", "backpack");
        if (Truth(found != ""))
        {
            UO.AddObject("current_supply", 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.ClearFindList() — UO.ClearFindList()

Parameters: No parameters.

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "clearfindlist":

                    if (arguments.Length == 0) LegacyList("AddFindList").Clear();

                    else LegacyList("AddFindList").RemoveAll(value => value.Split('|')[0]

                        .Equals(Text(0), StringComparison.OrdinalIgnoreCase));

                    break;

UO.ClearFindList(list) — UO.ClearFindList(Any)

Parameters: list (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "clearfindlist":

                    if (arguments.Length == 0) LegacyList("AddFindList").Clear();

                    else LegacyList("AddFindList").RemoveAll(value => value.Split('|')[0]

                        .Equals(Text(0), StringComparison.OrdinalIgnoreCase));

                    break;

UO.ClearIgnoreList

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

C# signatures

void UO.ClearIgnoreList();
void UO.ClearIgnoreList(object? list);

Resets search exceptions. With a name - only one set of type/hue. Without arguments - all named sets and all serial added via Ignore. It is useful to start a new sort with clean rules.

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. Optional. Its absence means a general reset, not just the active list.

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

  • ClearIgnoreList("name") is equivalent in result to DeleteIgnoreList("name"). An empty string is not allowed here; to disable without deleting use SelectIgnoreList("").
  • 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.

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

1. Clear temporary set, keeping the rest - direct script

Parameters and execution flow:

  • Removed temporary, keep continues to exclude robes. The regular serial list is not cleared.
UO.AddIgnoreList("temporary", 0x0EED);
UO.AddIgnoreList("keep", 0x1F03);
UO.ClearIgnoreList("temporary");
UO.SelectIgnoreList("keep");

2. Start searching without previous exceptions - script function

Parameters and execution flow:

  • Without arguments, both types of exceptions are thrown. Old variables/arrays are not cleared. The new FindType regenerates the result.
return  RunScenario();
 object? RunScenario()
{
    UO.ClearIgnoreList();
    var item = UO.FindType(0x0EED, -1, "ground");
    if (Truth(item != ""))
    {
        UO.AddObject("fresh_gold", item);
    }

    return null;
}

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

3. Replace Set Contents - Script Class

Parameters and execution flow:

  • Old sorting rules have been removed before new ones are added: all gold and only the 0x0044 coloring on the robe. Between separate commands, another script may see an intermediate state.
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.ClearIgnoreList("sorting");
        UO.AddIgnoreList("sorting", 0x0EED);
        UO.AddIgnoreList("sorting", 0x1F03, 0x0044);
        UO.SelectIgnoreList("sorting");
        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.ClearIgnoreList() — UO.ClearIgnoreList()

Parameters: No parameters.

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "clearignorelist":

                    if (arguments.Length == 0)

                    {

                        IgnoreReset();

                        state.IgnoreTypeLists.Clear();

                    }

                    else

                        state.IgnoreTypeLists.Remove(Text(0));

                    break;

UO.ClearIgnoreList(list) — UO.ClearIgnoreList(Any)

Parameters: list (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "clearignorelist":

                    if (arguments.Length == 0)

                    {

                        IgnoreReset();

                        state.IgnoreTypeLists.Clear();

                    }

                    else

                        state.IgnoreTypeLists.Remove(Text(0));

                    break;

UO.Count

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

C# signatures

int UO.Count(object? @type);
int UO.Count(object? @type, object? color);
int UO.Count(object? @type, object? color, object? container);

Performs a search and summarizes the units of found items.

Parameters

  • type — Graphic/type of item (for example 0x0EED), not serial. -1 or 0xFFFF - any type.
  • color — Hue of the item; -1 or 0xFFFF - any color. In Count(type) and CountGround(type) the default is 1.
  • container - In Count(type,color,container): my or numeric -1 - all items whose root owner is self (including equipment and nested bags); backpack/serial — the contents of the specified container are recursive; UO.Ground(), explicit 0/"0", ground or 1 - items and Mobile on the ground. In CountEx the numeric -1 and 0xFFFFFFFF also mean ground, but the concrete serial only means direct content. CountEx takes backpack and names AddObject; unknown name causes script error. Check the resulting serial before calling: an explicit null selects the ground rather than the missing container.

Return value

int — sum max(1, Amount) of items found; Every Mobile adds 1. 0 no matches. This is the number of units, not the number of stacks. FindItem, FindCount, FindFullQuantity and GetFoundItems are updated at the same time.

Behavior

  • Count, with one or two arguments, looks for items owned by self, including equipment and nested bags. CountGround always searches for ground, including matching Mobile, but excluding self.
  • Count(type,color,serial) traverses nested bags, CountEx(type,color,serial) traverses direct contents only. Constraints FindDistance/FindVertical apply to land; Ignore applies to found objects.
  • The result depends on the contents of the containers already received. There is no automatic opening or server request for a complete inventory.

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

1. Calculate gold units - direct script

Parameters and execution flow:

  • type=0x0EED, color=-1. Area - backpack; consider the recursivity difference Count/CountEx.
  • One foot from 1000 dast units=1000, not 1.
var units = UO.Count(0x0EED, -1, "backpack");
UO.Print("Units: " + Convert.ToString(units));

2. Show Units and Number of Objects Separately - Script Function

Parameters and execution flow:

  • FindCount is read immediately after Count, before another search.
  • Two stacks of 50 yield 2 items and 100 units.
return  RunScenario();
 object? RunScenario()
{
    var units = UO.Count(0x0EED, -1, "backpack");
    var items = UO.FindCount();
    UO.Print(Convert.ToString(items) + " items, " + Convert.ToString(units) + " units");
    return null;
}

3. Continue only if there is enough quantity - scenario class

Parameters and execution flow:

  • 100 is the units threshold in this example.
  • This is a snapshot check, not a reservation of items. Quantities may change between review and transfer.
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 units = UO.Count(0x0EED, -1, "backpack");
        if (Truth(units >= 100))
        {
            UO.Print("Enough units known to the client");
        }
        else
        {
            UO.Print("Not enough known units");
        }

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

Parameters: type (Any)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int Count(InjectionValue type) 

            => Count(ResolveType(type), -1, -1);

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

Parameters: type (Any), color (Any)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int Count(InjectionValue type, InjectionValue color) 

            => Count(ResolveType(type), NumberConversions.ToInt(color), 0);

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

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

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int Count(InjectionValue type, InjectionValue color, InjectionValue container)

            => Count(ResolveType(type), NumberConversions.ToInt(color), ConvertContainer(container));

UO.CountEx

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

C# signatures

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

Performs a search and summarizes the units of found items.

Parameters

  • objType — Graphic/type of item (for example 0x0EED), not serial. -1 or 0xFFFF - any type.
  • color — Hue of the item; -1 or 0xFFFF - any color. In Count(type) and CountGround(type) the default is 1.
  • container - In Count(type,color,container): my or numeric -1 - all items whose root owner is self (including equipment and nested bags); backpack/serial — the contents of the specified container are recursive; UO.Ground(), explicit 0/"0", ground or 1 - items and Mobile on the ground. In CountEx the numeric -1 and 0xFFFFFFFF also mean ground, but the concrete serial only means direct content. CountEx takes backpack and names AddObject; unknown name causes script error. Check the resulting serial before calling: an explicit null selects the ground rather than the missing container.

Return value

int — sum max(1, Amount) of items found; Every Mobile adds 1. 0 no matches. This is the number of units, not the number of stacks. FindItem, FindCount, FindFullQuantity and GetFoundItems are updated at the same time.

Behavior

  • Count, with one or two arguments, looks for items owned by self, including equipment and nested bags. CountGround always searches for ground, including matching Mobile, but excluding self.
  • Count(type,color,serial) traverses nested bags, CountEx(type,color,serial) traverses direct contents only. Constraints FindDistance/FindVertical apply to land; Ignore applies to found objects.
  • The result depends on the contents of the containers already received. There is no automatic opening or server request for a complete inventory.

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

1. Calculate gold units - direct script

Parameters and execution flow:

  • type=0x0EED, color=-1. Area - backpack; consider the recursivity difference Count/CountEx.
  • One foot from 1000 dast units=1000, not 1.
var units = UO.CountEx(0x0EED, -1, "backpack");
UO.Print("Units: " + Convert.ToString(units));

2. Show Units and Number of Objects Separately - Script Function

Parameters and execution flow:

  • FindCount is read immediately after Count, before another search.
  • Two stacks of 50 yield 2 items and 100 units.
return  RunScenario();
 object? RunScenario()
{
    var units = UO.CountEx(0x0EED, -1, "backpack");
    var items = UO.FindCount();
    UO.Print(Convert.ToString(items) + " items, " + Convert.ToString(units) + " units");
    return null;
}

3. Continue only if there is enough quantity - scenario class

Parameters and execution flow:

  • 100 is the units threshold in this example.
  • This is a snapshot check, not a reservation of items. Quantities may change between review and transfer.
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 units = UO.CountEx(0x0EED, -1, "backpack");
        if (Truth(units >= 100))
        {
            UO.Print("Enough units known to the client");
        }
        else
        {
            UO.Print("Not enough known units");
        }

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

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

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

case "countex":

                    bridge.FindType(ResolveType(arguments[0]), Arg(1), StealthContainer(2), -1, false);

                    return new InjectionValue(bridge.FindFullQuantity());

UO.CountGround

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

C# signatures

int UO.CountGround(object? @type);
int UO.CountGround(object? @type, object? color);

Performs a search and summarizes the units of found items.

Parameters

  • type — Graphic/type of item (for example 0x0EED), not serial. -1 or 0xFFFF - any type.
  • color — Hue of the item; -1 or 0xFFFF - any color. In Count(type) and CountGround(type) the default is 1.

Return value

int — sum max(1, Amount) of items found; Every Mobile adds 1. 0 no matches. This is the number of units, not the number of stacks. FindItem, FindCount, FindFullQuantity and GetFoundItems are updated at the same time.

Behavior

  • Count, with one or two arguments, looks for items owned by self, including equipment and nested bags. CountGround always searches for ground, including matching Mobile, but excluding self.
  • Count(type,color,serial) traverses nested bags, CountEx(type,color,serial) traverses direct contents only. Constraints FindDistance/FindVertical apply to land; Ignore applies to found objects.
  • The result depends on the contents of the containers already received. There is no automatic opening or server request for a complete inventory.

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

1. Calculate gold units - direct script

Parameters and execution flow:

  • type=0x0EED, color=-1. Area is the land next to the character.
  • One foot from 1000 dast units=1000, not 1.
var units = UO.CountGround(0x0EED, -1);
UO.Print("Units: " + Convert.ToString(units));

2. Show Units and Number of Objects Separately - Script Function

Parameters and execution flow:

  • FindCount is read immediately after Count, before another search.
  • Two stacks of 50 yield 2 items and 100 units.
return  RunScenario();
 object? RunScenario()
{
    var units = UO.CountGround(0x0EED, -1);
    var items = UO.FindCount();
    UO.Print(Convert.ToString(items) + " items, " + Convert.ToString(units) + " units");
    return null;
}

3. Continue only if there is enough quantity - scenario class

Parameters and execution flow:

  • 100 is the units threshold in this example.
  • This is a snapshot check, not a reservation of items. Quantities may change between review and transfer.
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 units = UO.CountGround(0x0EED, -1);
        if (Truth(units >= 100))
        {
            UO.Print("Enough units known to the client");
        }
        else
        {
            UO.Print("Not enough known units");
        }

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

Parameters: type (Any)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int CountGround(InjectionValue type)

            => CountGround(type, new InjectionValue(-1));

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

Parameters: type (Any), color (Any)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int CountGround(InjectionValue type, InjectionValue color)

            => bridge.Count(ResolveType(type), NumberConversions.ToInt(color), 1);

UO.DeleteFindList

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

C# signatures

void UO.DeleteFindList(object? list);
void UO.DeleteFindList(object? list, object? @type);
void UO.DeleteFindList(object? list, object? @type, object? color);

Removes all definitions that match the specified list, list/type, or list/type/color prefix. Allows you to remove one type of item or a specific hue, while maintaining the rest of the set rules.

Parameters

  • list — The name of the ruleset, for example "loot". Pass the string without the |: this character is used as a separator within the record. The name is not case sensitive. This is not a serial container or an array of found items.
  • type — Graphic/type of the item or body mobile, not its serial. Typically int 0..65535, including 0x0EED; -1 or 0xFFFF means any type when searching. Provide one value per entry. Several types are added by separate calls. To delete, the field text is compared; skipping deletes all name entries.
  • color — Hue of an object/body, not RGB. int 0..65535; 0 - regular hue 0, -1 or 0xFFFF - any. In AddFindList, skipping color means any hue when searching. For deletion, this is a literal field, not a wildcard: -1 only deletes entries with -1 explicitly stored. Omitting color removes all list/type entries regardless of hue.

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

  • 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.
  • DeleteFindList(list,type,-1) does not delete the two-parameter record AddFindList(list,type): it does not have a third field. Matched duplicates are all deleted; a non-existent match doesn't change anything.

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.AddFindList("simple_loot", 0x0EED);
UO.Print("Calling UO.DeleteFindList");
UO.DeleteFindList("simple_loot");

1. Exclude all colors of the same type - direct script

Parameters and execution flow:

  • Two arguments remove both gold entries: any hue and hue 0x0044.
UO.ClearFindList("loot");
UO.AddFindList("loot", 0x0EED, -1);
UO.AddFindList("loot", 0x0EED, 0x0044);
UO.AddFindList("loot", 0x0F7A);
UO.DeleteFindList("loot", 0x0EED);
var found = UO.FindList("loot", "backpack");
if (Truth(found != ""))
{
    UO.AddObject("remaining_supply", found);
}

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

2. Remove only one hue - script function

Parameters and execution flow:

  • Three arguments: colors, graphic gold, specific hue. All that remains is hue 0. In other sets this graphic is not removed.
return  RunScenario();
 object? RunScenario()
{
    UO.ClearFindList("colors");
    UO.AddFindList("colors", 0x0EED, 0);
    UO.AddFindList("colors", 0x0EED, 0x0044);
    UO.DeleteFindList("colors", 0x0EED, 0x0044);
    UO.InfoFindList();
    return null;
}

3. Remove Entire Set and Create a Replacement - Script Class

Parameters and execution flow:

  • One argument removes all old entries. If the rules were specified by the line "0x0190", delete them with the same line or delete the set by name.
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.AddFindList("old", 0x0190);
        UO.AddFindList("old", 0x0191);
        UO.DeleteFindList("OLD");
        UO.AddFindList("new_watch", 0x0190, -1);
        UO.AddFindList("new_watch", 0x0191, -1);
        UO.InfoFindList();
        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.DeleteFindList(list) — UO.DeleteFindList(Any)

Parameters: list (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "deletefindlist":

                    LegacyList("AddFindList").RemoveAll(value => LegacyListEntryMatches(value,

                        arguments));

                    break;

UO.DeleteFindList(list, type) — UO.DeleteFindList(Any,Any)

Parameters: list (Any), type (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "deletefindlist":

                    LegacyList("AddFindList").RemoveAll(value => LegacyListEntryMatches(value,

                        arguments));

                    break;

UO.DeleteFindList(list, type, color) — UO.DeleteFindList(Any,Any,Any)

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

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "deletefindlist":

                    LegacyList("AddFindList").RemoveAll(value => LegacyListEntryMatches(value,

                        arguments));

                    break;

UO.DeleteIgnoreList

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

C# signatures

void UO.DeleteIgnoreList(object? list);
void UO.DeleteIgnoreList(object? list, object? @type);
void UO.DeleteIgnoreList(object? list, object? @type, object? color);

Removes the entire named filter or selected rules within it. Use when a certain type or hue needs to be allowed back into the search, while keeping other exceptions.

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.
  • type - Graphic/type of an item or body mobile. For example, 0x0EED is gold, 0x0191 is a female human body. Number or numeric string ("0x0EED", "3821"); -1/other negative/0xFFFF - any type. Values ​​greater than 65535 are not allowed. For multiple type add multiple rules. If not transferred, delete the entire list; if passed without color, all the rules are exactly this type.
  • color - Hue: 0 - uncolored only, 0x0044 - example of exact color; negative or 0xFFFF - any. Values ​​greater than 65535 are not allowed. In Add the default is 1. Type and hue within one rule are connected by an AND condition; different rules - OR. When deleting, sets the exact rule mask; -1 removes the "any color" rule rather than all individual colors.

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

  • The number 3821 and the string "0x0EED" indicate one type. Deleting a non-existent rule does not change anything. The name of the selected list is retained even if the list itself is deleted; it becomes empty.
  • 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.

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.AddIgnoreList("simple_skip", 0x0EED);
UO.Print("Calling UO.DeleteIgnoreList");
UO.DeleteIgnoreList("simple_skip");

1. Delete entire set - direct script

Parameters and execution flow:

  • Only temporary is deleted. Other lists and Ignore(serial) are preserved.
UO.AddIgnoreList("temporary", 0x0EED);
UO.SelectIgnoreList("temporary");
UO.DeleteIgnoreList("temporary");
var gold = UO.FindType(0x0EED, -1, "ground");

2. Allow all colorings of the same type - script function

Parameters and execution flow:

  • Both robe rules have been removed, but the gold rule remains. The general rule -1,type-any of another type, if added, is not deleted itself.
return  RunScenario();
 object? RunScenario()
{
    UO.AddIgnoreList("sort", 0x1F03, 0);
    UO.AddIgnoreList("sort", 0x1F03, 0x0044);
    UO.AddIgnoreList("sort", 0x0EED);
    UO.DeleteIgnoreList("sort", 0x1F03);
    UO.SelectIgnoreList("sort");
    return null;
}

3. Remove Exact Color Rule Only - Script Class

Parameters and execution flow:

  • 68 = 0x0044: the number forms are the same. Undyed robes remain excluded. If there is also a rule of this type with hue=-1, it will continue to exclude the color 68.
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.AddIgnoreList("robes", 0x1F03, 0);
        UO.AddIgnoreList("robes", 0x1F03, 0x0044);
        UO.DeleteIgnoreList("robes", "0x1F03", 68);
        UO.SelectIgnoreList("robes");
        var robe = UO.FindType(0x1F03, 0x0044, "backpack");
        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.DeleteIgnoreList(list) — UO.DeleteIgnoreList(Any)

Parameters: list (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "deleteignorelist":

                    state.IgnoreTypeLists.Remove(Text(0), arguments.Length > 1 ? ResolveType(arguments[1]) : (int?)null,

                        arguments.Length > 2 ? NumberConversions.ToInt(arguments[2]) : (int?)null);

                    break;

UO.DeleteIgnoreList(list, type) — UO.DeleteIgnoreList(Any,Any)

Parameters: list (Any), type (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "deleteignorelist":

                    state.IgnoreTypeLists.Remove(Text(0), arguments.Length > 1 ? ResolveType(arguments[1]) : (int?)null,

                        arguments.Length > 2 ? NumberConversions.ToInt(arguments[2]) : (int?)null);

                    break;

UO.DeleteIgnoreList(list, type, color) — UO.DeleteIgnoreList(Any,Any,Any)

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

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "deleteignorelist":

                    state.IgnoreTypeLists.Remove(Text(0), arguments.Length > 1 ? ResolveType(arguments[1]) : (int?)null,

                        arguments.Length > 2 ? NumberConversions.ToInt(arguments[2]) : (int?)null);

                    break;

UO.FindAnyType

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

C# signatures

int UO.FindAnyType(object? distance, object? @type);
int UO.FindAnyType(object? distance, object? @type, object? type2);
int UO.FindAnyType(object? distance, object? @type, object? type2, object? type3);
int UO.FindAnyType(object? distance, object? @type, object? type2, object? type3, object? type4);
int UO.FindAnyType(object? distance, object? @type, object? type2, object? type3, object? type4, object? type5);
int UO.FindAnyType(object? distance, object? @type, object? type2, object? type3, object? type4, object? type5, object? type6);
int UO.FindAnyType(object? distance, object? @type, object? type2, object? type3, object? type4, object? type5, object? type6, object? type7);
int UO.FindAnyType(object? distance, object? @type, object? type2, object? type3, object? type4, object? type5, object? type6, object? type7, object? type8);
int UO.FindAnyType(object? distance, object? @type, object? type2, object? type3, object? type4, object? type5, object? type6, object? type7, object? type8, object? type9);
int UO.FindAnyType(object? distance, object? @type, object? type2, object? type3, object? type4, object? type5, object? type6, object? type7, object? type8, object? type9, object? type10);
int UO.FindAnyType(object? distance, object? @type, object? type2, object? type3, object? type4, object? type5, object? type6, object? type7, object? type8, object? type9, object? type10, object? type11);
int UO.FindAnyType(object? distance, object? @type, object? type2, object? type3, object? type4, object? type5, object? type6, object? type7, object? type8, object? type9, object? type10, object? type11, object? type12);
int UO.FindAnyType(object? distance, object? @type, object? type2, object? type3, object? type4, object? type5, object? type6, object? type7, object? type8, object? type9, object? type10, object? type11, object? type12, object? type13);
int UO.FindAnyType(object? distance, object? @type, object? type2, object? type3, object? type4, object? type5, object? type6, object? type7, object? type8, object? type9, object? type10, object? type11, object? type12, object? type13, object? type14);
int UO.FindAnyType(object? distance, object? @type, object? type2, object? type3, object? type4, object? type5, object? type6, object? type7, object? type8, object? type9, object? type10, object? type11, object? type12, object? type13, object? type14, object? type15);
int UO.FindAnyType(object? distance, object? @type, object? type2, object? type3, object? type4, object? type5, object? type6, object? type7, object? type8, object? type9, object? type10, object? type11, object? type12, object? type13, object? type14, object? type15, object? type16);
int UO.FindAnyType(object? distance, object? @type, object? type2, object? type3, object? type4, object? type5, object? type6, object? type7, object? type8, object? type9, object? type10, object? type11, object? type12, object? type13, object? type14, object? type15, object? type16, object? type17);
int UO.FindAnyType(object? distance, object? @type, object? type2, object? type3, object? type4, object? type5, object? type6, object? type7, object? type8, object? type9, object? type10, object? type11, object? type12, object? type13, object? type14, object? type15, object? type16, object? type17, object? type18);
int UO.FindAnyType(object? distance, object? @type, object? type2, object? type3, object? type4, object? type5, object? type6, object? type7, object? type8, object? type9, object? type10, object? type11, object? type12, object? type13, object? type14, object? type15, object? type16, object? type17, object? type18, object? type19);
int UO.FindAnyType(object? distance, object? @type, object? type2, object? type3, object? type4, object? type5, object? type6, object? type7, object? type8, object? type9, object? type10, object? type11, object? type12, object? type13, object? type14, object? type15, object? type16, object? type17, object? type18, object? type19, object? type20);
int UO.FindAnyType(object? distance, object? @type, object? type2, object? type3, object? type4, object? type5, object? type6, object? type7, object? type8, object? type9, object? type10, object? type11, object? type12, object? type13, object? type14, object? type15, object? type16, object? type17, object? type18, object? type19, object? type20, object? type21);
int UO.FindAnyType(object? distance, object? @type, object? type2, object? type3, object? type4, object? type5, object? type6, object? type7, object? type8, object? type9, object? type10, object? type11, object? type12, object? type13, object? type14, object? type15, object? type16, object? type17, object? type18, object? type19, object? type20, object? type21, object? type22);
int UO.FindAnyType(object? distance, object? @type, object? type2, object? type3, object? type4, object? type5, object? type6, object? type7, object? type8, object? type9, object? type10, object? type11, object? type12, object? type13, object? type14, object? type15, object? type16, object? type17, object? type18, object? type19, object? type20, object? type21, object? type22, object? type23);
int UO.FindAnyType(object? distance, object? @type, object? type2, object? type3, object? type4, object? type5, object? type6, object? type7, object? type8, object? type9, object? type10, object? type11, object? type12, object? type13, object? type14, object? type15, object? type16, object? type17, object? type18, object? type19, object? type20, object? type21, object? type22, object? type23, object? type24);
int UO.FindAnyType(object? distance, object? @type, object? type2, object? type3, object? type4, object? type5, object? type6, object? type7, object? type8, object? type9, object? type10, object? type11, object? type12, object? type13, object? type14, object? type15, object? type16, object? type17, object? type18, object? type19, object? type20, object? type21, object? type22, object? type23, object? type24, object? type25);
int UO.FindAnyType(object? distance, object? @type, object? type2, object? type3, object? type4, object? type5, object? type6, object? type7, object? type8, object? type9, object? type10, object? type11, object? type12, object? type13, object? type14, object? type15, object? type16, object? type17, object? type18, object? type19, object? type20, object? type21, object? type22, object? type23, object? type24, object? type25, object? type26);
int UO.FindAnyType(object? distance, object? @type, object? type2, object? type3, object? type4, object? type5, object? type6, object? type7, object? type8, object? type9, object? type10, object? type11, object? type12, object? type13, object? type14, object? type15, object? type16, object? type17, object? type18, object? type19, object? type20, object? type21, object? type22, object? type23, object? type24, object? type25, object? type26, object? type27);
int UO.FindAnyType(object? distance, object? @type, object? type2, object? type3, object? type4, object? type5, object? type6, object? type7, object? type8, object? type9, object? type10, object? type11, object? type12, object? type13, object? type14, object? type15, object? type16, object? type17, object? type18, object? type19, object? type20, object? type21, object? type22, object? type23, object? type24, object? type25, object? type26, object? type27, object? type28);
int UO.FindAnyType(object? distance, object? @type, object? type2, object? type3, object? type4, object? type5, object? type6, object? type7, object? type8, object? type9, object? type10, object? type11, object? type12, object? type13, object? type14, object? type15, object? type16, object? type17, object? type18, object? type19, object? type20, object? type21, object? type22, object? type23, object? type24, object? type25, object? type26, object? type27, object? type28, object? type29);
int UO.FindAnyType(object? distance, object? @type, object? type2, object? type3, object? type4, object? type5, object? type6, object? type7, object? type8, object? type9, object? type10, object? type11, object? type12, object? type13, object? type14, object? type15, object? type16, object? type17, object? type18, object? type19, object? type20, object? type21, object? type22, object? type23, object? type24, object? type25, object? type26, object? type27, object? type28, object? type29, object? type30);
int UO.FindAnyType(object? distance, object? @type, object? type2, object? type3, object? type4, object? type5, object? type6, object? type7, object? type8, object? type9, object? type10, object? type11, object? type12, object? type13, object? type14, object? type15, object? type16, object? type17, object? type18, object? type19, object? type20, object? type21, object? type22, object? type23, object? type24, object? type25, object? type26, object? type27, object? type28, object? type29, object? type30, object? type31);

Finds the nearest loaded mobile with one of the given body graphic. Used to search for a specific type of creature. This command does not look for items in the chest or on the ground: they require FindType/FindList.

Parameters

  • 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.
  • type - Graphic body mobile, not serial and not graphic item. Number 0..65534 or hex string, for example 0x003B. Multiple values ​​are combined as OR: a number 5, a 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.
  • type2 — Optional additional mask type; the same forms as type. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • type3 — Optional additional mask type; the same forms as type. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • type4 — Optional additional mask type; the same forms as type. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • type5 — Optional additional mask type; the same forms as type. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • type6 — Optional additional mask type; the same forms as type. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • type7 — Optional additional mask type; the same forms as type. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • type8 — Optional additional mask type; the same forms as type. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • type9 — Optional additional mask type; the same forms as type. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • type10 — Optional additional mask type; the same forms as type. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • type11 — Optional additional mask type; the same forms as type. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • type12 — Optional additional mask type; the same forms as type. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • type13 — Optional additional mask type; the same forms as type. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • type14 — Optional additional mask type; the same forms as type. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • type15 — Optional additional mask type; the same forms as type. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • type16 — Optional additional mask type; the same forms as type. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • type17 — Optional additional mask type; the same forms as type. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • type18 — Optional additional mask type; the same forms as type. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • type19 — Optional additional mask type; the same forms as type. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • type20 — Optional additional mask type; the same forms as type. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • type21 — Optional additional mask type; the same forms as type. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • type22 — Optional additional mask type; the same forms as type. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • type23 — Optional additional mask type; the same forms as type. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • type24 — Optional additional mask type; the same forms as type. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • type25 — Optional additional mask type; the same forms as type. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • type26 — Optional additional mask type; the same forms as type. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • type27 — Optional additional mask type; the same forms as type. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • type28 — Optional additional mask type; the same forms as type. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • type29 — Optional additional mask type; the same forms as type. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • type30 — Optional additional mask type; the same forms as type. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • type31 — Optional additional mask type; the same forms as type. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.

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.
  • Does not change FindItem, FindCount or GetFoundItems. These fields may contain the results of a previous other command: use the returned ID directly.
  • From 2 to 32 arguments: distance and to 31 mask type. A flat array allows you to pass more values. Each subsequent value after type is still body/type, not hue or notoriety.
  • This command does not have a Z filter, notoriety, player race or clothing class. Self is NOT excluded: if your own graphic is included in the mask and self is not in Ignore, you can get your serial at a distance 0.
  • Selects the closest one; equal distance is allowed by smaller serial. -1/any/0xFFFF/an empty mask with no explicit types gives 0: The command requires at least one explicit type. Near specific type wildcards are ignored.

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.FindAnyType(10, 0x003B);
UO.Print("FindAnyType: " + Convert.ToString(result));

1. Save the nearest creature of the desired type - direct script

Parameters and execution flow:

  • 0x003B - body, not ID. Return creature - ID specific found mobile. The team does not check for Z, health or aggressiveness.
var creature = UO.FindAnyType(10, 0x003B);
if (Truth(creature != 0))
{
    UO.AddObject("creature", creature);
    UO.Print("Distance: " + Convert.ToString(UO.GetDistance(creature)));
}

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

2. Array of Views and Additional View - Script Function

Parameters and execution flow:

  • bodies and separate 0x000C are combined. If self is found, this example will simply skip the action; he is not looking for the next candidate. To exclude self in the request itself, use the appropriate filter GetMobiles.
return  RunScenario();
 object? RunScenario()
{
    dynamic[] bodies = new dynamic[checked((int)(0) + 1)];
    bodies[0] = 0x003B;
    var creature = UO.FindAnyType(18, bodies, 0x000C);
    if (Truth(creature != 0) && Truth(creature != Asc(UO.GetSerial("self"), 0)))
    {
        UO.AddObject("observed_creature", creature);
    }

    return null;
}

int Asc(object? value, int fallback = 0)
{
    string text = Convert.ToString(value) ?? "";
    if (text.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
        return int.TryParse(text[2..], System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture, out int hex) ? hex : fallback;
    return int.TryParse(text, out int number) ? number : fallback;
}

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

3. Return distance to nearest desired view - script class

Parameters and execution flow:

  • body - graphic, radius - X/Y search limit. The helper returns the distance or its own code -1; UO.FindAnyType itself returns serial or 0.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        var distance = DistanceToBody(0x003B, 8);
        if (Truth(distance >= 0) && Truth(distance <= 3))
        {
            UO.Print("Creature is within three cells");
        }

        return null;
    }

    dynamic DistanceToBody(dynamic body, dynamic radius)
    {
        var found = UO.FindAnyType(radius, body);
        if (Truth(found == 0))
        {
            return -1;
        }

        return UO.GetDistance(found);
    }

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

Parameters: distance (Any), type (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAnyType(distance, type, type2) — UO.FindAnyType(Any,Any,Any)

Parameters: distance (Any), type (Any), type2 (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAnyType(distance, type, type2, type3) — UO.FindAnyType(Any,Any,Any,Any)

Parameters: distance (Any), type (Any), type2 (Any), type3 (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAnyType(distance, type, type2, type3, type4) — UO.FindAnyType(Any,Any,Any,Any,Any)

Parameters: distance (Any), type (Any), type2 (Any), type3 (Any), type4 (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAnyType(distance, type, type2, type3, type4, type5) — UO.FindAnyType(Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), type (Any), type2 (Any), type3 (Any), type4 (Any), type5 (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAnyType(distance, type, type2, type3, type4, type5, type6) — UO.FindAnyType(Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), type (Any), type2 (Any), type3 (Any), type4 (Any), type5 (Any), type6 (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAnyType(distance, type, type2, type3, type4, type5, type6, type7) — UO.FindAnyType(Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), type (Any), type2 (Any), type3 (Any), type4 (Any), type5 (Any), type6 (Any), type7 (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAnyType(distance, type, type2, type3, type4, type5, type6, type7, type8) — UO.FindAnyType(Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), type (Any), type2 (Any), type3 (Any), type4 (Any), type5 (Any), type6 (Any), type7 (Any), type8 (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAnyType(distance, type, type2, type3, type4, type5, type6, type7, type8, type9) — UO.FindAnyType(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), type (Any), type2 (Any), type3 (Any), type4 (Any), type5 (Any), type6 (Any), type7 (Any), type8 (Any), type9 (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAnyType(distance, type, type2, type3, type4, type5, type6, type7, type8, type9, type10) — UO.FindAnyType(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), type (Any), type2 (Any), type3 (Any), type4 (Any), type5 (Any), type6 (Any), type7 (Any), type8 (Any), type9 (Any), type10 (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAnyType(distance, type, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11) — UO.FindAnyType(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), type (Any), type2 (Any), type3 (Any), type4 (Any), type5 (Any), type6 (Any), type7 (Any), type8 (Any), type9 (Any), type10 (Any), type11 (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAnyType(distance, type, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12) — UO.FindAnyType(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), type (Any), type2 (Any), type3 (Any), type4 (Any), type5 (Any), type6 (Any), type7 (Any), type8 (Any), type9 (Any), type10 (Any), type11 (Any), type12 (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAnyType(distance, type, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13) — UO.FindAnyType(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), type (Any), type2 (Any), type3 (Any), type4 (Any), type5 (Any), type6 (Any), type7 (Any), type8 (Any), type9 (Any), type10 (Any), type11 (Any), type12 (Any), type13 (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAnyType(distance, type, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13, type14) — UO.FindAnyType(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), type (Any), type2 (Any), type3 (Any), type4 (Any), type5 (Any), type6 (Any), type7 (Any), type8 (Any), type9 (Any), type10 (Any), type11 (Any), type12 (Any), type13 (Any), type14 (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAnyType(distance, type, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13, type14, type15) — UO.FindAnyType(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), type (Any), type2 (Any), type3 (Any), type4 (Any), type5 (Any), type6 (Any), type7 (Any), type8 (Any), type9 (Any), type10 (Any), type11 (Any), type12 (Any), type13 (Any), type14 (Any), type15 (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAnyType(distance, type, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13, type14, type15, type16) — UO.FindAnyType(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), type (Any), type2 (Any), type3 (Any), type4 (Any), type5 (Any), type6 (Any), type7 (Any), type8 (Any), type9 (Any), type10 (Any), type11 (Any), type12 (Any), type13 (Any), type14 (Any), type15 (Any), type16 (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAnyType(distance, type, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13, type14, type15, type16, type17) — UO.FindAnyType(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), type (Any), type2 (Any), type3 (Any), type4 (Any), type5 (Any), type6 (Any), type7 (Any), type8 (Any), type9 (Any), type10 (Any), type11 (Any), type12 (Any), type13 (Any), type14 (Any), type15 (Any), type16 (Any), type17 (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAnyType(distance, type, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13, type14, type15, type16, type17, type18) — UO.FindAnyType(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), type (Any), type2 (Any), type3 (Any), type4 (Any), type5 (Any), type6 (Any), type7 (Any), type8 (Any), type9 (Any), type10 (Any), type11 (Any), type12 (Any), type13 (Any), type14 (Any), type15 (Any), type16 (Any), type17 (Any), type18 (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAnyType(distance, type, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13, type14, type15, type16, type17, type18, type19) — UO.FindAnyType(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), type (Any), type2 (Any), type3 (Any), type4 (Any), type5 (Any), type6 (Any), type7 (Any), type8 (Any), type9 (Any), type10 (Any), type11 (Any), type12 (Any), type13 (Any), type14 (Any), type15 (Any), type16 (Any), type17 (Any), type18 (Any), type19 (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAnyType(distance, type, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13, type14, type15, type16, type17, type18, type19, type20) — UO.FindAnyType(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), type (Any), type2 (Any), type3 (Any), type4 (Any), type5 (Any), type6 (Any), type7 (Any), type8 (Any), type9 (Any), type10 (Any), type11 (Any), type12 (Any), type13 (Any), type14 (Any), type15 (Any), type16 (Any), type17 (Any), type18 (Any), type19 (Any), type20 (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAnyType(distance, type, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13, type14, type15, type16, type17, type18, type19, type20, type21) — UO.FindAnyType(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), type (Any), type2 (Any), type3 (Any), type4 (Any), type5 (Any), type6 (Any), type7 (Any), type8 (Any), type9 (Any), type10 (Any), type11 (Any), type12 (Any), type13 (Any), type14 (Any), type15 (Any), type16 (Any), type17 (Any), type18 (Any), type19 (Any), type20 (Any), type21 (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAnyType(distance, type, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13, type14, type15, type16, type17, type18, type19, type20, type21, type22) — UO.FindAnyType(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), type (Any), type2 (Any), type3 (Any), type4 (Any), type5 (Any), type6 (Any), type7 (Any), type8 (Any), type9 (Any), type10 (Any), type11 (Any), type12 (Any), type13 (Any), type14 (Any), type15 (Any), type16 (Any), type17 (Any), type18 (Any), type19 (Any), type20 (Any), type21 (Any), type22 (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAnyType(distance, type, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13, type14, type15, type16, type17, type18, type19, type20, type21, type22, type23) — UO.FindAnyType(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), type (Any), type2 (Any), type3 (Any), type4 (Any), type5 (Any), type6 (Any), type7 (Any), type8 (Any), type9 (Any), type10 (Any), type11 (Any), type12 (Any), type13 (Any), type14 (Any), type15 (Any), type16 (Any), type17 (Any), type18 (Any), type19 (Any), type20 (Any), type21 (Any), type22 (Any), type23 (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAnyType(distance, type, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13, type14, type15, type16, type17, type18, type19, type20, type21, type22, type23, type24) — UO.FindAnyType(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), type (Any), type2 (Any), type3 (Any), type4 (Any), type5 (Any), type6 (Any), type7 (Any), type8 (Any), type9 (Any), type10 (Any), type11 (Any), type12 (Any), type13 (Any), type14 (Any), type15 (Any), type16 (Any), type17 (Any), type18 (Any), type19 (Any), type20 (Any), type21 (Any), type22 (Any), type23 (Any), type24 (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAnyType(distance, type, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13, type14, type15, type16, type17, type18, type19, type20, type21, type22, type23, type24, type25) — UO.FindAnyType(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), type (Any), type2 (Any), type3 (Any), type4 (Any), type5 (Any), type6 (Any), type7 (Any), type8 (Any), type9 (Any), type10 (Any), type11 (Any), type12 (Any), type13 (Any), type14 (Any), type15 (Any), type16 (Any), type17 (Any), type18 (Any), type19 (Any), type20 (Any), type21 (Any), type22 (Any), type23 (Any), type24 (Any), type25 (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAnyType(distance, type, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13, type14, type15, type16, type17, type18, type19, type20, type21, type22, type23, type24, type25, type26) — UO.FindAnyType(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), type (Any), type2 (Any), type3 (Any), type4 (Any), type5 (Any), type6 (Any), type7 (Any), type8 (Any), type9 (Any), type10 (Any), type11 (Any), type12 (Any), type13 (Any), type14 (Any), type15 (Any), type16 (Any), type17 (Any), type18 (Any), type19 (Any), type20 (Any), type21 (Any), type22 (Any), type23 (Any), type24 (Any), type25 (Any), type26 (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAnyType(distance, type, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13, type14, type15, type16, type17, type18, type19, type20, type21, type22, type23, type24, type25, type26, type27) — UO.FindAnyType(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), type (Any), type2 (Any), type3 (Any), type4 (Any), type5 (Any), type6 (Any), type7 (Any), type8 (Any), type9 (Any), type10 (Any), type11 (Any), type12 (Any), type13 (Any), type14 (Any), type15 (Any), type16 (Any), type17 (Any), type18 (Any), type19 (Any), type20 (Any), type21 (Any), type22 (Any), type23 (Any), type24 (Any), type25 (Any), type26 (Any), type27 (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAnyType(distance, type, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13, type14, type15, type16, type17, type18, type19, type20, type21, type22, type23, type24, type25, type26, type27, type28) — UO.FindAnyType(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), type (Any), type2 (Any), type3 (Any), type4 (Any), type5 (Any), type6 (Any), type7 (Any), type8 (Any), type9 (Any), type10 (Any), type11 (Any), type12 (Any), type13 (Any), type14 (Any), type15 (Any), type16 (Any), type17 (Any), type18 (Any), type19 (Any), type20 (Any), type21 (Any), type22 (Any), type23 (Any), type24 (Any), type25 (Any), type26 (Any), type27 (Any), type28 (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAnyType(distance, type, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13, type14, type15, type16, type17, type18, type19, type20, type21, type22, type23, type24, type25, type26, type27, type28, type29) — UO.FindAnyType(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), type (Any), type2 (Any), type3 (Any), type4 (Any), type5 (Any), type6 (Any), type7 (Any), type8 (Any), type9 (Any), type10 (Any), type11 (Any), type12 (Any), type13 (Any), type14 (Any), type15 (Any), type16 (Any), type17 (Any), type18 (Any), type19 (Any), type20 (Any), type21 (Any), type22 (Any), type23 (Any), type24 (Any), type25 (Any), type26 (Any), type27 (Any), type28 (Any), type29 (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAnyType(distance, type, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13, type14, type15, type16, type17, type18, type19, type20, type21, type22, type23, type24, type25, type26, type27, type28, type29, type30) — UO.FindAnyType(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), type (Any), type2 (Any), type3 (Any), type4 (Any), type5 (Any), type6 (Any), type7 (Any), type8 (Any), type9 (Any), type10 (Any), type11 (Any), type12 (Any), type13 (Any), type14 (Any), type15 (Any), type16 (Any), type17 (Any), type18 (Any), type19 (Any), type20 (Any), type21 (Any), type22 (Any), type23 (Any), type24 (Any), type25 (Any), type26 (Any), type27 (Any), type28 (Any), type29 (Any), type30 (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAnyType(distance, type, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13, type14, type15, type16, type17, type18, type19, type20, type21, type22, type23, type24, type25, type26, type27, type28, type29, type30, type31) — UO.FindAnyType(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), type (Any), type2 (Any), type3 (Any), type4 (Any), type5 (Any), type6 (Any), type7 (Any), type8 (Any), type9 (Any), type10 (Any), type11 (Any), type12 (Any), type13 (Any), type14 (Any), type15 (Any), type16 (Any), type17 (Any), type18 (Any), type19 (Any), type20 (Any), type21 (Any), type22 (Any), type23 (Any), type24 (Any), type25 (Any), type26 (Any), type27 (Any), type28 (Any), type29 (Any), type30 (Any), type31 (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(FindAnyType(values[0], CombineMask(values, 1)))

UO.FindAtCoord

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

C# signatures

int UO.FindAtCoord(object? x, object? y);

Searches for loaded world objects on one exact X/Y tile of the current map.

Parameters

  • x — horizontal world coordinate, int 0..65535. Mandatory; these are not container window pixels.
  • y — vertical world coordinate, int 0..65535. Required. There are no additional Z, map, type or radius parameters.

Return value

int - serial the first matching item in that client's result list. 0: no matches, character missing/deleted or coordinates outside 0..65535. This is the ID of the object, not the type, quantity or bool. All 32 bits are saved; check != 0, not == true and not > 0. The same ID is written to FindItem().

Behavior

  • Checks undeleted Items on the ground and Mobile, including the character himself on this cell. The contents of containers and worn items are excluded: their X/Y coordinates cannot be considered world coordinates. Serial are excluded from the Ignore list.
  • All Z heights at given X/Y are suitable. FindDistance and FindVertical do not limit this search to the exact cell. Only loaded objects of the current world are visible; landscape, static and other maps do not load. Packets are not sent, target is not opened, items are not moved.
  • Each call first clears the previous search. FindCount() counts objects, FindFullQuantity() sums units in stacks (Mobile adds one), GetFoundItems() returns those found serial. Item is searched first, then Mobile; within collections, the current enumeration order applies. Save the list for the next search that replaces the results.
  • The selection order and filters above describe the implementation 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.FindAtCoord(1445, 1690);
UO.Print("FindAtCoord: " + Convert.ToString(result));

1. Get one ID - direct script

Parameters and execution flow:

  • 1445 and 1690 are examples of the world's X/Y: replace them with your cell. id saves one serial; HEX outputs it in hexadecimal. != 0 checks for presence of result, not quantity.
var id = UO.FindAtCoord(1445, 1690);
if (Truth(id != 0))
{
    UO.Print(Hex(id));
}
else
{
    UO.Print("No loaded object");
}

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;

2. View all objects on a character square - script function

Parameters and execution flow:

  • x/y are read from the character; ids saves the list of current searches. Each id represents one object, including the entire stack. GetType(id) reads graphic/body. Items are not selected or used.
return  RunScenario();
 object? RunScenario()
{
    var x = UO.GetX("self");
    var y = UO.GetY("self");
    UO.FindAtCoord(x, y);
    var ids = UO.GetFoundItems();
    foreach (var id in ids)
    {
        UO.Print(Hex(id) + " type=" + Hex(UO.GetType(id)));
    }

    return null;
}

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

3. Full function CountGraphicAt - script class

Parameters and execution flow:

  • CountGraphicAt(x, y, graphic) searches for a cell once, iterates through the saved ID and counts objects with the desired graphics. graphic=0x0EED - gold. The number of objects/stacks is returned, not the sum of units and not true/false; one stack makes one. The function is completely defined after Main.
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 = CountGraphicAt(1445, 1690, 0x0EED);
        UO.Print("Objects/stacks: " + Convert.ToString(count));
        return null;
    }

    dynamic CountGraphicAt(dynamic x, dynamic y, dynamic graphic)
    {
        UO.FindAtCoord(x, y);
        var ids = UO.GetFoundItems();
        var count = 0;
        foreach (var id in ids)
        {
            if (Truth(UO.GetType(id) == graphic))
            {
                count += 1;
            }
        }

        return count;
    }

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

Command implementation

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

UO.FindAtCoord(x, y) — UO.FindAtCoord(Any,Any)

Parameters: x (Any), y (Any)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

case "findatcoord": return new InjectionValue(bridge.FindAtCoord(Arg(0), Arg(1)));

UO.FindByNotoriety

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

C# signatures

int UO.FindByNotoriety(object? distance, object? notoriety);
int UO.FindByNotoriety(object? distance, object? notoriety, object? notoriety2);
int UO.FindByNotoriety(object? distance, object? notoriety, object? notoriety2, object? notoriety3);
int UO.FindByNotoriety(object? distance, object? notoriety, object? notoriety2, object? notoriety3, object? notoriety4);
int UO.FindByNotoriety(object? distance, object? notoriety, object? notoriety2, object? notoriety3, object? notoriety4, object? notoriety5);
int UO.FindByNotoriety(object? distance, object? notoriety, object? notoriety2, object? notoriety3, object? notoriety4, object? notoriety5, object? notoriety6);
int UO.FindByNotoriety(object? distance, object? notoriety, object? notoriety2, object? notoriety3, object? notoriety4, object? notoriety5, object? notoriety6, object? notoriety7);
int UO.FindByNotoriety(object? distance, object? notoriety, object? notoriety2, object? notoriety3, object? notoriety4, object? notoriety5, object? notoriety6, object? notoriety7, object? notoriety8);
int UO.FindByNotoriety(object? distance, object? notoriety, object? notoriety2, object? notoriety3, object? notoriety4, object? notoriety5, object? notoriety6, object? notoriety7, object? notoriety8, object? notoriety9);
int UO.FindByNotoriety(object? distance, object? notoriety, object? notoriety2, object? notoriety3, object? notoriety4, object? notoriety5, object? notoriety6, object? notoriety7, object? notoriety8, object? notoriety9, object? notoriety10);
int UO.FindByNotoriety(object? distance, object? notoriety, object? notoriety2, object? notoriety3, object? notoriety4, object? notoriety5, object? notoriety6, object? notoriety7, object? notoriety8, object? notoriety9, object? notoriety10, object? notoriety11);
int UO.FindByNotoriety(object? distance, object? notoriety, object? notoriety2, object? notoriety3, object? notoriety4, object? notoriety5, object? notoriety6, object? notoriety7, object? notoriety8, object? notoriety9, object? notoriety10, object? notoriety11, object? notoriety12);
int UO.FindByNotoriety(object? distance, object? notoriety, object? notoriety2, object? notoriety3, object? notoriety4, object? notoriety5, object? notoriety6, object? notoriety7, object? notoriety8, object? notoriety9, object? notoriety10, object? notoriety11, object? notoriety12, object? notoriety13);
int UO.FindByNotoriety(object? distance, object? notoriety, object? notoriety2, object? notoriety3, object? notoriety4, object? notoriety5, object? notoriety6, object? notoriety7, object? notoriety8, object? notoriety9, object? notoriety10, object? notoriety11, object? notoriety12, object? notoriety13, object? notoriety14);
int UO.FindByNotoriety(object? distance, object? notoriety, object? notoriety2, object? notoriety3, object? notoriety4, object? notoriety5, object? notoriety6, object? notoriety7, object? notoriety8, object? notoriety9, object? notoriety10, object? notoriety11, object? notoriety12, object? notoriety13, object? notoriety14, object? notoriety15);
int UO.FindByNotoriety(object? distance, object? notoriety, object? notoriety2, object? notoriety3, object? notoriety4, object? notoriety5, object? notoriety6, object? notoriety7, object? notoriety8, object? notoriety9, object? notoriety10, object? notoriety11, object? notoriety12, object? notoriety13, object? notoriety14, object? notoriety15, object? notoriety16);
int UO.FindByNotoriety(object? distance, object? notoriety, object? notoriety2, object? notoriety3, object? notoriety4, object? notoriety5, object? notoriety6, object? notoriety7, object? notoriety8, object? notoriety9, object? notoriety10, object? notoriety11, object? notoriety12, object? notoriety13, object? notoriety14, object? notoriety15, object? notoriety16, object? notoriety17);
int UO.FindByNotoriety(object? distance, object? notoriety, object? notoriety2, object? notoriety3, object? notoriety4, object? notoriety5, object? notoriety6, object? notoriety7, object? notoriety8, object? notoriety9, object? notoriety10, object? notoriety11, object? notoriety12, object? notoriety13, object? notoriety14, object? notoriety15, object? notoriety16, object? notoriety17, object? notoriety18);
int UO.FindByNotoriety(object? distance, object? notoriety, object? notoriety2, object? notoriety3, object? notoriety4, object? notoriety5, object? notoriety6, object? notoriety7, object? notoriety8, object? notoriety9, object? notoriety10, object? notoriety11, object? notoriety12, object? notoriety13, object? notoriety14, object? notoriety15, object? notoriety16, object? notoriety17, object? notoriety18, object? notoriety19);
int UO.FindByNotoriety(object? distance, object? notoriety, object? notoriety2, object? notoriety3, object? notoriety4, object? notoriety5, object? notoriety6, object? notoriety7, object? notoriety8, object? notoriety9, object? notoriety10, object? notoriety11, object? notoriety12, object? notoriety13, object? notoriety14, object? notoriety15, object? notoriety16, object? notoriety17, object? notoriety18, object? notoriety19, object? notoriety20);
int UO.FindByNotoriety(object? distance, object? notoriety, object? notoriety2, object? notoriety3, object? notoriety4, object? notoriety5, object? notoriety6, object? notoriety7, object? notoriety8, object? notoriety9, object? notoriety10, object? notoriety11, object? notoriety12, object? notoriety13, object? notoriety14, object? notoriety15, object? notoriety16, object? notoriety17, object? notoriety18, object? notoriety19, object? notoriety20, object? notoriety21);
int UO.FindByNotoriety(object? distance, object? notoriety, object? notoriety2, object? notoriety3, object? notoriety4, object? notoriety5, object? notoriety6, object? notoriety7, object? notoriety8, object? notoriety9, object? notoriety10, object? notoriety11, object? notoriety12, object? notoriety13, object? notoriety14, object? notoriety15, object? notoriety16, object? notoriety17, object? notoriety18, object? notoriety19, object? notoriety20, object? notoriety21, object? notoriety22);
int UO.FindByNotoriety(object? distance, object? notoriety, object? notoriety2, object? notoriety3, object? notoriety4, object? notoriety5, object? notoriety6, object? notoriety7, object? notoriety8, object? notoriety9, object? notoriety10, object? notoriety11, object? notoriety12, object? notoriety13, object? notoriety14, object? notoriety15, object? notoriety16, object? notoriety17, object? notoriety18, object? notoriety19, object? notoriety20, object? notoriety21, object? notoriety22, object? notoriety23);
int UO.FindByNotoriety(object? distance, object? notoriety, object? notoriety2, object? notoriety3, object? notoriety4, object? notoriety5, object? notoriety6, object? notoriety7, object? notoriety8, object? notoriety9, object? notoriety10, object? notoriety11, object? notoriety12, object? notoriety13, object? notoriety14, object? notoriety15, object? notoriety16, object? notoriety17, object? notoriety18, object? notoriety19, object? notoriety20, object? notoriety21, object? notoriety22, object? notoriety23, object? notoriety24);
int UO.FindByNotoriety(object? distance, object? notoriety, object? notoriety2, object? notoriety3, object? notoriety4, object? notoriety5, object? notoriety6, object? notoriety7, object? notoriety8, object? notoriety9, object? notoriety10, object? notoriety11, object? notoriety12, object? notoriety13, object? notoriety14, object? notoriety15, object? notoriety16, object? notoriety17, object? notoriety18, object? notoriety19, object? notoriety20, object? notoriety21, object? notoriety22, object? notoriety23, object? notoriety24, object? notoriety25);
int UO.FindByNotoriety(object? distance, object? notoriety, object? notoriety2, object? notoriety3, object? notoriety4, object? notoriety5, object? notoriety6, object? notoriety7, object? notoriety8, object? notoriety9, object? notoriety10, object? notoriety11, object? notoriety12, object? notoriety13, object? notoriety14, object? notoriety15, object? notoriety16, object? notoriety17, object? notoriety18, object? notoriety19, object? notoriety20, object? notoriety21, object? notoriety22, object? notoriety23, object? notoriety24, object? notoriety25, object? notoriety26);
int UO.FindByNotoriety(object? distance, object? notoriety, object? notoriety2, object? notoriety3, object? notoriety4, object? notoriety5, object? notoriety6, object? notoriety7, object? notoriety8, object? notoriety9, object? notoriety10, object? notoriety11, object? notoriety12, object? notoriety13, object? notoriety14, object? notoriety15, object? notoriety16, object? notoriety17, object? notoriety18, object? notoriety19, object? notoriety20, object? notoriety21, object? notoriety22, object? notoriety23, object? notoriety24, object? notoriety25, object? notoriety26, object? notoriety27);
int UO.FindByNotoriety(object? distance, object? notoriety, object? notoriety2, object? notoriety3, object? notoriety4, object? notoriety5, object? notoriety6, object? notoriety7, object? notoriety8, object? notoriety9, object? notoriety10, object? notoriety11, object? notoriety12, object? notoriety13, object? notoriety14, object? notoriety15, object? notoriety16, object? notoriety17, object? notoriety18, object? notoriety19, object? notoriety20, object? notoriety21, object? notoriety22, object? notoriety23, object? notoriety24, object? notoriety25, object? notoriety26, object? notoriety27, object? notoriety28);
int UO.FindByNotoriety(object? distance, object? notoriety, object? notoriety2, object? notoriety3, object? notoriety4, object? notoriety5, object? notoriety6, object? notoriety7, object? notoriety8, object? notoriety9, object? notoriety10, object? notoriety11, object? notoriety12, object? notoriety13, object? notoriety14, object? notoriety15, object? notoriety16, object? notoriety17, object? notoriety18, object? notoriety19, object? notoriety20, object? notoriety21, object? notoriety22, object? notoriety23, object? notoriety24, object? notoriety25, object? notoriety26, object? notoriety27, object? notoriety28, object? notoriety29);
int UO.FindByNotoriety(object? distance, object? notoriety, object? notoriety2, object? notoriety3, object? notoriety4, object? notoriety5, object? notoriety6, object? notoriety7, object? notoriety8, object? notoriety9, object? notoriety10, object? notoriety11, object? notoriety12, object? notoriety13, object? notoriety14, object? notoriety15, object? notoriety16, object? notoriety17, object? notoriety18, object? notoriety19, object? notoriety20, object? notoriety21, object? notoriety22, object? notoriety23, object? notoriety24, object? notoriety25, object? notoriety26, object? notoriety27, object? notoriety28, object? notoriety29, object? notoriety30);
int UO.FindByNotoriety(object? distance, object? notoriety, object? notoriety2, object? notoriety3, object? notoriety4, object? notoriety5, object? notoriety6, object? notoriety7, object? notoriety8, object? notoriety9, object? notoriety10, object? notoriety11, object? notoriety12, object? notoriety13, object? notoriety14, object? notoriety15, object? notoriety16, object? notoriety17, object? notoriety18, object? notoriety19, object? notoriety20, object? notoriety21, object? notoriety22, object? notoriety23, object? notoriety24, object? notoriety25, object? notoriety26, object? notoriety27, object? notoriety28, object? notoriety29, object? notoriety30, object? notoriety31);

Finds the closest other character/NPC with one of the specified notoriety statuses. Useful when you need to first select an enemy, ally, or observed target, and only then decide separately whether to attack or follow it.

Parameters

  • 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.
  • 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; the 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.
  • notoriety2 - Optional additional notoriety mask; the same forms as notoriety. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • notoriety3 - Optional additional notoriety mask; the same forms as notoriety. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • notoriety4 - Optional additional notoriety mask; the same forms as notoriety. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • notoriety5 - Optional additional notoriety mask; the same forms as notoriety. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • notoriety6 - Optional additional notoriety mask; the same forms as notoriety. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • notoriety7 - Optional additional notoriety mask; the same forms as notoriety. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • notoriety8 - Optional additional notoriety mask; the same forms as notoriety. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • notoriety9 - Optional additional notoriety mask; the same forms as notoriety. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • notoriety10 - Optional additional notoriety mask; the same forms as notoriety. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • notoriety11 - Optional additional notoriety mask; the same forms as notoriety. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • notoriety12 - Optional additional notoriety mask; the same forms as notoriety. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • notoriety13 - Optional additional notoriety mask; the same forms as notoriety. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • notoriety14 - Optional additional notoriety mask; the same forms as notoriety. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • notoriety15 - Optional additional notoriety mask; the same forms as notoriety. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • notoriety16 - Optional additional notoriety mask; the same forms as notoriety. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • notoriety17 - Optional additional notoriety mask; the same forms as notoriety. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • notoriety18 - Optional additional notoriety mask; the same forms as notoriety. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • notoriety19 - Optional additional notoriety mask; the same forms as notoriety. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • notoriety20 - Optional additional notoriety mask; the same forms as notoriety. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • notoriety21 - Optional additional notoriety mask; the same forms as notoriety. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • notoriety22 - Optional additional notoriety mask; the same forms as notoriety. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • notoriety23 - Optional additional notoriety mask; the same forms as notoriety. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • notoriety24 - Optional additional notoriety mask; the same forms as notoriety. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • notoriety25 - Optional additional notoriety mask; the same forms as notoriety. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • notoriety26 - Optional additional notoriety mask; the same forms as notoriety. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • notoriety27 - Optional additional notoriety mask; the same forms as notoriety. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • notoriety28 - Optional additional notoriety mask; the same forms as notoriety. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • notoriety29 - Optional additional notoriety mask; the same forms as notoriety. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • notoriety30 - Optional additional notoriety mask; the same forms as notoriety. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.
  • notoriety31 - Optional additional notoriety mask; the same forms as notoriety. Combines with previous ones via OR, does not set a separate radius, hue, Z or priority.

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.
  • Does not change FindItem, FindCount or GetFoundItems. These fields may contain the results of a previous other command: use the returned ID directly.
  • At least two arguments: distance, notoriety. Maximum 32: radius and up to 31 mask. For more values, pass the flat array as one argument. Removing filter: -1/any/0xFFFF/empty string or empty array separately. If specific codes are listed next to each other, they retain the restriction.
  • Excludes self. Respects UO.FindVertical() as the limit of the difference Z; there is no parameter maxZ in this command. Always chooses the closest one; if there is equality, the smaller serial. The argument after notoriety is still notoriety, not nearest and not body.

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.FindByNotoriety(12, "5|6");
UO.Print("FindByNotoriety: " + Convert.ToString(result));

1. Select the nearest target and save its name - direct script

Parameters and execution flow:

  • The saved opponent can be used later; this example does not attack. The current FindVertical also applies even if the target is close in X/Y.
var found = UO.FindByNotoriety(12, "5|6");
if (Truth(found != 0))
{
    UO.AddObject("opponent", found);
    UO.Print("Selected: " + UO.GetName(found));
}

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

2. List of statuses from an array plus separate code - script function

Parameters and execution flow:

  • allowed contains Enemy, a separate 6 adds Murderer. Statuses are combined rather than sorted by priority. The example requests an attack on one found live mobile; server rules determine what is acceptable.
return  RunScenario();
 object? RunScenario()
{
    dynamic[] allowed = new dynamic[checked((int)(0) + 1)];
    allowed[0] = 5;
    var found = UO.FindByNotoriety(8, allowed, 6);
    if (Truth(found != 0) && !(Truth(UO.IsDead(found))))
    {
        UO.Attack(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. Complete Equal Height Search Function - Script Class

Parameters and execution flow:

  • radius — X/Y radius in cells. FindVertical(0) requires the same Z; This is not a floor or wall inspection. The function returns ID/0 and Finally saves the settings for other parts of the script.
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 = FindOpponentAtSameLevel(10);
        if (Truth(found != 0))
        {
            UO.AddObject("same_level", found);
        }

        return null;
    }

    dynamic FindOpponentAtSameLevel(dynamic radius)
    {
        var previous = UO.FindVertical();
        try
        {
            UO.FindVertical(0);
            return UO.FindByNotoriety(radius, "5|6");
        }
        finally
        {
            UO.FindVertical(previous);
        }
    }

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

Parameters: distance (Any), notoriety (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindByNotoriety(distance, notoriety, notoriety2) — UO.FindByNotoriety(Any,Any,Any)

Parameters: distance (Any), notoriety (Any), notoriety2 (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindByNotoriety(distance, notoriety, notoriety2, notoriety3) — UO.FindByNotoriety(Any,Any,Any,Any)

Parameters: distance (Any), notoriety (Any), notoriety2 (Any), notoriety3 (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindByNotoriety(distance, notoriety, notoriety2, notoriety3, notoriety4) — UO.FindByNotoriety(Any,Any,Any,Any,Any)

Parameters: distance (Any), notoriety (Any), notoriety2 (Any), notoriety3 (Any), notoriety4 (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindByNotoriety(distance, notoriety, notoriety2, notoriety3, notoriety4, notoriety5) — UO.FindByNotoriety(Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), notoriety (Any), notoriety2 (Any), notoriety3 (Any), notoriety4 (Any), notoriety5 (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindByNotoriety(distance, notoriety, notoriety2, notoriety3, notoriety4, notoriety5, notoriety6) — UO.FindByNotoriety(Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), notoriety (Any), notoriety2 (Any), notoriety3 (Any), notoriety4 (Any), notoriety5 (Any), notoriety6 (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindByNotoriety(distance, notoriety, notoriety2, notoriety3, notoriety4, notoriety5, notoriety6, notoriety7) — UO.FindByNotoriety(Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), notoriety (Any), notoriety2 (Any), notoriety3 (Any), notoriety4 (Any), notoriety5 (Any), notoriety6 (Any), notoriety7 (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindByNotoriety(distance, notoriety, notoriety2, notoriety3, notoriety4, notoriety5, notoriety6, notoriety7, notoriety8) — UO.FindByNotoriety(Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), notoriety (Any), notoriety2 (Any), notoriety3 (Any), notoriety4 (Any), notoriety5 (Any), notoriety6 (Any), notoriety7 (Any), notoriety8 (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindByNotoriety(distance, notoriety, notoriety2, notoriety3, notoriety4, notoriety5, notoriety6, notoriety7, notoriety8, notoriety9) — UO.FindByNotoriety(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), notoriety (Any), notoriety2 (Any), notoriety3 (Any), notoriety4 (Any), notoriety5 (Any), notoriety6 (Any), notoriety7 (Any), notoriety8 (Any), notoriety9 (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindByNotoriety(distance, notoriety, notoriety2, notoriety3, notoriety4, notoriety5, notoriety6, notoriety7, notoriety8, notoriety9, notoriety10) — UO.FindByNotoriety(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), notoriety (Any), notoriety2 (Any), notoriety3 (Any), notoriety4 (Any), notoriety5 (Any), notoriety6 (Any), notoriety7 (Any), notoriety8 (Any), notoriety9 (Any), notoriety10 (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindByNotoriety(distance, notoriety, notoriety2, notoriety3, notoriety4, notoriety5, notoriety6, notoriety7, notoriety8, notoriety9, notoriety10, notoriety11) — UO.FindByNotoriety(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), notoriety (Any), notoriety2 (Any), notoriety3 (Any), notoriety4 (Any), notoriety5 (Any), notoriety6 (Any), notoriety7 (Any), notoriety8 (Any), notoriety9 (Any), notoriety10 (Any), notoriety11 (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindByNotoriety(distance, notoriety, notoriety2, notoriety3, notoriety4, notoriety5, notoriety6, notoriety7, notoriety8, notoriety9, notoriety10, notoriety11, notoriety12) — UO.FindByNotoriety(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), notoriety (Any), notoriety2 (Any), notoriety3 (Any), notoriety4 (Any), notoriety5 (Any), notoriety6 (Any), notoriety7 (Any), notoriety8 (Any), notoriety9 (Any), notoriety10 (Any), notoriety11 (Any), notoriety12 (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindByNotoriety(distance, notoriety, notoriety2, notoriety3, notoriety4, notoriety5, notoriety6, notoriety7, notoriety8, notoriety9, notoriety10, notoriety11, notoriety12, notoriety13) — UO.FindByNotoriety(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), notoriety (Any), notoriety2 (Any), notoriety3 (Any), notoriety4 (Any), notoriety5 (Any), notoriety6 (Any), notoriety7 (Any), notoriety8 (Any), notoriety9 (Any), notoriety10 (Any), notoriety11 (Any), notoriety12 (Any), notoriety13 (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindByNotoriety(distance, notoriety, notoriety2, notoriety3, notoriety4, notoriety5, notoriety6, notoriety7, notoriety8, notoriety9, notoriety10, notoriety11, notoriety12, notoriety13, notoriety14) — UO.FindByNotoriety(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), notoriety (Any), notoriety2 (Any), notoriety3 (Any), notoriety4 (Any), notoriety5 (Any), notoriety6 (Any), notoriety7 (Any), notoriety8 (Any), notoriety9 (Any), notoriety10 (Any), notoriety11 (Any), notoriety12 (Any), notoriety13 (Any), notoriety14 (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindByNotoriety(distance, notoriety, notoriety2, notoriety3, notoriety4, notoriety5, notoriety6, notoriety7, notoriety8, notoriety9, notoriety10, notoriety11, notoriety12, notoriety13, notoriety14, notoriety15) — UO.FindByNotoriety(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), notoriety (Any), notoriety2 (Any), notoriety3 (Any), notoriety4 (Any), notoriety5 (Any), notoriety6 (Any), notoriety7 (Any), notoriety8 (Any), notoriety9 (Any), notoriety10 (Any), notoriety11 (Any), notoriety12 (Any), notoriety13 (Any), notoriety14 (Any), notoriety15 (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindByNotoriety(distance, notoriety, notoriety2, notoriety3, notoriety4, notoriety5, notoriety6, notoriety7, notoriety8, notoriety9, notoriety10, notoriety11, notoriety12, notoriety13, notoriety14, notoriety15, notoriety16) — UO.FindByNotoriety(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), notoriety (Any), notoriety2 (Any), notoriety3 (Any), notoriety4 (Any), notoriety5 (Any), notoriety6 (Any), notoriety7 (Any), notoriety8 (Any), notoriety9 (Any), notoriety10 (Any), notoriety11 (Any), notoriety12 (Any), notoriety13 (Any), notoriety14 (Any), notoriety15 (Any), notoriety16 (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindByNotoriety(distance, notoriety, notoriety2, notoriety3, notoriety4, notoriety5, notoriety6, notoriety7, notoriety8, notoriety9, notoriety10, notoriety11, notoriety12, notoriety13, notoriety14, notoriety15, notoriety16, notoriety17) — UO.FindByNotoriety(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), notoriety (Any), notoriety2 (Any), notoriety3 (Any), notoriety4 (Any), notoriety5 (Any), notoriety6 (Any), notoriety7 (Any), notoriety8 (Any), notoriety9 (Any), notoriety10 (Any), notoriety11 (Any), notoriety12 (Any), notoriety13 (Any), notoriety14 (Any), notoriety15 (Any), notoriety16 (Any), notoriety17 (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindByNotoriety(distance, notoriety, notoriety2, notoriety3, notoriety4, notoriety5, notoriety6, notoriety7, notoriety8, notoriety9, notoriety10, notoriety11, notoriety12, notoriety13, notoriety14, notoriety15, notoriety16, notoriety17, notoriety18) — UO.FindByNotoriety(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), notoriety (Any), notoriety2 (Any), notoriety3 (Any), notoriety4 (Any), notoriety5 (Any), notoriety6 (Any), notoriety7 (Any), notoriety8 (Any), notoriety9 (Any), notoriety10 (Any), notoriety11 (Any), notoriety12 (Any), notoriety13 (Any), notoriety14 (Any), notoriety15 (Any), notoriety16 (Any), notoriety17 (Any), notoriety18 (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindByNotoriety(distance, notoriety, notoriety2, notoriety3, notoriety4, notoriety5, notoriety6, notoriety7, notoriety8, notoriety9, notoriety10, notoriety11, notoriety12, notoriety13, notoriety14, notoriety15, notoriety16, notoriety17, notoriety18, notoriety19) — UO.FindByNotoriety(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), notoriety (Any), notoriety2 (Any), notoriety3 (Any), notoriety4 (Any), notoriety5 (Any), notoriety6 (Any), notoriety7 (Any), notoriety8 (Any), notoriety9 (Any), notoriety10 (Any), notoriety11 (Any), notoriety12 (Any), notoriety13 (Any), notoriety14 (Any), notoriety15 (Any), notoriety16 (Any), notoriety17 (Any), notoriety18 (Any), notoriety19 (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindByNotoriety(distance, notoriety, notoriety2, notoriety3, notoriety4, notoriety5, notoriety6, notoriety7, notoriety8, notoriety9, notoriety10, notoriety11, notoriety12, notoriety13, notoriety14, notoriety15, notoriety16, notoriety17, notoriety18, notoriety19, notoriety20) — UO.FindByNotoriety(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), notoriety (Any), notoriety2 (Any), notoriety3 (Any), notoriety4 (Any), notoriety5 (Any), notoriety6 (Any), notoriety7 (Any), notoriety8 (Any), notoriety9 (Any), notoriety10 (Any), notoriety11 (Any), notoriety12 (Any), notoriety13 (Any), notoriety14 (Any), notoriety15 (Any), notoriety16 (Any), notoriety17 (Any), notoriety18 (Any), notoriety19 (Any), notoriety20 (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindByNotoriety(distance, notoriety, notoriety2, notoriety3, notoriety4, notoriety5, notoriety6, notoriety7, notoriety8, notoriety9, notoriety10, notoriety11, notoriety12, notoriety13, notoriety14, notoriety15, notoriety16, notoriety17, notoriety18, notoriety19, notoriety20, notoriety21) — UO.FindByNotoriety(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), notoriety (Any), notoriety2 (Any), notoriety3 (Any), notoriety4 (Any), notoriety5 (Any), notoriety6 (Any), notoriety7 (Any), notoriety8 (Any), notoriety9 (Any), notoriety10 (Any), notoriety11 (Any), notoriety12 (Any), notoriety13 (Any), notoriety14 (Any), notoriety15 (Any), notoriety16 (Any), notoriety17 (Any), notoriety18 (Any), notoriety19 (Any), notoriety20 (Any), notoriety21 (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindByNotoriety(distance, notoriety, notoriety2, notoriety3, notoriety4, notoriety5, notoriety6, notoriety7, notoriety8, notoriety9, notoriety10, notoriety11, notoriety12, notoriety13, notoriety14, notoriety15, notoriety16, notoriety17, notoriety18, notoriety19, notoriety20, notoriety21, notoriety22) — UO.FindByNotoriety(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), notoriety (Any), notoriety2 (Any), notoriety3 (Any), notoriety4 (Any), notoriety5 (Any), notoriety6 (Any), notoriety7 (Any), notoriety8 (Any), notoriety9 (Any), notoriety10 (Any), notoriety11 (Any), notoriety12 (Any), notoriety13 (Any), notoriety14 (Any), notoriety15 (Any), notoriety16 (Any), notoriety17 (Any), notoriety18 (Any), notoriety19 (Any), notoriety20 (Any), notoriety21 (Any), notoriety22 (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindByNotoriety(distance, notoriety, notoriety2, notoriety3, notoriety4, notoriety5, notoriety6, notoriety7, notoriety8, notoriety9, notoriety10, notoriety11, notoriety12, notoriety13, notoriety14, notoriety15, notoriety16, notoriety17, notoriety18, notoriety19, notoriety20, notoriety21, notoriety22, notoriety23) — UO.FindByNotoriety(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), notoriety (Any), notoriety2 (Any), notoriety3 (Any), notoriety4 (Any), notoriety5 (Any), notoriety6 (Any), notoriety7 (Any), notoriety8 (Any), notoriety9 (Any), notoriety10 (Any), notoriety11 (Any), notoriety12 (Any), notoriety13 (Any), notoriety14 (Any), notoriety15 (Any), notoriety16 (Any), notoriety17 (Any), notoriety18 (Any), notoriety19 (Any), notoriety20 (Any), notoriety21 (Any), notoriety22 (Any), notoriety23 (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindByNotoriety(distance, notoriety, notoriety2, notoriety3, notoriety4, notoriety5, notoriety6, notoriety7, notoriety8, notoriety9, notoriety10, notoriety11, notoriety12, notoriety13, notoriety14, notoriety15, notoriety16, notoriety17, notoriety18, notoriety19, notoriety20, notoriety21, notoriety22, notoriety23, notoriety24) — UO.FindByNotoriety(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), notoriety (Any), notoriety2 (Any), notoriety3 (Any), notoriety4 (Any), notoriety5 (Any), notoriety6 (Any), notoriety7 (Any), notoriety8 (Any), notoriety9 (Any), notoriety10 (Any), notoriety11 (Any), notoriety12 (Any), notoriety13 (Any), notoriety14 (Any), notoriety15 (Any), notoriety16 (Any), notoriety17 (Any), notoriety18 (Any), notoriety19 (Any), notoriety20 (Any), notoriety21 (Any), notoriety22 (Any), notoriety23 (Any), notoriety24 (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindByNotoriety(distance, notoriety, notoriety2, notoriety3, notoriety4, notoriety5, notoriety6, notoriety7, notoriety8, notoriety9, notoriety10, notoriety11, notoriety12, notoriety13, notoriety14, notoriety15, notoriety16, notoriety17, notoriety18, notoriety19, notoriety20, notoriety21, notoriety22, notoriety23, notoriety24, notoriety25) — UO.FindByNotoriety(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), notoriety (Any), notoriety2 (Any), notoriety3 (Any), notoriety4 (Any), notoriety5 (Any), notoriety6 (Any), notoriety7 (Any), notoriety8 (Any), notoriety9 (Any), notoriety10 (Any), notoriety11 (Any), notoriety12 (Any), notoriety13 (Any), notoriety14 (Any), notoriety15 (Any), notoriety16 (Any), notoriety17 (Any), notoriety18 (Any), notoriety19 (Any), notoriety20 (Any), notoriety21 (Any), notoriety22 (Any), notoriety23 (Any), notoriety24 (Any), notoriety25 (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindByNotoriety(distance, notoriety, notoriety2, notoriety3, notoriety4, notoriety5, notoriety6, notoriety7, notoriety8, notoriety9, notoriety10, notoriety11, notoriety12, notoriety13, notoriety14, notoriety15, notoriety16, notoriety17, notoriety18, notoriety19, notoriety20, notoriety21, notoriety22, notoriety23, notoriety24, notoriety25, notoriety26) — UO.FindByNotoriety(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), notoriety (Any), notoriety2 (Any), notoriety3 (Any), notoriety4 (Any), notoriety5 (Any), notoriety6 (Any), notoriety7 (Any), notoriety8 (Any), notoriety9 (Any), notoriety10 (Any), notoriety11 (Any), notoriety12 (Any), notoriety13 (Any), notoriety14 (Any), notoriety15 (Any), notoriety16 (Any), notoriety17 (Any), notoriety18 (Any), notoriety19 (Any), notoriety20 (Any), notoriety21 (Any), notoriety22 (Any), notoriety23 (Any), notoriety24 (Any), notoriety25 (Any), notoriety26 (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindByNotoriety(distance, notoriety, notoriety2, notoriety3, notoriety4, notoriety5, notoriety6, notoriety7, notoriety8, notoriety9, notoriety10, notoriety11, notoriety12, notoriety13, notoriety14, notoriety15, notoriety16, notoriety17, notoriety18, notoriety19, notoriety20, notoriety21, notoriety22, notoriety23, notoriety24, notoriety25, notoriety26, notoriety27) — UO.FindByNotoriety(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), notoriety (Any), notoriety2 (Any), notoriety3 (Any), notoriety4 (Any), notoriety5 (Any), notoriety6 (Any), notoriety7 (Any), notoriety8 (Any), notoriety9 (Any), notoriety10 (Any), notoriety11 (Any), notoriety12 (Any), notoriety13 (Any), notoriety14 (Any), notoriety15 (Any), notoriety16 (Any), notoriety17 (Any), notoriety18 (Any), notoriety19 (Any), notoriety20 (Any), notoriety21 (Any), notoriety22 (Any), notoriety23 (Any), notoriety24 (Any), notoriety25 (Any), notoriety26 (Any), notoriety27 (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindByNotoriety(distance, notoriety, notoriety2, notoriety3, notoriety4, notoriety5, notoriety6, notoriety7, notoriety8, notoriety9, notoriety10, notoriety11, notoriety12, notoriety13, notoriety14, notoriety15, notoriety16, notoriety17, notoriety18, notoriety19, notoriety20, notoriety21, notoriety22, notoriety23, notoriety24, notoriety25, notoriety26, notoriety27, notoriety28) — UO.FindByNotoriety(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), notoriety (Any), notoriety2 (Any), notoriety3 (Any), notoriety4 (Any), notoriety5 (Any), notoriety6 (Any), notoriety7 (Any), notoriety8 (Any), notoriety9 (Any), notoriety10 (Any), notoriety11 (Any), notoriety12 (Any), notoriety13 (Any), notoriety14 (Any), notoriety15 (Any), notoriety16 (Any), notoriety17 (Any), notoriety18 (Any), notoriety19 (Any), notoriety20 (Any), notoriety21 (Any), notoriety22 (Any), notoriety23 (Any), notoriety24 (Any), notoriety25 (Any), notoriety26 (Any), notoriety27 (Any), notoriety28 (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindByNotoriety(distance, notoriety, notoriety2, notoriety3, notoriety4, notoriety5, notoriety6, notoriety7, notoriety8, notoriety9, notoriety10, notoriety11, notoriety12, notoriety13, notoriety14, notoriety15, notoriety16, notoriety17, notoriety18, notoriety19, notoriety20, notoriety21, notoriety22, notoriety23, notoriety24, notoriety25, notoriety26, notoriety27, notoriety28, notoriety29) — UO.FindByNotoriety(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), notoriety (Any), notoriety2 (Any), notoriety3 (Any), notoriety4 (Any), notoriety5 (Any), notoriety6 (Any), notoriety7 (Any), notoriety8 (Any), notoriety9 (Any), notoriety10 (Any), notoriety11 (Any), notoriety12 (Any), notoriety13 (Any), notoriety14 (Any), notoriety15 (Any), notoriety16 (Any), notoriety17 (Any), notoriety18 (Any), notoriety19 (Any), notoriety20 (Any), notoriety21 (Any), notoriety22 (Any), notoriety23 (Any), notoriety24 (Any), notoriety25 (Any), notoriety26 (Any), notoriety27 (Any), notoriety28 (Any), notoriety29 (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindByNotoriety(distance, notoriety, notoriety2, notoriety3, notoriety4, notoriety5, notoriety6, notoriety7, notoriety8, notoriety9, notoriety10, notoriety11, notoriety12, notoriety13, notoriety14, notoriety15, notoriety16, notoriety17, notoriety18, notoriety19, notoriety20, notoriety21, notoriety22, notoriety23, notoriety24, notoriety25, notoriety26, notoriety27, notoriety28, notoriety29, notoriety30) — UO.FindByNotoriety(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), notoriety (Any), notoriety2 (Any), notoriety3 (Any), notoriety4 (Any), notoriety5 (Any), notoriety6 (Any), notoriety7 (Any), notoriety8 (Any), notoriety9 (Any), notoriety10 (Any), notoriety11 (Any), notoriety12 (Any), notoriety13 (Any), notoriety14 (Any), notoriety15 (Any), notoriety16 (Any), notoriety17 (Any), notoriety18 (Any), notoriety19 (Any), notoriety20 (Any), notoriety21 (Any), notoriety22 (Any), notoriety23 (Any), notoriety24 (Any), notoriety25 (Any), notoriety26 (Any), notoriety27 (Any), notoriety28 (Any), notoriety29 (Any), notoriety30 (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindByNotoriety(distance, notoriety, notoriety2, notoriety3, notoriety4, notoriety5, notoriety6, notoriety7, notoriety8, notoriety9, notoriety10, notoriety11, notoriety12, notoriety13, notoriety14, notoriety15, notoriety16, notoriety17, notoriety18, notoriety19, notoriety20, notoriety21, notoriety22, notoriety23, notoriety24, notoriety25, notoriety26, notoriety27, notoriety28, notoriety29, notoriety30, notoriety31) — UO.FindByNotoriety(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: distance (Any), notoriety (Any), notoriety2 (Any), notoriety3 (Any), notoriety4 (Any), notoriety5 (Any), notoriety6 (Any), notoriety7 (Any), notoriety8 (Any), notoriety9 (Any), notoriety10 (Any), notoriety11 (Any), notoriety12 (Any), notoriety13 (Any), notoriety14 (Any), notoriety15 (Any), notoriety16 (Any), notoriety17 (Any), notoriety18 (Any), notoriety19 (Any), notoriety20 (Any), notoriety21 (Any), notoriety22 (Any), notoriety23 (Any), notoriety24 (Any), notoriety25 (Any), notoriety26 (Any), notoriety27 (Any), notoriety28 (Any), notoriety29 (Any), notoriety30 (Any), notoriety31 (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(FindFilteredMobileSerial(-1, CombineMask(values, 1),

                        NumberConversions.ToInt(values[0]), true, bridge.GetFindVertical(), -1, false))

UO.FindCount

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

C# signatures

int UO.FindCount();
int UO.FindCount(object? id);

Reads the number of ones in the specified stack if ID is passed. The form without arguments retains a separate meaning: the number of objects of the last search.

Parameters

  • id — Serial/ID of a specific object: int, decimal/hex string or set alias self, backpack, lasttarget, lastobject or name AddObject. This is not a graphic/type. Optional argument. When ID is passed, the current Amount of this particular item is read. The finditem alias explicitly selects the first search result. Without an argument, the number of objects found is returned.

Return value

int: FindCount(id) — number of units in the specified stack (Amount); a normal single item gives 1, an unknown/removed item, erroneous alias or Mobile gives 0. FindCount() without ID is the number of objects in the last search: one stack is considered one object regardless of Amount. For example, three stacks of 20, 50 and 100: FindCount()=3, FindCount(ID of the second stack)=50, FindFullQuantity()=170.

Behavior

  • FindCount(id) is equivalent to reading GetQuantity(id), does not trigger a search, and does not modify FindItem/FindCount()/FindFullQuantity/GetFoundItems.
  • ID means serial of a specific item, not type. The change in quantity is reflected the next time FindCount(id) is called. The quantity in the removed item is 0; it does not automatically search for another stack.
  • The original compatibility without arguments is preserved: FindCount() counts objects. FindQuantity() reads one stack found, FindFullQuantity() sums the units from the last search.
  • 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");
var result = UO.FindCount();
UO.Print("FindCount: " + Convert.ToString(result));

1. Quantity in a specific stack by ID - direct script

Parameters and execution flow:

  • id=0x40001234 is an example of a serial stack. Replace the item's ID with yours.
  • A stack of 50 units will return 50; single item - 1; unknown ID - 0.
var amount = UO.FindCount("0x40001234");
UO.Print("Units: " + Convert.ToString(amount));

2. Find an item and read its quantity - script function

Parameters and execution flow:

  • FindType receives gold type 0x0EED, any hue=-1, backpack area and returns serial.
  • The returned serial item is passed to FindCount. The type 0x0EED itself cannot be passed here.
return  RunScenario();
 object? RunScenario()
{
    var item = UO.FindType(0x0EED, -1, "backpack");
    if (Truth(item != ""))
    {
        var units = UO.FindCount(item);
        UO.Print(Convert.ToString(units));
    }

    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. The quantity in the last target and in the saved name is the scenario class

Parameters and execution flow:

  • lasttarget should point to the item. AddObject saves this serial under the name selected_stack.
  • FindCount resolves the name to ID and reads the Amount. If a character target is selected, 0 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 item = UO.GetSerial("lasttarget");
        if (Truth(UO.Exists(item)))
        {
            UO.AddObject("selected_stack", item);
            UO.Print(Convert.ToString(UO.FindCount("selected_stack")));
        }

        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. 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 — number of items/characters found, 0 without matches. One stack of 1000 units counts as one object. This is not a sum of units; it requires FindFullQuantity.
var found = UO.FindType(0x0EED, -1, "backpack");
var value = UO.FindCount();
UO.Print(Convert.ToString(value));

5. 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");

6. 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.FindCount();
        found = UO.FindType(0x0F7A, -1, "backpack");
        UO.Print("Saved: " + Convert.ToString(saved));
        UO.Print("Current: " + Convert.ToString(UO.FindCount()));
        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.FindCount() — UO.FindCount()

Parameters: No parameters.

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int FindCount() => bridge.FindCount();

UO.FindCount(id) — UO.FindCount(Any)

Parameters: id (Any)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int FindCount(InjectionValue id) => bridge.GetQuantity(GetObject(id));

UO.FindDistance

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

C# signatures

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

Reads or modifies the default horizontal search radius.

Parameters

  • value — Optional int. Without argument - reading; value — setting. The value is limited to the range 0..255; the negative becomes 0 rather than unlimited. In the new runtime: 18; 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 is the current limit (distance in cells), 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 FindDistance() to find out the stored value.

Behavior

  • Distance: max(abs(dx), abs(dy)) from the current reference point of the client range; a diagonal square counts as one. The border is turned on. For 0 only objects on the same X/Y are suitable. For moving Mobile, the distance takes into account the final position of the queue of steps.
  • 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.FindDistance();
UO.Print("FindDistance: " + Convert.ToString(result));

1. Read, Set and Range Limit - Direct Script

Parameters and execution flow:

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

2. Temporary Ground Search - Script Function

Parameters and execution flow:

  • previous saves the calling code's setting. 5 changes only FindDistance; 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.FindDistance();
    try
    {
        UO.FindDistance(5);
        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.FindDistance(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.FindDistance() — UO.FindDistance()

Parameters: No parameters.

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

case "finddistance":

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

                    return new InjectionValue(bridge.GetFindDistance());

UO.FindDistance(value) — UO.FindDistance(Any)

Parameters: value (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "finddistance":

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

                    return new InjectionValue(bridge.GetFindDistance());

UO.FindFullQuantity

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

C# signatures

dynamic UO.FindFullQuantity();

Reads the total number of units in the last search snapshot.

Parameters

There are no parameters.

Return value

int — sum max(1, Amount) of items found; Each character found adds 1. 0 no matches. Two stacks of 50 yield 100, and FindCount yield 2. This is a snapshot at the time of the search, not a constantly updated amount.

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.FindFullQuantity();
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 — sum max(1, Amount) of items found; Each character found adds 1. 0 no matches. Two stacks of 50 yield 100, and FindCount yield 2. This is a snapshot at the time of the search, not a constantly updated amount.
var found = UO.FindType(0x0EED, -1, "backpack");
var value = UO.FindFullQuantity();
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.FindFullQuantity();
        found = UO.FindType(0x0F7A, -1, "backpack");
        UO.Print("Saved: " + Convert.ToString(saved));
        UO.Print("Current: " + Convert.ToString(UO.FindFullQuantity()));
        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.FindFullQuantity() — UO.FindFullQuantity()

Parameters: No parameters.

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "findfullquantity": return new InjectionValue(bridge.FindFullQuantity());

UO.FindItem

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

C# signatures

dynamic UO.FindItem();

Reads serial of the first result of the last regular search.

Parameters

There are no parameters.

Return value

int — serial/ID of the first found object, 0 if there is no result. This is a numeric serial, whereas FindType returns a hex string or the empty string. Does not return type.

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.FindItem();
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 — serial/ID of the first found object, 0 if there is no result. This is a numeric serial, whereas FindType returns a hex string or the empty string. Does not return type.
var found = UO.FindType(0x0EED, -1, "backpack");
var value = UO.FindItem();
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.FindItem();
        found = UO.FindType(0x0F7A, -1, "backpack");
        UO.Print("Saved: " + Convert.ToString(saved));
        UO.Print("Current: " + Convert.ToString(UO.FindItem()));
        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.FindItem() — UO.FindItem()

Parameters: No parameters.

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "finditem": return new InjectionValue(bridge.FindItem);

UO.FindList

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

C# signatures

string UO.FindList(object? list);
string UO.FindList(object? list, object? container);
string UO.FindList(object? list, object? container, object? distance);
string UO.FindList(object? list, object? container, object? distance, object? notoriety);
string UO.FindList(object? list, object? container, object? distance, object? notoriety, object? nearest);
string UO.FindList(object? list, object? container, object? distance, object? notoriety, object? nearest, object? maxZ);
string UO.FindList(object? list, object? container, object? distance, object? notoriety, object? nearest, object? maxZ, object? includeIgnored);

Searches for downloaded items or mobiles across multiple type/hue. Returns the first serial as a string and stores the entire ordered result for FindItem, FindCount and GetFoundItems.

Parameters

  • list — Name of the non-empty set AddFindList; or a flat array of numeric type; or a string of types delimited by |, comma, semicolon, or space, such as "0x0EED|0x0F7A". Array/string types use any hue. [type,hue] pairs within an array are not supported; for hue, create a named set. The order of the entries determines the priority. Graphic/type of the item or body mobile, not its serial. Typically int 0..65535, including 0x0EED; -1 or 0xFFFF means any type when searching. Provide one value per entry. Several types are added by separate calls.
  • container — Default -1: Items whose root container is a character (including nested bags and equipment). "my" = -1. ground, "ground", UO.Ground(), numeric 0 or 1 select the world: items on the ground and mobiles, except self. "backpack" or serial of container >1 search only for direct content, without recursion. The object alias resolves to serial; an incorrect alias can give 0, so check it with GetSerial in advance.
  • distance — Non-negative radius of cells by max(abs(dx),abs(dy)); diagonal - one cell. Affects search for ground; the direct contents of the container are not limited by distance. By default and with a negative argument, UO.FindDistance() is taken. 0 - the same X/Y.
  • notoriety — Default - 1, any code. A single number, the string "5|6" or a flat array of numbers specifies the allowed mobiles codes; With this filter, Items are excluded. Codes: 0 unknown, 1 innocent, 2 ally, 3 gray, 4 criminal, 5 enemy, 6 murderer, 7 invulnerable; the meaning of the relationship is determined by the server. An empty mask /any/-1 without specific codes is not restrictive. When mixing wildcards and codes, the specific codes remain a limitation. Non-numeric tokens are ignored next to valid ones; a mask of only erroneous tokens does not find anything.
  • nearest — Default false. false/0: list entry priority first, then lower priority serial. true/1: Distance first, then recording priority, then serial. This is an order, not an additional filter.
  • maxZ — Acceptable absolute difference between Z and the character, inclusive. The default or negative argument is UO.FindVertical(); 0 allows only the same Z. For an explicit serial container >1 the Z of the loaded container is taken (if there is none, Z of the thing); for other modes - Z candidate. The coordinates of a thing in gump are not the height of the world.
  • includeIgnored — By default false: serial from Ignore of this runtime are excluded. true/1 only includes them in this search and does not clear Ignore.

Return value

string: hex-serial of the first result (for example "0x40000011") or the empty string "" if there are no matches. This is ID, not type, quantity and not bool: check result != "", not result == true. With a normal non-empty query, FindItem stores the same ID number, FindCount() - the number of distinct objects, GetFoundItems() - an array of their numeric serial.

Behavior

  • 1 to 7 positional arguments; You can only skip the tail. To specify maxZ, pass the preceding arguments explicitly. The search is synchronous based on the locally loaded state: does not open the container, does not load content, does not check line of sight/availability, and does not attack.
  • Each object is included once, even if it matches several rules. Its priority is the first matched entry. The unknown name tries to be parsed as a type string; unreadable type/hue causes a conversion error.
  • A non-empty query clears previous FindItem/FindCount/GetFoundItems before selection; no matches leave empty results. Exception: An empty array or empty string list returns "" BEFORE searching and keeps the previous results. Do not count FindCount as a new result after such a call.
  • Changing the definitions of AddFindList/ClearFindList/DeleteFindList does not change the set already found. The other search in this runtime replaces FindItem and the overall array, so save GetFoundItems before the nested search.
  • 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.

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.FindList(new[] { 0x0EED }, "backpack");
UO.Print("FindList: " + Convert.ToString(result));

1. Select a resource by priority and transfer one stack - direct script

Parameters and execution flow:

  • When false, gold has priority over the second type even at greater distances. Radius 2 and maxZ=5 limit the candidates; they do not guarantee the right to pick up the thing.
  • This is a real game action: only the first object found is transferred. The result MoveItem does not mean the server has confirmed the entire move.
BuildLoot();
var item = UO.FindList("loot", "ground", 2, -1, false, 5);
if (Truth(item == ""))
{
    return null;
}
var accepted = UO.MoveItem(item, 0, "backpack");
if (Truth(accepted == 0))
{
    UO.Print("Move was not accepted");
}

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

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

2. Save the closest mobile of two notoriety - script function

Parameters and execution flow:

  • Seven parameters: two body, world, radius 12, codes 5 or 6, closest first, difference Z not more than 10, ignored excluded. There is only selection and saving; the attacking script must separately check for suitable conditions.
return  RunScenario();
 object? RunScenario()
{
    var target = UO.FindList("0x0190|0x0191", "ground", 12, "5|6", true, 10, false);
    if (Truth(target != ""))
    {
        UO.AddObject("candidate", target);
        UO.Print("Candidate: " + UO.GetName(target));
    }

    return null;
}

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

3. Count stocks of several types from an array - script class

Parameters and execution flow:

  • declaring the variable types[1] creates indices 0 and 1 in this engine. The units of the two types are summed, not the number of stacks. backpack limited to direct content; Inserted bags are not included here.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        dynamic[] types = new dynamic[checked((int)(1) + 1)];
        types[0] = 0x0EED;
        types[1] = 0x0F7A;
        var first = UO.FindList(types, "backpack");
        var total = 0;
        if (Truth(first != ""))
        {
            var items = UO.GetFoundItems();
            foreach (var item in items)
            {
                total += UO.FindCount(item);
            }
        }

        if (Truth(total < 100))
        {
            UO.Print("Stock below limit: " + Convert.ToString(total));
        }

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

Parameters: list (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(CompactFindList(values))

UO.FindList(list, container) — UO.FindList(Any,Any)

Parameters: list (Any), container (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(CompactFindList(values))

UO.FindList(list, container, distance) — UO.FindList(Any,Any,Any)

Parameters: list (Any), container (Any), distance (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(CompactFindList(values))

UO.FindList(list, container, distance, notoriety) — UO.FindList(Any,Any,Any,Any)

Parameters: list (Any), container (Any), distance (Any), notoriety (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(CompactFindList(values))

UO.FindList(list, container, distance, notoriety, nearest) — UO.FindList(Any,Any,Any,Any,Any)

Parameters: list (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 => new InjectionValue(CompactFindList(values))

UO.FindList(list, container, distance, notoriety, nearest, maxZ) — UO.FindList(Any,Any,Any,Any,Any,Any)

Parameters: list (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 => new InjectionValue(CompactFindList(values))

UO.FindList(list, container, distance, notoriety, nearest, maxZ, includeIgnored) — UO.FindList(Any,Any,Any,Any,Any,Any,Any)

Parameters: list (Any), container (Any), distance (Any), notoriety (Any), nearest (Any), maxZ (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 => new InjectionValue(CompactFindList(values))

Clone this wiki locally