Skip to content

EN UO Topic items Part 2

Codex edited this page Oct 12, 2026 · 3 revisions

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

Items — 2

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

Reference parts

1 · 2

Complete command reference


UO.MoveItem

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

C# signatures

int UO.MoveItem(object? id);
int UO.MoveItem(object? id, object? amount);
int UO.MoveItem(object? id, object? amount, object? targetContainer);
int UO.MoveItem(object? item, object? amount, object? container, object? x);
int UO.MoveItem(object? item, object? amount, object? container, object? x, object? y);
int UO.MoveItem(object? id, object? amount, object? targetContainer, object? x, object? y, object? z);
int UO.MoveItem(object? item, object? amount, object? container, object? x, object? y, object? z, object? timeout);
int UO.MoveItem(object? item, object? amount, object? container, object? x, object? y, object? z, object? timeout, object? waitConfirmation);

Transfers one specific item/stack via serial: capture and drop into a container or onto the ground.

Parameters

  • id — Serial of a specific item/character: number, hex/decimal string, self/backpack/lasttarget/lastobject/lastcontainer/lastcorpse/finditem/laststatus or saved name AddObject. This is not type. The object must be loaded; check Exists before taking action.
  • item — Serial of a specific item/character: number, hex/decimal string, self/backpack/lasttarget/lastobject/lastcontainer/lastcorpse/finditem/laststatus or saved name AddObject. This is not type. The object must be loaded; check Exists before taking action.
  • amount — Number of units inside one stack. 0 or a negative value means the entire stack; the positive is limited by the quantity available. It is NOT the number of stacks that limits MassMove. Default is 0.
  • targetContainer — Serial of the container or set name AddObject; backpack/self/my choose a backpack, receiving/catchbag - SetCatchBag, and without it a backpack. lastcontainer/lastobject/lasttarget/lastcorpse/finditem/laststatus are valid when resolved to the correct container. ground or 0 explicitly selects land; -1—the same backpack selector. An unknown or unspecified name causes an error before the item is captured. Without a destination argument, the backpack is used.
  • container — Serial of the container or set name AddObject; backpack/self/my choose a backpack, receiving/catchbag - SetCatchBag, and without it a backpack. lastcontainer/lastobject/lasttarget/lastcorpse/finditem/laststatus are valid when resolved to the correct container. ground or 0 explicitly selects land; -1—the same backpack selector. An unknown or unspecified name causes an error before the item is captured. Without a destination argument, the backpack is used.
  • x — With a container — X in the gump, default 65535 (automatic). When on the ground - world X, default character X.
  • y — Y in the gump or world Y; defaults to 65535 for container or Y character for land.
  • z — Height, by default 0 in a container or Z of a character on the ground.
  • timeout — Seventh argument: maximum wait in ms, default 1000; a negative value is equivalent to 0. Only used with the eighth waitConfirmation=true.
  • waitConfirmation — Eighth argument: true/1 includes the expectation of an observed change in the world; false/0 (default) returns the result of sending the request.

Return value

int 1 — the client accepted the capture and reset request; 0—request failed. When waitConfirmation=true, one additionally requires an observable change in container/coordinates or a decrease in the original stack. This is not the serial of the new stack or the number of transferred items. The server may refuse to operate.

The result of the command is a numeric flag: 1 means a fulfilled condition, 0 means an unfulfilled one. After var result = command(...) check if (result != 0) or if (result == 0). Save the result of one call: a repeated call can perform the action again or read the state that has already changed.

Behavior

  • All argument lengths from 1 to 8 are supported. Given x, you can omit y/z: the default values ​​described are used for them.
  • The known destination name is resolved before capture. For ground, use ground/0 explicitly; a typo in the name should not throw the item onto the floor.
  • The item can be in a chest, bag, or backpack: ground sets the destination on the ground, regardless of the original container. The first argument specifies the serial of the item itself, not the chest or type. The team performs the tackle itself; There is no need to first grab the item with the mouse.
  • When DropCheckCoord is turned on, dumping to the ground beyond two cells is rejected. The server additionally checks the availability of space. X/Y are map cells, not gump pixels; Z—height of the selected surface, including negative. For a container, X/Y still means the location inside its gump.
  • Waiting for confirmation uses the state of the client's world: for a partial stack - a decrease in quantity, for a whole - a container, for the ground another X/Y/Z. Inside the container, the exact location of the gump is not confirmed by this expectation; disappearing/merging stacks can complicate verification.
  • This is not a confirmation of a separate transaction ID. If the item was already in the same container, matching the container does not prove a new move within the gump.

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

1. The entire item in the backpack is a direct script

Parameters and execution flow:

  • loot - name AddObject; amount is missing and equal to 0, destination is backpack.
  • One item/stack is transferred, not all items of a given type.
var ok = UO.MoveItem("loot");
UO.Print("Move request: " + Convert.ToString(ok));

2. Part of the stack to a specific chest location - script function

Parameters and execution flow:

  • amount=10 units of one stack, chest is the name of the container, x/y=60/70 inside the gump, z=0.
  • The quantity does not have the "ten stacks" value adopted by MassMove.
return  RunScenario();
 object? RunScenario()
{
    var ok = UO.MoveItem("loot", 10, "chest", 60, 70, 0);
    return null;
}

3. The land under the character is a scenario class

Parameters and execution flow:

  • ground explicitly selects land; missing X/Y/Z are taken from the character.
  • For another point, pass its world coordinates, taking into account the range and DropCheckCoord.
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 ok = UO.MoveItem("loot", 0, "ground");
        return null;
    }
}

4. From the chest to the ground next to the character - direct script

