Repository navigation
EN UO Topic containers
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
Home · C# · IDE · UO API · A–Z · Examples · Languages
Read content, open and select destination container. A closed or not yet loaded container does not provide the client with a complete list of items.
| Topic | Commands and explanations |
|---|---|
| Backpack | UO.Backpack |
| Bank | UO.ObjAtLayerEx · UO.OpenContainer |
| OpenContainer | UO.OpenContainer |
| LastContainer | UO.LastContainer |
| ContainerOf | UO.ContainerOf · UO.GetParent |
| IsContainer | UO.IsContainer |
| Nested Containers | UO.GetContent · UO.FindTypeEx · UO.FindTypesArrayEx |
| Receiving Container | UO.SetReceivingContainer · UO.UnsetReceivingContainer |
| Catch Bag | UO.SetCatchBag · UO.UnsetCatchBag |
| Container Transfers | UO.MoveItem · UO.MoveItems · UO.MassMove · UO.EmptyContainer |
UO.ContainerOf · UO.GetParent · UO.ContainerOff
UO.SetReceivingContainer · UO.UnsetReceivingContainer
UO.SetCatchBag · UO.UnsetCatchBag
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.
Parameters, result and all scenarios
UO.OpenContainer("lasttarget");Parameters, result and all scenarios
UO.Print("Select a chest or corpse");
var sent = UO.EmptyContainer(350);
if (Truth(sent == 0))
{
UO.Print("Cancelled, empty, unavailable, or a transfer failed");
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.Backpack();Returns the ID of the current character's equipped backpack.
There are no parameters.
int - serial/ID, not graphic/type, layer, number of items or bool. 0—there is no current object. All 32 bits serial are saved; check != 0, not == true or > 0. The saved result is not updated itself. Searches for an undeleted item on layer Backpack of the current Player. No/destroyed Player, no backpack or bag removed - 0. Returns the container, not the contents; does not create a new bag.
- There are no parameters. Reads local data via Invoke on the game thread; canceling the script interrupts the wait for that thread. Does not send the package, does not open the container/target, and does not transfer the item.
- The built-in self/backpack without parentheses is read again unless overridden by a script variable. String names are processed by the receiving command. In the carry destination, "self" means the backpack, and UO.Self() returns the character's serial. For the ID container, use UO.Backpack() explicitly.
- World.Clear removes Player; subsequent readings yield 0. Entering the world or changing the equipped bag can change ID. Individual reads are not atomic. A nonzero ID does not prove connection, server resolution, or content loading.
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.
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.Backpack();
UO.Print("Backpack: " + Convert.ToString(result));Parameters and execution flow:
- id stores the result of one call; HEX formats serial for log. The example doesn't select or use anything.
var id = UO.Backpack();
UO.Print("ID: " + Hex(id));
string Hex(object? value) => Convert.ToInt64(value).ToString("X");Parameters and execution flow:
- before/after are read at intervals of 250 ms. UO.Wait added for example only. Equality means identical final ID; intermediate changes may be missed.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.Backpack();
await Delay(250);
var after = UO.Backpack();
if (Truth(before != after))
{
UO.Print("ID changed: " + Hex(after));
}
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
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;Parameters and execution flow:
- candidate - saved ID LastTarget. IsOwnSerial(candidate) takes one serial and returns bool: true for the current non-zero own ID, otherwise false. The function definition is given in full; target does not change.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var candidate = UO.LastTarget();
if (Truth(Truth(IsOwnSerial(candidate)) == true))
{
UO.Print("Own object selected");
}
else
{
UO.Print("Different object or no own object");
}
return null;
}
dynamic IsOwnSerial(dynamic candidate)
{
var current = UO.Backpack();
return Truth(current != 0) && Truth(current == candidate);
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Backpack:bridge.Backpack.
Internal implementation code; this is not a standalone script.
case "backpack": return new InjectionValue(bridge.Backpack);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
string UO.ContainerOf(object? name);Reads the item's immediate parent.
-
name— 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.
string of the form "0x40001234" - serial of the container/owner character. For an item on the ground it is either "0x00000000" or "0xFFFFFFFF". For unknown name/object or Mobile - "0x00000000". This is not the graphic of the container, not the ID of the item itself, and not the root owner of the nested bag.
- The Container field of a local item is read, without recursive traversal and calling the server. Check Exists before interpreting a null result. Ground uses two valid representations.
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.
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.ContainerOf("backpack");
UO.Print("ContainerOf: " + Convert.ToString(result));Parameters and execution flow:
- item — serial of the found stack. type=0x0EED is transmitted only FindType.
- parent denotes the actual backpack, not the character that contains the backpack.
var item = UO.FindType(0x0EED, -1, "backpack");
if (Truth(item != ""))
{
var parent = UO.ContainerOf(item);
UO.Print(Convert.ToString(parent));
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- The argument is the backpack itself.
- The parent of the equipped backpack will be the character's serial.
return RunScenario();
object? RunScenario()
{
var bag = UO.GetSerial("backpack");
if (Truth(UO.Exists(bag)))
{
UO.Print(Convert.ToString(UO.ContainerOf(bag)));
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- GetContent("ground") gives ID items outside containers.
- Both representations of land are valid. One null parent without Exists is not enough to infer the position of an item.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var items = UO.GetContent("ground");
if (Truth(ArrayLength(items) > 0))
{
var item = items[0];
if (Truth(UO.Exists(item)))
{
UO.Print(Convert.ToString(UO.ContainerOf(item)));
}
}
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;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: name (Any)
Result: string / String.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ContainerOf. -
InjectionScript.Runtime.InjectionApiUO.TryGetObject:TryGetObject(name, out int id). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ContainerOf:bridge.ContainerOf(id).
Internal implementation code; this is not a standalone script.
public string ContainerOf(InjectionValue name)
{
if (TryGetObject(name, out int id))
{
var containerId = bridge.ContainerOf(id);
if (containerId < 0)
return "0xFFFFFFFF";
return $"0x{containerId:X8}";
}
return "0x00000000";
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.ContainerOff();Resets the designated receiving runtime container.
There are no parameters.
void - no return value.
- Calls UnsetReceivingContainer and writes State.ReceivingContainer=0. The following Grab operations without an explicit assignment use the backpack if one is available. Items do not move and the container window does not close.
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.
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.ContainerOff");
UO.ContainerOff();Parameters and execution flow:
- State ReceivingContainer becomes 0.
UO.ContainerOff();Parameters and execution flow:
- The assignment is cleared; the action does not move the content.
return RunScenario();
object? RunScenario()
{
UO.SetReceivingContainer("backpack");
UO.ContainerOff();
return null;
}Parameters and execution flow:
- The null state allows for repeated reset.
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.ContainerOff();
UO.ContainerOff();
return null;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.UnsetReceivingContainer. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.UnsetReceivingContainer:bridge.UnsetReceivingContainer().
Internal implementation code; this is not a standalone script.
public void UnsetReceivingContainer() => bridge.UnsetReceivingContainer();Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.GetContent(object? id);Reads the direct contents of a container or loaded items on the ground.
-
id— Serial/ID of a specific object: int, decimal/hex string or set alias self, backpack, lasttarget, lastobject or name AddObject. This is not graphic/type. The lines my/backpack select the backpack. Only explicit 0, "0" or "ground" select land. An unknown alias, a missing backpack, a negative ID, or an inappropriate value type results in an empty array.
Array - serial of each direct child. For ground/0 - items outside containers; Both normal ground marks 0 and 0xFFFFFFFF are taken into account. Without entries, an empty Array is returned. The list contains ID, not type and no layers.
- Data already downloaded by the client is read. The command does not open the container, move items, or download objects from the entire server.
- Array - array with indices starting from 0. Store it in var, check ArrayLength before accessing. Elements may disappear from the world after taking a snapshot: check Exists(serial) before taking action.
- There is no recursive traversal of nested bags, sorting by distance, Ignore filter, or FindDistance/FindVertical. The regular FindType snapshot remains unchanged.
- An unopened chest may appear empty: the absence of received data does not prove the server is empty. First use open container and wait for its contents.
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.
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.GetContent("backpack");
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- ID="backpack" - current character’s backpack, direct nested items only.
- Length - number of records/ID. This is not the amount of Amount in stacks. The empty list gives 0.
var items = UO.GetContent("backpack");
UO.Print(Convert.ToString(ArrayLength(items)));
int ArrayLength(object? value) => value is System.Array array ? array.Length : 0;Parameters and execution flow:
- ID="backpack" - current character’s backpack, direct nested items only.
- items[i] — numeric serial. Hex is used for output only. The loop does not access the last index.
return RunScenario();
object? RunScenario()
{
var items = UO.GetContent("backpack");
var i = 0;
while (Truth(i < ArrayLength(items)))
{
UO.Print("0x" + Hex(items[i]));
i = i + 1;
}
return null;
}
int ArrayLength(object? value) => value is System.Array array ? array.Length : 0;
string Hex(object? value) => Convert.ToInt64(value).ToString("X");
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- ID="backpack" - current character’s backpack, direct nested items only.
- Two different things are checked: the record in the snapshot and the existence of the object now. Order without explicit sorting does not mean closeness.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var items = UO.GetContent("backpack");
if (Truth(ArrayLength(items) > 0))
{
var first = items[0];
if (Truth(UO.Exists(first)))
{
UO.Print(UO.GetName(first));
}
}
else
{
UO.Print("Empty list");
}
return null;
}
int ArrayLength(object? value) => value is System.Array array ? array.Length : 0;
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}Parameters and execution flow:
- ID="ground" clearly selects land. NPC/players are not included in this list.
- The search radius here is not limited to FindDistance. For the type and distance filter there is GetWorldItems(type,color,distance).
var groundItems = UO.GetContent("ground");
UO.Print(Convert.ToString(ArrayLength(groundItems)));
int ArrayLength(object? value) => value is System.Array array ? array.Length : 0;C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: id (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0). -
InjectionScript.Runtime.NumberConversions.TryStr2Int:NumberConversions.TryStr2Int(text, out int literal). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(text). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetEquipment:bridge.GetEquipment(container). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetContent:bridge.GetContent(container). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Backpack:bridge.Backpack.
Internal implementation code; this is not a standalone script.
case "getcontent":
case "getequipment":
{
InjectionValue selection = arguments[0];
bool ground = false, explicitZero;
int container;
if (selection.Kind == InjectionValueKind.String)
{
string text = Text(0).Trim();
ground = text.Equals("ground", StringComparison.OrdinalIgnoreCase);
explicitZero = NumberConversions.TryStr2Int(text, out int literal) && literal == 0;
container = ground ? 0 : text.Equals("my", StringComparison.OrdinalIgnoreCase)
? bridge.Backpack : GetObject(text);
}
else
{
if (selection.Kind != InjectionValueKind.Integer && selection.Kind != InjectionValueKind.Decimal)
return new InjectionValue(Array.Empty<InjectionValue>());
container = Arg(0);
explicitZero = selection.Kind == InjectionValueKind.Integer ? selection.Integer == 0 : selection.Decimal == 0d;
}
// Only an explicit ground/zero selector may query world items.
if (container < 0 || container == 0 && !ground && !explicitZero)
return new InjectionValue(Array.Empty<InjectionValue>());
bool equipment = name.Equals("GetEquipment", StringComparison.OrdinalIgnoreCase);
int[] items = equipment
? container == 0 ? Array.Empty<int>() : bridge.GetEquipment(container)
: bridge.GetContent(container);
return new InjectionValue(items.Select(serial => new InjectionValue(serial)).ToArray());
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.GetParent(object? objID);Reads the item's immediate parent.
-
objID— 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.
int — serial of the container/owner character. For an item on the ground, it is 0 or -1 (bits 0xFFFFFFFF), depending on the client's entry. For an unknown object or Mobile - 0. This is not the graphic of the container, not the ID of the item itself, and not the root owner of the nested bag.
- The Container field of a local item is read, without recursive traversal and calling the server. Check Exists before interpreting a null result. Ground uses two valid representations.
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.
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.GetParent("backpack");
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- item — serial of the found stack. type=0x0EED is transmitted only FindType.
- parent denotes the actual backpack, not the character that contains the backpack.
var item = UO.FindType(0x0EED, -1, "backpack");
if (Truth(item != ""))
{
var parent = UO.GetParent(item);
UO.Print(Convert.ToString(parent));
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- The argument is the backpack itself.
- The parent of the equipped backpack will be the character's serial.
return RunScenario();
object? RunScenario()
{
var bag = UO.GetSerial("backpack");
if (Truth(UO.Exists(bag)))
{
UO.Print(Convert.ToString(UO.GetParent(bag)));
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- GetContent("ground") gives ID items outside containers.
- Both representations of land are valid. One null parent without Exists is not enough to infer the position of an item.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var items = UO.GetContent("ground");
if (Truth(ArrayLength(items) > 0))
{
var item = items[0];
if (Truth(UO.Exists(item)))
{
UO.Print(Convert.ToString(UO.GetParent(item)));
}
}
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;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: objID (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ContainerOf:bridge.ContainerOf(Arg(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "getparent": return new InjectionValue(bridge.ContainerOf(Arg(0)));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.Ground();Returns a special land designator for the search container parameter or transfer destination.
There are no parameters.
int, always 0. This zero is a valid ground designator, not false, not a search error, not ID item, graphic, map number or coordinate. Don't check Ground() as a sign of success; check the search or transfer result that was passed this value.
- There are no parameters. The Ground() call itself does not search for anything, does not move anything, does not open target, does not send packets, and does not change the results of the previous search. Before entering the game, it also returns 0.
- Send FindType, FindList, Count, FindTypeEx, FindTypesArrayEx, CountEx or MoveItem commands to the container/destination position. Search sees loaded world objects, but does not load distant cells. For transfer to the ground, X/Y/Z are the world coordinates, not the pixels of the container window.
- FindType(type, color) still looks in the inventory: the second parameter is color. For land, write FindType(type, color, UO.Ground()). In the old compact FindType/MoveItem the number -1 indicates inventory; in compatible FindTypeEx/FindTypesArrayEx/CountEx - 1 is also allowed as ground. Use UO.Ground() or the explicit name ground, do not transfer numeric designations between different commands without checking.
- The notation differences between the commands and the examples above describe this client.
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.
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.Ground();
UO.Print("Ground: " + Convert.ToString(result));Parameters and execution flow:
- destination receives int 0, Print prints this number. The call itself doesn't throw anything away.
var destination = UO.Ground();
UO.Print(Convert.ToString(destination));Parameters and execution flow:
- 0x0EED - gold graphics; the second -1 means any hue. Ground() sets a search in the world, false disables container recursion. FindTypeEx returns one serial or 0 if there is no result. != 0 checks this serial. The current FindDistance/FindVertical and the list Ignore are used.
return RunScenario();
object? RunScenario()
{
var id = UO.FindTypeEx(0x0EED, -1, UO.Ground(), false);
if (Truth(id != 0))
{
UO.Print(Hex(id));
}
else
{
UO.Print("0");
}
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;Parameters and execution flow:
- FindGroundTypes(firstType, secondType, radius, height) searches for gold 0x0EED and black pearl 0x0F7A with radius=5 and height=10. declaring the variable types[1] creates two cells; colors[0] and containers[0] - one each. The entire stack counts as one result; types/colors are alternatives, intersecting containers do not duplicate ID. The function returns the saved array serial; Finally restores both limits. Main outputs every ID. The function code is given in full.
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 ids = FindGroundTypes(0x0EED, 0x0F7A, 5, 10);
foreach (var id in ids)
{
UO.Print(Hex(id));
}
return null;
}
dynamic FindGroundTypes(dynamic firstType, dynamic secondType, dynamic radius, dynamic height)
{
var oldDistance = UO.FindDistance();
var oldVertical = UO.FindVertical();
dynamic[] types = new dynamic[checked((int)(1) + 1)];
types[0] = firstType;
types[1] = secondType;
dynamic[] colors = new dynamic[checked((int)(0) + 1)];
colors[0] = -1;
dynamic[] containers = new dynamic[checked((int)(0) + 1)];
containers[0] = UO.Ground();
try
{
UO.FindDistance(radius);
UO.FindVertical(height);
UO.FindTypesArrayEx(types, colors, containers, false);
return UO.GetFoundItems();
}
finally
{
UO.FindDistance(oldDistance);
UO.FindVertical(oldVertical);
}
}
string Hex(object? value) => Convert.ToInt64(value).ToString("X");
}Parameters and execution flow:
- Replace 0x40001001 with the serial of the available item. IsObjectExists first checks the loaded object. MoveItem(item, amount, destination, X, Y, Z): amount=0 — the entire stack, Ground() — the ground, GetX/GetY/GetZ — the character’s world cell. result is 1 if the client accepted the transfer request, otherwise 0. This is the result of MoveItem, not Ground(), and not a delivery confirmation from the server.
var item = 0x40001001;
if (Truth(UO.IsObjectExists(item)))
{
var result = UO.MoveItem(item, 0, UO.Ground(), UO.GetX("self"), UO.GetY("self"), UO.GetZ("self"));
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: int / Integer.
During a call:
Internal implementation code; this is not a standalone script.
case "ground": return new InjectionValue(0);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.IsContainer(object? objID);Checks the Container flag in the tiledata of the graphic type of the loaded item.
-
objID— Mandatory serial/ID of a specific object: int, hex-string or alias self, backpack, lasttarget, lastobject, lastcontainer, laststatus, finditem, lastcorpse or name AddObject. This is not a graphic/type. Unspecified name resolves to 0; the command does not open any new target.
int 1 - a known item has a container attribute in its graphic data. int 0 - there is no such attribute, the object is mobile, unknown or deleted. This is not the number of things in the container, not a sign of an open gump, and not confirmation of access to the contents.
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.
- The local client model is read; There are no requests to the server, no waiting or moving.
- The result refers to the moment of reading. After UO.Wait or other action, the object and its flags may change.
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.
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.IsContainer(UO.GetSerial("lastobject"));
UO.Print("IsContainer: " + Convert.ToString(result));Parameters and execution flow:
- item is the serial of lastobject, not its type.
- The command reads only the container attribute and does not open it.
var item = UO.GetSerial("lastobject");
if (Truth(UO.IsContainer(item)))
{
UO.Print("Known container: " + item);
}
else
{
UO.Print("Not a known container");
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- bag must be selected in advance and the contents must be known to the client.
- FindType receives gold type, any hue and serial container. An empty result does not prove that the server container is empty.
return RunScenario();
object? RunScenario()
{
var bag = UO.GetSerial("lasttarget");
if (Truth(UO.IsContainer(bag)))
{
var found = UO.FindType(0x0EED, -1, bag);
UO.Print("Known gold item: " + 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;Parameters and execution flow:
- Exists and IsContainer answer different questions about the same serial.
- If tiledata is unsuitable or not yet available, the classification may differ from what is expected; do not use it as a check for chest rights.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var bag = UO.GetSerial("backpack");
var exists = UO.Exists(bag);
var container = UO.IsContainer(bag);
UO.Print("Loaded: " + Convert.ToString(exists));
UO.Print("Container flag: " + Convert.ToString(container));
return null;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: objID (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.IsContainer:bridge.IsContainer(Arg(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "iscontainer": return new InjectionValue(bridge.IsContainer(Arg(0)));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.LastContainer();Reads serial of the last container.
There are no parameters.
int — saved serial; 0 means serial is not installed. It's not a bool or a graphic/type; a nonzero ID may no longer exist in the world.
- Field source: _world.LastContainer. The command does not select, use, or attack the object.
- Reads the current local state. There is no package, target or automatic update; individual reads may see different states.
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.
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.LastContainer();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- Reads serial of the last container.
var id = UO.LastContainer();
UO.Print(Hex(id));
string Hex(object? value) => Convert.ToInt64(value).ToString("X");Parameters and execution flow:
- Field source: _world.LastContainer. The command does not select, use, or attack the object.
return RunScenario();
object? RunScenario()
{
var id = UO.LastContainer();
if (Truth(id != 0) && Truth(UO.Exists(id)))
{
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;Parameters and execution flow:
- Reads the current local state. There is no package, target or automatic update; individual reads may see different states.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var before = UO.LastContainer();
UO.Wait(500);
var after = UO.LastContainer();
UO.Print(before = after);
return null;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetLastContainer:bridge.GetLastContainer().
Internal implementation code; this is not a standalone script.
case "lastcontainer": return new InjectionValue(bridge.GetLastContainer());Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.OpenContainer(object? id);
void UO.OpenContainer(object? id, object? timeout);Requests to open a container.
-
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.
void - no value. Call on a separate line; completion does not confirm the server's action.
- Bridge.OpenContainer calls UseObject(id), then UO.Wait(timeout) only if timeout>0. The pause is fixed; the presence/contents of the container are not checked.
- Without timeout there is no pause. The end of the pause should not be taken as evidence that the content has opened or fully loaded.
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.
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.OpenContainer");
UO.OpenContainer("lasttarget");Parameters and execution flow:
- Requests to open a container.
UO.OpenContainer("lasttarget");Parameters and execution flow:
- Bridge.OpenContainer calls UseObject(id), then UO.Wait(timeout) only if timeout>0. The pause is fixed; the presence/contents of the container are not checked.
return RunScenario();
object? RunScenario()
{
if (Truth(UO.Exists("lasttarget")))
{
UO.OpenContainer("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;Parameters and execution flow:
- Without timeout there is no pause. The end of the pause should not be taken as evidence that the content has opened or fully loaded.
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.OpenContainer(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;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: id (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.OpenContainer. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.OpenContainer:bridge.OpenContainer(GetObject(id), 0). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(id).
Internal implementation code; this is not a standalone script.
public void OpenContainer(InjectionValue id) => bridge.OpenContainer(GetObject(id), 0);Parameters: id (Any), timeout (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.OpenContainer. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.OpenContainer:bridge.OpenContainer(GetObject(id), NumberConversions.ToInt(timeout)). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(id). -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(timeout).
Internal implementation code; this is not a standalone script.
public void OpenContainer(InjectionValue id, InjectionValue timeout) => bridge.OpenContainer(GetObject(id), NumberConversions.ToInt(timeout));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.SetCatchBag();
void UO.SetCatchBag(object? container);-
container— Serial of the container, its saved name, "backpack" or "my". 0 unassigns. Without arguments, lastobject is used - the last applied object, not reset. If the name does not resolve to a positive serial, the assignment is removed. The installation itself does not check the server availability and suitability of the object for migration.
void: No return value. You cannot use var result = UO.SetCatchBag(...), if UO.SetCatchBag(...), or expect the number 1 as confirmation. The actual movement is performed by a separate command, for example Grab.
- UO.SetCatchBag() and UO.SetReceivingContainer() have different form values without arguments: the first takes lastobject, the second resets the container.
- Explicit reset: UO.UnsetCatchBag(), UO.UnsetReceivingContainer() or UO.SetCatchBag(0). After the reset, Grab uses its backpack without a separate assignment.
- Having serial installed does not mean that the server will allow the item to be placed there. Distance, existence and availability are checked during the actual transfer.
- In a regular client host, this state data is taken from the GetPersistentState manager and is common to scripts/chat/macros of the same world/profile, and does not belong to one script. Another process or an apparently separate InjectionRuntimeState has a different state. Loading/clearing a profile can replace it; saved serial are still checked against the loaded world.
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.
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.SetCatchBag");
UO.SetCatchBag();Parameters and execution flow:
- The single container parameter receives the string "backpack". Runtime allows it in serial of your backpack.
- The call is written on a separate line without var result because it returns Unit. The Print message describes the setting and does not confirm the transfer of the item.
var destination = "backpack";
UO.SetCatchBag(destination);
UO.Print("Receiving container: own backpack");Parameters and execution flow:
- This overload has no parameters: internally the name lastobject is used.
- Empty parentheses do not mean reset. Pre-select the appropriate container by simply double-clicking. Bag availability for actual carry depends on the current state of the game.
return RunScenario();
object? RunScenario()
{
UO.SetCatchBag();
UO.Print("Destination taken from lastobject");
return null;
}Parameters and execution flow:
- In the first call, container=bag contains the hex string serial. 0x40001234 is an example, you need to replace it with your own value.
- In the second call, container=0 unassigns it. The following Grab without an explicit container use a backpack.
- The reset is located after the intended carry block. Set and reset do not return a result and do not move items on their own.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var bag = "0x40001234";
UO.SetCatchBag(bag);
UO.Print("Configured destination: " + bag);
UO.SetCatchBag(0);
UO.Print("Destination reset to the normal backpack fallback");
return null;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias. -
InjectionScript.Runtime.InjectionApiUO.SetReceivingContainer:SetReceivingContainer(arguments.Length > 0 ? arguments[0].ToString() : "lastobject"). -
InjectionScript.Runtime.InjectionValue.ToString:arguments[0].ToString().
Internal implementation code; this is not a standalone script.
case "setcatchbag":
SetReceivingContainer(arguments.Length > 0 ? arguments[0].ToString() : "lastobject");
break;Parameters: container (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias. -
InjectionScript.Runtime.InjectionApiUO.SetReceivingContainer:SetReceivingContainer(arguments.Length > 0 ? arguments[0].ToString() : "lastobject"). -
InjectionScript.Runtime.InjectionValue.ToString:arguments[0].ToString().
Internal implementation code; this is not a standalone script.
case "setcatchbag":
SetReceivingContainer(arguments.Length > 0 ? arguments[0].ToString() : "lastobject");
break;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.SetReceivingContainer();
void UO.SetReceivingContainer(object? id);Sets the receiving container for the future Grab.
-
id- Optional serial/alias. "my"/"backpack" - current backpack. Positive ID is retained without existence check; 0/negative/no argument clears the setting.
void - no value. Call on a separate line; completion does not confirm the server's action.
- The string is resolved GetObject, except for the special my/backpack. Bridge.SetReceivingContainer assigns State.ReceivingContainer. The item is not transferred by this call.
- After clearing, Grab uses the backpack without an explicit purpose. A positive ID by itself does not confirm that the container is loaded or accessible to the server.
- In a regular client host, this state data is taken from the GetPersistentState manager and is common to scripts/chat/macros of the same world/profile, and does not belong to one script. Another process or an apparently separate InjectionRuntimeState has a different state. Loading/clearing a profile can replace it; saved serial are still checked against the loaded world.
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.
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.SetReceivingContainer");
UO.SetReceivingContainer();Parameters and execution flow:
- Sets the receiving container for the future Grab.
UO.SetReceivingContainer("backpack");Parameters and execution flow:
- The string is resolved GetObject, except for the special my/backpack. Bridge.SetReceivingContainer assigns State.ReceivingContainer. The item is not transferred by this call.
return RunScenario();
object? RunScenario()
{
UO.SetReceivingContainer();
return null;
}Parameters and execution flow:
- After clearing, Grab uses the backpack without an explicit purpose. A positive ID by itself does not confirm that the container is loaded or accessible to the server.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var bag = UO.GetSerial("lastcontainer");
if (Truth(UO.IsContainer(bag)))
{
UO.SetReceivingContainer(bag);
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.SetReceivingContainer. -
InjectionScript.Runtime.InjectionApiUO.UnsetReceivingContainer:UnsetReceivingContainer().
Internal implementation code; this is not a standalone script.
public void SetReceivingContainer() => UnsetReceivingContainer();Parameters: id (Integer/String)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.SetReceivingContainer. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.UnsetReceivingContainer:bridge.UnsetReceivingContainer(). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetReceivingContainer:bridge.SetReceivingContainer(id).
Internal implementation code; this is not a standalone script.
public void SetReceivingContainer(int id)
{
if (id <= 0)
bridge.UnsetReceivingContainer();
else
bridge.SetReceivingContainer(id);
}Parameters: id (Integer/String)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.SetReceivingContainer. -
InjectionScript.Runtime.InjectionApiUO.SetReceivingContainer:SetReceivingContainer(bridge.Backpack). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(id). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Backpack:bridge.Backpack.
Internal implementation code; this is not a standalone script.
public void SetReceivingContainer(string id)
{
string name = (id ?? string.Empty).Trim();
if (name.Equals("my", StringComparison.OrdinalIgnoreCase)
|| name.Equals("backpack", StringComparison.OrdinalIgnoreCase))
{
SetReceivingContainer(bridge.Backpack);
return;
}
SetReceivingContainer(GetObject(id));
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.UnsetCatchBag();Clears the receiving container for Grab.
There are no parameters.
void - no value. Call on a separate line; completion does not confirm the server's action.
- ExecuteLegacyManualAlias calls UnsetReceivingContainer; bridge assigns ReceivingContainer=0. Subsequent Grab uses a backpack. This is not bag removal.
- Modifies or displays only the specified local data. This command does not have server confirmation.
- In a regular client host, this state data is taken from the GetPersistentState manager and is common to scripts/chat/macros of the same world/profile, and does not belong to one script. Another process or an apparently separate InjectionRuntimeState has a different state. Loading/clearing a profile can replace it; saved serial are still checked against the loaded world.
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.
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.UnsetCatchBag");
UO.UnsetCatchBag();Parameters and execution flow:
- Clears the receiving container for Grab.
UO.UnsetCatchBag();Parameters and execution flow:
- ExecuteLegacyManualAlias calls UnsetReceivingContainer; bridge assigns ReceivingContainer=0. Subsequent Grab uses a backpack. This is not bag removal.
return RunScenario();
object? RunScenario()
{
UO.SetCatchBag("backpack");
UO.UnsetCatchBag();
return null;
}Parameters and execution flow:
- Modifies or displays only the specified local data. This command does not have server confirmation.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
UO.UnsetCatchBag();
UO.Print(UO.Backpack());
return null;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias. -
InjectionScript.Runtime.InjectionApiUO.UnsetReceivingContainer:UnsetReceivingContainer().
Internal implementation code; this is not a standalone script.
case "unsetcatchbag": UnsetReceivingContainer(); break;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.UnsetReceivingContainer();Clears the saved reception container.
There are no parameters.
void - no value. Call on a separate line; completion does not confirm the server's action.
- UnsetReceivingContainer assigns ReceivingContainer=0. Subsequent Grab uses a backpack without an explicit purpose. Items are not transferred.
- Modifies or displays only the specified local data. This command does not have server confirmation.
- In a regular client host, this state data is taken from the GetPersistentState manager and is common to scripts/chat/macros of the same world/profile, and does not belong to one script. Another process or an apparently separate InjectionRuntimeState has a different state. Loading/clearing a profile can replace it; saved serial are still checked against the loaded world.
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.
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.UnsetReceivingContainer");
UO.UnsetReceivingContainer();Parameters and execution flow:
- Clears the saved reception container.
UO.UnsetReceivingContainer();Parameters and execution flow:
- UnsetReceivingContainer assigns ReceivingContainer=0. Subsequent Grab uses a backpack without an explicit purpose. Items are not transferred.
return RunScenario();
object? RunScenario()
{
UO.SetReceivingContainer("backpack");
UO.UnsetReceivingContainer();
return null;
}Parameters and execution flow:
- Modifies or displays only the specified local data. This command does not have server confirmation.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
UO.UnsetReceivingContainer();
UO.Print(UO.Backpack());
return null;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.UnsetReceivingContainer. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.UnsetReceivingContainer:bridge.UnsetReceivingContainer().
Internal implementation code; this is not a standalone script.
public void UnsetReceivingContainer() => bridge.UnsetReceivingContainer();ClassicUO — Bad Newbie & C# Scripts IDE