Parameters and execution flow:

  • ground_item — saved serial of the selected item in an open chest. The original chest is not passed as a separate parameter. amount=0 takes the entire stack; for example, 10 will take up to ten units of this stack.
  • ground clearly selects land. x/y — absolute coordinates of the cell one cell along X from the character; z is taken from the character and is suitable if the adjacent surface is at the same height. On a staircase, table, or other floor, set the actual Z of the desired surface.
  • sent=1 means sending a request by the client; without the eighth parameter, server confirmation is not expected. The value 0 means the request failed. This is the numeric flag int 1/0: check sent != 0 or sent == 0; comparison with bool is not valid.
  • To reset directly at your feet, UO.MoveItem('ground_item', 0, 'ground') is enough: all three coordinates will be taken from the character. To place it inside a chest, instead of ground, specify the serial/name of the chest and the coordinates of its gump.
UO.AddObject("ground_item");
var x = UO.GetX() + 1;
var y = UO.GetY();
var z = UO.GetZ();
var sent = UO.MoveItem("ground_item", 0, "ground", x, y, z);
if (Truth(sent == 1))
{
    UO.Print("Ground move request sent");
}
else
{
    UO.Print("Ground move request was not sent");
}

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

5. Request Observable Confirmation - Script Function

Parameters and execution flow:

  • timeout=1500 ms is used because waitConfirmation=true. x/y=-1 — automatic place.
  • 0 may indicate a timeout for a request that has already been sent. Don't repeat the transfer blindly; Please check the current condition of the item first.
return  RunScenario();
 object? RunScenario()
{
    var ok = UO.MoveItem("loot", 0, "backpack", -1, -1, 0, 1500, true);
    if (Truth(ok == 0))
    {
        UO.Print("Move was rejected or not confirmed");
    }

    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.MoveItem(id) — UO.MoveItem(Any)

Parameters: id (Any)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int MoveItem(InjectionValue id)

            => CompactMoveItem(new[] { id });

UO.MoveItem(id, amount) — UO.MoveItem(Any,Any)

Parameters: id (Any), amount (Any)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int MoveItem(InjectionValue id, InjectionValue amount)

            => CompactMoveItem(new[] { id, amount });

UO.MoveItem(id, amount, targetContainer) — UO.MoveItem(Any,Any,Any)

Parameters: id (Any), amount (Any), targetContainer (Any)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int MoveItem(InjectionValue id, InjectionValue amount, InjectionValue targetContainer)

            => CompactMoveItem(new[] { id, amount, targetContainer });

UO.MoveItem(item, amount, container, x) — UO.MoveItem(Any,Any,Any,Any)

Parameters: item (Any), amount (Any), container (Any), x (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(CompactMoveItem(values))

UO.MoveItem(item, amount, container, x, y) — UO.MoveItem(Any,Any,Any,Any,Any)

Parameters: item (Any), amount (Any), container (Any), x (Any), y (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(CompactMoveItem(values))

UO.MoveItem(id, amount, targetContainer, x, y, z) — UO.MoveItem(Any,Any,Any,Any,Any,Any)

Parameters: id (Any), amount (Any), targetContainer (Any), x (Any), y (Any), z (Any)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int MoveItem(InjectionValue id, InjectionValue amount, InjectionValue targetContainer, InjectionValue x, InjectionValue y, InjectionValue z)

            => CompactMoveItem(new[] { id, amount, targetContainer, x, y, z });

UO.MoveItem(item, amount, container, x, y, z, timeout) — UO.MoveItem(Any,Any,Any,Any,Any,Any,Any)

Parameters: item (Any), amount (Any), container (Any), x (Any), y (Any), z (Any), timeout (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(CompactMoveItem(values))

UO.MoveItem(item, amount, container, x, y, z, timeout, waitConfirmation) — UO.MoveItem(Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: item (Any), amount (Any), container (Any), x (Any), y (Any), z (Any), timeout (Any), waitConfirmation (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(CompactMoveItem(values))

UO.MoveItems

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

C# signatures

dynamic UO.MoveItems(object? container, object? itemsType, object? itemsColor, object? moveIntoID, object? x, object? y, object? z, object? delayMS);

Transfers all suitable items directly from one container to another or to the ground. Items are selected by graphic and hue; each stack is transferred entirely. This is carrying things, not character walking or interactive activation of MassMove.

Parameters

  • container — Serial of the source container, such as backpack, "backpack", name AddObject, or hex-ID. The content must already be downloaded. 0 is not a valid source; ground does not select things around the character. For a backpack, use backpack rather than self.
  • itemsType - Graphic item, for example 0x0EED - gold. Not ID things and not the mobile body. Negative number or 0xFFFF - all types. Array/type mask is not accepted.
  • itemsColor — Hue things. -1 (or other negative number) and 0xFFFF - any; 0 - only hue 0. Not serial and not notoriety.
  • moveIntoID — Serial of the destination container or object alias. For your backpack - backpack. For land - the number 0 (also ground/"ground"/UO.Ground()). The source and destination must be different. -1 is not short for backpack in this command. Self - serial mobile rather than automatically replacing his backpack.
  • x — For a non-zero container, the position INSIDE its gump; -1,-1 leave the placement to the server. On the ground - world coordinates 0..65535, both are required and non-negative. Not the screen pixels of the game world and not the end point of the route.
  • y — For a non-zero container, the position INSIDE its gump; -1,-1 leave the placement to the server. On the ground - world coordinates 0..65535, both are required and non-negative. Not the screen pixels of the game world and not the end point of the route.
  • z — Height of the world when laid out on the ground; use the actual altitude of the site (protocol range -128..127). In the container example, indicate 0. This is not an equipment layer index.
  • delayMS — Delay between accepted requests in milliseconds. In reality, max(GrabDelay, max(0, DelayMS)); there is also a wait after the last transfer sent. 350 does not mean 350 items and does not guarantee confirmation in 350 ms.

Return value

Registration object? actually returns int 1/true if at least one transfer request is accepted, otherwise 0/false. This is not a number of items or a guarantee that ALL matches will be carried over. Check the content after the server responds. An emergency cancellation aborts the procedure and is not required to return false.

Behavior

  • All eight arguments are required. A list of direct children of the original container is created once; There is no recursive traversal. Once a bag is included in the list, it is moved as one item along with its contents, rather than being unpacked.
  • Takes the entire current stack of each match. The limit on the number of items or units is not set by this command; for such scenarios see UO.MassMove. Ignore is not used as an additional filter for this sample.
  • Before each action, it re-checks that the item is still in its original container. Prohibition of nesting a container in itself/descendant and unavailability of the item may result in a skip. A queue is not a transaction: actions already submitted are not rolled back.
  • If source=0, identical source/destination or ground with negative X/Y, returns 0 and reports an error. The server determines the resolution, range, capacity and final result. Do not perform other operations with lifted items at the same time.

Standalone C# scripts

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

Simple example

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

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

object? result = UO.MoveItems("lasttarget", 0x0EED, -1, "backpack", -1, -1, 0, 350);
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));

1. Collect gold from a selected chest into a backpack - direct script

Parameters and execution flow:

  • 0x0EED - type of gold; -1 to ItemsColor — any hue. -1,-1 after backpack - automatic position in the gump, not the ground. 350 ms - the minimum desired delay, taking into account GrabDelay. All straight stacks of gold are taken whole.
var source = Asc(UO.GetSerial("lasttarget"), 0);
if (Truth(source == 0) || Truth(source == UO.Backpack()) || !(Truth(UO.Exists(source))))
{
    return null;
}
var sent = UO.MoveItems(source, 0x0EED, -1, "backpack", -1, -1, 0, 350);
if (Truth(Truth(sent) == false))
{
    UO.Print("No gold transfer request was accepted");
}

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;

2. Place bandages in the specified location of the chest gump - script function

Parameters and execution flow:

  • 0x0E21 - bandages, not a human body. backpack - source, destination - serial of the chest. All matches are directed to one point 30,40; the server can merge the stacks or adjust the position.
return  RunScenario();
 object? RunScenario()
{
    var destination = Asc(UO.GetSerial("lasttarget"), 0);
    if (Truth(destination == 0) || Truth(destination == UO.Backpack()) || !(Truth(UO.Exists(destination))))
    {
        return null;
    }

    var sent = UO.MoveItems("backpack", 0x0E21, -1, destination, 30, 40, 0, 350);
    if (Truth(sent != 0))
    {
        UO.Print("Transfer requested; verify the destination contents");
    }

    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. Place all straight stacks of the selected type side by side on the ground - scenario class

Parameters and execution flow:

  • itemType specifies the type, not the quantity; all of its straight stacks are carried in a backpack. X+1/Y/Z is an example of an adjacent point at the same height: for a slope/wall, select the correct coordinate. 0 assignment is required for world mode. true only indicates an accepted request, not a freed backpack.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        if (!(Truth(DropTypeBesideMe(0x0EED))))
        {
            UO.Print("No ground drop request was accepted");
        }

        return null;
    }

    dynamic DropTypeBesideMe(dynamic itemType)
    {
        if (!(Truth(UO.Connected())) || Truth(UO.Dead()))
        {
            return false;
        }

        var x = UO.GetX() + 1;
        var y = UO.GetY();
        var z = UO.GetZ();
        return UO.MoveItems("backpack", itemType, -1, 0, x, y, z, 350);
    }

    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.MoveItems(container, itemsType, itemsColor, moveIntoID, x, y, z, delayMS) — UO.MoveItems(Any,Any,Any,Any,Any,Any,Any,Any)

Parameters: container (Any), itemsType (Any), itemsColor (Any), moveIntoID (Any), x (Any), y (Any), z (Any), delayMS (Any)

Result: dynamic / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "moveitems": return new InjectionValue(bridge.MoveItems(Arg(0), ResolveType(arguments[1]), Arg(2), Arg(3), Arg(4), Arg(5), Arg(6), Arg(7)));

UO.Name

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

C# signatures

string UO.Name();

Reads the character's name.

Parameters

There are no parameters.

Return value

string is a name known to the client. An empty string means an empty/unknown value or no object. This is not serial or a profile path. The game name/title is not translated by language IDE.

Behavior

  • Already received local data is read. The request does not open status and does not force the server to send an update. After death, map transition, or object deletion, the values ​​may change between two calls.
  • C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

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

1. Show text after login - direct script

Parameters and execution flow:

  • There are no parameters: self is read.
  • The empty string is handled explicitly; this is not the text "0".
var text = UO.Name();
if (Truth(text != ""))
{
    UO.Print(text);
}
else
{
    UO.Print("Text is unavailable");
}

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

2. Add text to log message - script function

Parameters and execution flow:

  • Your character is read, the value is stored as a line.
  • The + operator joins strings; Convert.ToString is not needed for this result.
return  RunScenario();
 object? RunScenario()
{
    var text = UO.Name();
    UO.Print("Player имя: " + text);
    return null;
}

3. Compare two snapshots - scenario class

Parameters and execution flow:

  • Both calls refer to self; UO.Wait sets the pause 1000 ms.
  • The difference may mean updating data or leaving the world. The example does not change the name or title.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

    async public Task<object?> RunScenarioAsync()
    {
        var previous = UO.Name();
        await Delay(1000);
        var current = UO.Name();
        if (Truth(previous != current))
        {
            UO.Print("Updated text: " + current);
        }

        return null;
    }

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

Command implementation

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

UO.Name() — UO.Name()

Parameters: No parameters.

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.

() => bridge.GetName(bridge.Self)

API creation: These functions register the API. They do not run again for every command call.


UO.Picking

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

C# signatures

int UO.Picking();

Checks whether the client's cursor is occupied by a picked up item.

Parameters

There are no parameters.

Return value

int 1 - ItemHold.Enabled set; 0 - not installed. This is a client state, not ID or server delivery confirmation. An object picked up by a mouse or other script is taken into account.

The result of the command is a numeric flag: 1 means a fulfilled condition, 0 means an unfulfilled one. After var result = command(...) check if (result != 0) or if (result == 0). Save the result of one call: a repeated call can perform the action again or read the state that has already changed.

Behavior

  • Reading does not pick up or drop an object.
  • For your own transfer, also check the result of Drag/DragItem; someone else's busy cursor does not mean that the desired item was successfully taken.

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

1. Show status - direct script

Parameters and execution flow:

  • There are no arguments.
  • 1 or 0 is displayed.
UO.Print(Convert.ToString(UO.Picking()));

2. Check occupied hands before grip - script function

Parameters and execution flow:

  • One Drag argument means the entire stack and timeout=0.
  • Picking checks the client's shared cursor. Do not run two independent migrations at the same time.
return  RunScenario();
 object? RunScenario()
{
    if (Truth(UO.Picking() == 0))
    {
        if (Truth(UO.Drag("loot")))
        {
            var dropped = UO.DropItem("backpack", -1, -1, 0);
        }
    }

    return null;
}

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

3. Wait for free cursor with limit - script class

Parameters and execution flow:

  • The check is repeated up to twenty times with pauses of 50 ms.
  • The command does not release the cursor or cancel someone else's move.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

    async public Task<object?> RunScenarioAsync()
    {
        var tries = 0;
        while (Truth(UO.Picking()) && Truth(tries < 20))
        {
            await Delay(50);
            tries = tries + 1;
        }

        if (Truth(UO.Picking()))
        {
            UO.Print("Cursor is still occupied");
        }

        return null;
    }

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

Command implementation

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

UO.Picking() — UO.Picking()

Parameters: No parameters.

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

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

UO.ReceiveObjectName

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

C# signatures

void UO.ReceiveObjectName(object? id);
void UO.ReceiveObjectName(object? id, object? timeout);

Requests the name of an object with a single-click request.

Parameters

  • id — Serial/ID object: int, numeric/hex string or set alias, for example "lasttarget". This is not a graphic/type. Check the loaded object before taking action.
  • timeout — Optional int, milliseconds; default is 0. A negative value does not add anticipation.

Return value

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

Behavior

  • Bridge.ReceiveObjectName calls Click(id), then waits until max(0,timeout) until GetName(id) is empty; pause no more than 25 ms. An already well-known name ends the wait immediately.
  • Without timeout, only Click is executed. There is no return name: read GetName separately; the end of the wait can mean timeout.

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

1. Direct call - direct script

Parameters and execution flow:

  • Requests the name of an object with a single-click request.
UO.ReceiveObjectName("lasttarget");

2. Explicit option - script function

Parameters and execution flow:

  • Bridge.ReceiveObjectName calls Click(id), then waits until max(0,timeout) until GetName(id) is empty; pause no more than 25 ms. An already well-known name ends the wait immediately.
return  RunScenario();
 object? RunScenario()
{
    if (Truth(UO.Exists("lasttarget")))
    {
        UO.ReceiveObjectName("lasttarget", 1000);
    }

    return null;
}

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

3. Full Helper Function - Script Class

Parameters and execution flow:

  • Without timeout, only Click is executed. There is no return name: read GetName separately; the end of the wait can mean timeout.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        var id = UO.GetSerial("lasttarget");
        if (Truth(UO.Exists(id)))
        {
            UO.ReceiveObjectName(id, 1000);
            UO.Print(UO.GetName(id));
        }

        return null;
    }

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

Command implementation

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

UO.ReceiveObjectName(id) — UO.ReceiveObjectName(Any)

Parameters: id (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

public void ReceiveObjectName(InjectionValue id) => bridge.ReceiveObjectName(GetObject(id), 0);

UO.ReceiveObjectName(id, timeout) — UO.ReceiveObjectName(Any,Any)

Parameters: id (Any), timeout (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

public void ReceiveObjectName(InjectionValue id, InjectionValue timeout) => bridge.ReceiveObjectName(GetObject(id), NumberConversions.ToInt(timeout));

UO.TicksUse

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

C# signatures

int UO.TicksUse();

Reads the saved mark TicksUse.

Parameters

There are no parameters.

Return value

int — mark UO.Timer in tenths of a second from the start of runtime. 0 - the mark has not yet been set or the event occurred in the first tenth of a second; it is not milliseconds or calendar time.

Behavior

  • Returns the field ticksUse. It is updated by UseObject; it is not automatic observation of all manual/server activities. The command itself does not change the mark.
  • UO.Timer() - the mark calculates the age in tenths of a second. Marks are not compared between different runtimes.

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

1. Direct call - direct script

Parameters and execution flow:

  • Reads the saved mark TicksUse.
var stamp = UO.TicksUse();
UO.Print(stamp);

2. Explicit option - script function

Parameters and execution flow:

  • Returns the field ticksUse. It is updated by UseObject; it is not automatic observation of all manual/server activities. The command itself does not change the mark.
return  RunScenario();
 object? RunScenario()
{
    var stamp = UO.TicksUse();
    var ageTenths = UO.Timer() - stamp;
    UO.Print(ageTenths);
    return null;
}

3. Full Helper Function - Script Class

Parameters and execution flow:

  • UO.Timer() - the mark calculates the age in tenths of a second. Marks are not compared between different runtimes.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        var before = UO.TicksUse();
        UO.Wait(250);
        var after = UO.TicksUse();
        UO.Print(before = after);
        return null;
    }
}

Command implementation

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

UO.TicksUse() — UO.TicksUse()

Parameters: No parameters.

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int TicksUse() => ticksUse;

UO.UpdateObject

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

C# signatures

void UO.UpdateObject(object? id);

Requests an update to an already loaded object.

Parameters

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

Return value

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

Behavior

  • For Mobile it is called RequestMobileStatus(..., true), for Item - SingleClick. If serial is not present in both local tables, there is no action. This is not downloading an unknown object or confirming an update.
  • Bridge sends the request on the game thread. Server rules apply; There is no built-in waiting for confirmation.

Standalone C# scripts

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

Simple example

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

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

UO.Print("Calling UO.UpdateObject");
UO.UpdateObject(UO.GetSerial("lasttarget"));

1. Direct call - direct script

Parameters and execution flow:

  • Requests an update to an already loaded object.
var id = UO.GetSerial("lasttarget");
if (Truth(UO.Exists(id)))
{
    UO.UpdateObject(id);
}

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

2. Explicit option - script function

Parameters and execution flow:

  • For Mobile it is called RequestMobileStatus(..., true), for Item - SingleClick. If serial is not present in both local tables, there is no action. This is not downloading an unknown object or confirming an update.
return  RunScenario();
 object? RunScenario()
{
    var id = UO.GetSerial("self");
    if (Truth(UO.Exists(id)))
    {
        UO.UpdateObject(id);
    }

    return null;
}

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

3. Full Helper Function - Script Class

Parameters and execution flow:

  • Bridge sends the request on the game thread. Server rules apply; There is no built-in waiting for confirmation.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        ApplyToLoaded(UO.GetSerial("lasttarget"));
        return null;
    }

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

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

Command implementation

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

UO.UpdateObject(id) — UO.UpdateObject(Any)

Parameters: id (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

public void UpdateObject(InjectionValue id) => bridge.UpdateObject(GetObject(id));

UO.UseFromGround

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

C# signatures

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

Searches for an object of the given graphic on the ground/in the world and immediately calls its application. Typically used for nearby objects, such as opening a backpack. An important feature of this runtime: the search is based on FindType and can also find mobile with the same body; This is not strictly an item-only selection. For items with an explicit radius and closest selection, use UseType(..., ground, ...).

Parameters

  • type — Mandatory graphic. For example, 0x0E75 is a backpack. Number or numeric hex string; negative number/0xFFFF — any graphic. Body values ​​such as 0x0190 (male) and 0x0191 (female) can select mobile; do not substitute them for the type of the item. Two types are not transmitted at the same time by this form.
  • color - Optional hue, default - 1 (any). Negative number/0xFFFF - any, 0 - only hue 0. There are no other parameters: container, distance, nearest and maxZ are not added to this command.

Return value

int - serial of the first object found, passed to UseObject, or 0. This is not the number of objects, not graphic and not true/false. The object may be found, but the server may not allow it to be used. Check id != 0 and the expected game effect separately.

Behavior

  • Uses the current FindDistance and FindVertical, takes into account Ignore. The search container is fixed to ground, nested content is not traversed. Mobiles exclude self; there is no separate restriction on life/visibility/notoriety.
  • Updates FindItem/FindCount/GetFoundItems with all search matches, but only applies the first result. The closest one is not guaranteed; world objects are checked before mobiles.
  • Does not pick up an item in the backpack, does not move the character, does not wait for a server response or the end of the target. If there is no match, prints a message. To search without an action, use UO.FindType.

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

1. Open a lying backpack of a standard type - direct script

Parameters and execution flow:

  • type only; any hue. The current FindDistance/FindVertical are used. bag - ID of the first result, not necessarily the closest one. The content will only open if the server allows it.
var bag = UO.UseFromGround(0x0E75);
if (Truth(bag != 0))
{
    UO.AddObject("ground_bag", bag);
}
else
{
    UO.Print("No loaded ground backpack matches the search settings");
}

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

2. Apply a backpack of the desired color nearby at the same height - script function

Parameters and execution flow:

  • The search is limited to two cells and the same Z. The color 0x0044 is given as an example: replace it with the hue of your item. Settings are restored even if there is an error.
return  RunScenario();
 object? RunScenario()
{
    var oldDistance = UO.FindDistance();
    var oldZ = UO.FindVertical();
    try
    {
        UO.FindDistance(2);
        UO.FindVertical(0);
        var bag = UO.UseFromGround(0x0E75, 0x0044);
        if (Truth(bag != 0))
        {
            UO.AddObject("colored_ground_bag", bag);
        }
    }
    finally
    {
        UO.FindDistance(oldDistance);
        UO.FindVertical(oldZ);
    }

    return null;
}

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

3. Full Function with Explicit Search Radius - Script Class

Parameters and execution flow:

  • radius specifies FindDistance rather than the third argument UseFromGround. 3000 ms — time for viewing the example, not confirmation of opening; window type 3 - container. The results of this search remain in Find*.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

    async public Task<object?> RunScenarioAsync()
    {
        var selected = OpenGroundBagWithin(2);
        if (Truth(selected != 0))
        {
            await Delay(3000);
            UO.CloseClientUIWindow(3, selected);
        }

        return null;
    }

    dynamic OpenGroundBagWithin(dynamic radius)
    {
        var previous = UO.FindDistance();
        try
        {
            UO.FindDistance(radius);
            return UO.UseFromGround(0x0E75, -1);
        }
        finally
        {
            UO.FindDistance(previous);
        }
    }

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

Command implementation

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

UO.UseFromGround(type) — UO.UseFromGround(Any)

Parameters: type (Any)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int UseFromGround(InjectionValue type) => UseFromGround(type, new InjectionValue(-1));

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

Parameters: type (Any), color (Any)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int UseFromGround(InjectionValue type, InjectionValue color)

        {

            int id = bridge.FindType(ResolveType(type), NumberConversions.ToInt(color), 1, -1, false);

            if (id != 0)

                UseObject(id);

            else

                SystemMessage("No matching item found on ground.");

            return id;

        }

UO.UseItemOnMobile

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

C# signatures

void UO.UseItemOnMobile(object? itemSerial, object? targetSerial);

Prepares the character's target and uses the item.

Parameters

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

Return value

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

Behavior

  • ExecuteClientApiCompatibility first calls bridge.WaitTargetObject(TargetSerial), then bridge.UseObject(ItemSerial). Arguments are not swapped. These direct bridge calls do not update the TicksTarget/TicksUse runtime.
  • Does not check target/item type and does not wait for cursor. Preparing the target before use prevents a quickly arriving target from being missed, but the server still determines whether the action is valid.

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.UseItemOnMobile");
UO.UseItemOnMobile("0x40001234", "self");

1. Direct call - direct script

Parameters and execution flow:

  • Prepares the character's target and uses the item.
UO.UseItemOnMobile("0x40001234", "self");

2. Explicit option - script function

Parameters and execution flow:

  • ExecuteClientApiCompatibility first calls bridge.WaitTargetObject(TargetSerial), then bridge.UseObject(ItemSerial). Arguments are not swapped. These direct bridge calls do not update the TicksTarget/TicksUse runtime.
return  RunScenario();
 object? RunScenario()
{
    var item = UO.GetSerial("lastobject");
    var mobile = UO.GetSerial("lasttarget");
    if (Truth(UO.Exists(item)) && Truth(UO.Exists(mobile)))
    {
        UO.UseItemOnMobile(item, mobile);
    }

    return null;
}

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

3. Full Helper Function - Script Class

Parameters and execution flow:

  • Does not check target/item type and does not wait for cursor. Preparing the target before use prevents a quickly arriving target from being missed, but the server still determines whether the action is valid.
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("lastobject");
        if (Truth(UO.Exists(item)))
        {
            UO.UseItemOnMobile(item, "self");
            UO.Print(UO.Waiting());
        }

        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.UseItemOnMobile(itemSerial, targetSerial) — UO.UseItemOnMobile(Any,Any)

Parameters: itemSerial (Any), targetSerial (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "useitemonmobile": bridge.WaitTargetObject(Arg(1)); bridge.UseObject(Arg(0)); return InjectionValue.Unit;

UO.UseObject

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

C# signatures

void UO.UseObject(object? objID);

Requests the use of an object by serial. Bridge calls GameActions.DoubleClick; The item is not searched by type.

Parameters

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

Return value

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

Behavior

  • GetObject allows alias; unknown name gives -1. After the call, runtime updates TicksUse with the value of UO.Timer; This is the moment of the request, not the server's confirmation.
  • Bridge sends the request on the game thread. Server rules apply; There is no built-in waiting for confirmation.

Standalone C# scripts

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

Simple example

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

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

UO.Print("Calling UO.UseObject");
UO.UseObject(UO.GetSerial("lasttarget"));

1. Direct call - direct script

Parameters and execution flow:

  • Requests the use of an object by serial. Bridge calls GameActions.DoubleClick; The item is not searched by type.
var id = UO.GetSerial("lasttarget");
if (Truth(UO.Exists(id)))
{
    UO.UseObject(id);
}

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

2. Explicit option - script function

Parameters and execution flow:

  • GetObject allows alias; unknown name gives -1. After the call, runtime updates TicksUse with the value of UO.Timer; This is the moment of the request, not the server's confirmation.
return  RunScenario();
 object? RunScenario()
{
    var id = UO.GetSerial("self");
    if (Truth(UO.Exists(id)))
    {
        UO.UseObject(id);
    }

    return null;
}

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

3. Full Helper Function - Script Class

Parameters and execution flow:

  • Bridge sends the request on the game thread. Server rules apply; There is no built-in waiting for confirmation.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        ApplyToLoaded(UO.GetSerial("lasttarget"));
        return null;
    }

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

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

Command implementation

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

UO.UseObject(objID) — UO.UseObject(Any)

Parameters: objID (Any/Integer/String)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "useobject": bridge.UseObject(Arg(0)); return InjectionValue.Unit;

UO.UseObject(objID) — UO.UseObject(Integer)

Parameters: objID (Any/Integer/String)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

public void UseObject(int id)

        {

            bridge.UseObject(id);

            ticksUse = Timer();

        }

UO.UseObject(objID) — UO.UseObject(String)

Parameters: objID (Any/Integer/String)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

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

UO.UseType

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

C# signatures

int UO.UseType(object? @type);
int UO.UseType(object? @type, object? color);
int UO.UseType(object? @type, object? color, object? container);
int UO.UseType(object? @type, object? color, object? container, object? distance);
int UO.UseType(object? @type, object? color, object? container, object? distance, object? nearest);
int UO.UseType(object? @type, object? color, object? container, object? distance, object? nearest, object? maxZ);

Finds one item of the desired graphic/type and applies it. For example, drink a potion from a backpack, open a nearby backpack, or use an item from a selected container. This command does not search for or move the character. If the item requires a target cursor, the target must be prepared separately.

Parameters

  • type — Graphic of the item: number or hex string; for example, 0x0F0C is a type of healing potion, 0x0E75 is a backpack. This is not a serial or a body character. A negative number or 0xFFFF allows any type; for meaningful action, accurate graphic is better.
  • color — Hue of the item, default - 1 (any). Any negative number or 0xFFFF removes the filter; 0 chooses the unpainted item. Not notoriety and not the color of the text.
  • container — Default -1: your backpack and loaded subcontainers. "my" means the same thing. "backpack" or the explicit serial of the container specifies the root of the recursive traversal. ground/"ground"/UO.Ground(), numeric 0/1 denote only objects of the world. Self is not a synonym for backpack; use an explicit backpack. An unknown/null object alias can be resolved as a knapsack: first check the transferred container using Exists.
  • distance — Maximum geometric X/Y range, not path length. The default or negative argument is FindDistance. 0 means the same cell. For items in a container, the client takes into account the distance to the owner.
  • nearest — Default true: select the closest thing, if equal, the smaller one serial. false: First found in traversal without sorting. Not the number of items or the running mode.
  • maxZ — Maximum absolute difference between the world height Z and the character. The default or negative argument is FindVertical. 0 requires the same Z. For the item in the bag, the height of the outer container on the ground or the owner character is used; internal gump coordinates are not considered world coordinates. This is a height filter, not a walkability or line of sight check.

Return value

int - serial of the item for which UseObject is called; 0 if there are no matches. Even registration with ReturnKind object? actually returns a number. This is not true/false or confirmation of use by the server: check used != 0 rather than used == true. A separate check for status, content, or log is required for the effect to be successful.

Behavior

  • From 1 to 6 arguments. To set the range, also specify color and container. To specify maxZ, complete all six positions. Array type, mask via | and additional goals are not accepted by this command.
  • Regular forms with int/string and extended forms use CompactUseType: items only, Ignore, distance and height; containers are traversed recursively over already loaded content. The loading container does not open automatically. FindItem/FindCount/GetFoundItems are not updated by this branch.
  • The height of shared owners and containers is calculated once per call to avoid repeating the traversal for each stack. A circular or excessively deep chain of containers (128 links without a root found) is not used as a height match.
  • Maintained a common compatible registration of two object?: it routes a call to bridge.UseType using FindType over the knapsack, updating Find* and selecting the first result. For a predictable compact form, use int/string rather than implicit conversions of inappropriate value types.
  • UseObject sends a cast action, but the command does not wait for target, healing, drinking, opening a window, or server failure. The search range does not extend the range of use allowed by the server.
  • If there is no match, the compact form prints the message and returns 0. If there is no character/connection, the result should not be considered permission to act. For precise ID use UO.UseObject.

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

1. Apply a healing potion from a backpack - direct script

Parameters and execution flow:

  • 0x0F0C is an example of a standard type of healing potion. The server may reject the action due to character condition, latency, or its own rules. Color and range are not specified separately: defaults apply.
if (!(Truth(UO.Connected())) || Truth(UO.Dead()))
{
    return null;
}
var used = UO.UseType(0x0F0C);
if (Truth(used == 0))
{
    UO.Print("No matching healing potion in the loaded backpack");
}
else
{
    UO.Print("Potion use requested; check health and the game message");
}

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

2. Open the nearest backpack on the ground within two cells - script function

Parameters and execution flow:

  • 0x0E75 - type of backpack, -1 - any hue, ground - objects of the world. 2 - cells X/Y, true - closest, 4 - difference Z. Return bag - ID. Access to content is determined by the server; the team does not pick up the backpack.
return  RunScenario();
 object? RunScenario()
{
    var bag = UO.UseType(0x0E75, -1, "ground", 2, true, 4);
    if (Truth(bag != 0))
    {
        UO.AddObject("nearby_bag", bag);
    }
    else
    {
        UO.Print("No suitable ground backpack within the selected bounds");
    }

    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. Use an item from a pre-selected container - scenario class

Parameters and execution flow:

  • itemType - graphic things, source - a separate serial container. The helper returns serial/0 the same as UseType. Even a found item may be prohibited by the server from being used from someone else’s or a remote container.
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 source = Asc(UO.GetSerial("lasttarget"), 0);
        if (Truth(source == 0) || !(Truth(UO.Exists(source))))
        {
            return null;
        }

        UO.AddObject("supply", source);
        var used = UseFromNamedSupply(0x0F0C);
        if (Truth(used == 0))
        {
            UO.Print("Supply item was not found with these filters");
        }

        return null;
    }

    dynamic UseFromNamedSupply(dynamic itemType)
    {
        var source = Asc(UO.GetSerial("supply"), 0);
        if (Truth(source == 0) || !(Truth(UO.Exists(source))))
        {
            return 0;
        }

        return UO.UseType(itemType, 0, source, 2, false, 16);
    }

    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;
}

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.UseType(type) — UO.UseType(Integer)

Parameters: type (Integer/String)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int UseType(int type) => UseType(type, -1);

UO.UseType(type) — UO.UseType(String)

Parameters: type (Integer/String)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int UseType(string type) => UseType(ResolveType(type));

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

Parameters: type (Any/Integer/String), color (Any/Integer/String)

Result: int / Any.

During a call:

Internal implementation code; this is not a standalone script.

case "usetype": return new InjectionValue(bridge.UseType(ResolveType(arguments[0]), arguments.Length > 1 ? Arg(1) : -1));

UO.UseType(type, color) — UO.UseType(Integer,Integer)

Parameters: type (Any/Integer/String), color (Any/Integer/String)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int UseType(int type, int color) => CompactUseType(new[]

        {

            new InjectionValue(type),

            new InjectionValue(color)

        });

UO.UseType(type, color) — UO.UseType(Integer,String)

Parameters: type (Any/Integer/String), color (Any/Integer/String)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int UseType(int type, string color) => UseType(type, NumberConversions.ToInt(color));

UO.UseType(type, color) — UO.UseType(String,Integer)

Parameters: type (Any/Integer/String), color (Any/Integer/String)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int UseType(string type, int color) => UseType(ResolveType(type), color);

UO.UseType(type, color) — UO.UseType(String,String)

Parameters: type (Any/Integer/String), color (Any/Integer/String)

Result: int / Integer.

During a call:

Internal implementation code; this is not a standalone script.

public int UseType(string type, string color) => UseType(ResolveType(type), NumberConversions.ToInt(color));

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

Parameters: type (Any), color (Any), container (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(CompactUseType(values))

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

Parameters: type (Any), color (Any), container (Any), distance (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(CompactUseType(values))

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

Parameters: type (Any), color (Any), container (Any), distance (Any), nearest (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(CompactUseType(values))

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

Parameters: type (Any), color (Any), container (Any), distance (Any), nearest (Any), maxZ (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(CompactUseType(values))

UO.UseWorldObject

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

C# signatures

void UO.UseWorldObject(object? serialOrName);

Enables serialOrName through GetObject and calls UseObject. The string name is an object alias, not a graphic/type name.

Parameters

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

Return value

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

Behavior

  • Registered in metadata directly to UserObject. This is a common use of serial, not searching the entire server world.
  • Bridge sends the request on the game thread. Server rules apply; There is no built-in waiting for confirmation.

Standalone C# scripts

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

Simple example

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

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

UO.Print("Calling UO.UseWorldObject");
UO.UseWorldObject(UO.GetSerial("lasttarget"));

1. Direct call - direct script

Parameters and execution flow:

  • Enables serialOrName through GetObject and calls UseObject. The string name is an object alias, not a graphic/type name.
var id = UO.GetSerial("lasttarget");
if (Truth(UO.Exists(id)))
{
    UO.UseWorldObject(id);
}

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

2. Explicit option - script function

Parameters and execution flow:

  • Registered in metadata directly to UserObject. This is a common use of serial, not searching the entire server world.
return  RunScenario();
 object? RunScenario()
{
    var id = UO.GetSerial("self");
    if (Truth(UO.Exists(id)))
    {
        UO.UseWorldObject(id);
    }

    return null;
}

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

3. Full Helper Function - Script Class

Parameters and execution flow:

  • Bridge sends the request on the game thread. Server rules apply; There is no built-in waiting for confirmation.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        ApplyToLoaded(UO.GetSerial("lasttarget"));
        return null;
    }

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

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

Command implementation

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

UO.UseWorldObject(serialOrName) — UO.UseWorldObject(Any)

Parameters: serialOrName (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

public void UserObject(InjectionValue serialOrName)

            => UseObject(GetObject(serialOrName));

UO.UserObject

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

C# signatures

void UO.UserObject(object? serialOrName);

Enables serialOrName through GetObject and calls UseObject. The string name is an object alias, not a graphic/type name.

Parameters

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

Return value

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

Behavior

  • Same usage path as UO.UseWorldObject. The command does not create a custom object or add the name AddObject.
  • Bridge sends the request on the game thread. Server rules apply; There is no built-in waiting for confirmation.

Standalone C# scripts

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

Simple example

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

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

UO.Print("Calling UO.UserObject");
UO.UserObject(UO.GetSerial("lasttarget"));

1. Direct call - direct script

Parameters and execution flow:

  • Enables serialOrName through GetObject and calls UseObject. The string name is an object alias, not a graphic/type name.
var id = UO.GetSerial("lasttarget");
if (Truth(UO.Exists(id)))
{
    UO.UserObject(id);
}

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

2. Explicit option - script function

Parameters and execution flow:

  • Same usage path as UO.UseWorldObject. The command does not create a custom object or add the name AddObject.
return  RunScenario();
 object? RunScenario()
{
    var id = UO.GetSerial("self");
    if (Truth(UO.Exists(id)))
    {
        UO.UserObject(id);
    }

    return null;
}

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

3. Full Helper Function - Script Class

Parameters and execution flow:

  • Bridge sends the request on the game thread. Server rules apply; There is no built-in waiting for confirmation.
return  new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
    private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
    private readonly Func<int, Task> WaitAsync;
    private readonly string[] Args;
    private readonly CancellationToken Cancellation;
    private readonly Action Checkpoint;
    public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
    {
        UO = api;
        WaitAsync = wait;
        Args = args;
        Cancellation = cancellation;
        Checkpoint = checkpoint;
    }

     public object? RunScenario()
    {
        ApplyToLoaded(UO.GetSerial("lasttarget"));
        return null;
    }

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

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

Command implementation

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

UO.UserObject(serialOrName) — UO.UserObject(Any)

Parameters: serialOrName (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

public void UserObject(InjectionValue serialOrName)

            => UseObject(GetObject(serialOrName));

Clone this wiki locally