Repository navigation
EN UO Topic character Part 4
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
Home · C# · IDE · UO API · A–Z · Examples · Languages
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.MaxStamina();Reads the maximum endurance from the local model.
There are no parameters.
int is the value of the StaminaMax field, not a percentage or a bool. 0 can be a true value or an indication of missing data. Zero maximum cannot be used as a divisor. Someone else's mobile may have unknown meanings. HP/HitsMax may contain relative server scale instead of exact points. HP=0 does not prove death; That's what Dead/IsDead is for.
- The command does not open status and does not request a server update. The client only reads the already loaded data. Does not change characteristics and does not send packets.
- The result is a separate reading. The world can change between Exists and the next challenge; multiple queries do not form an atomic snapshot.
- When reading an object, World.Get rejects the missing or IsDestroyed and produces 0. HP/HitsMax are read from the Entity, including items with these fields; Mana/Stamina - only for Mobile. Without an argument, self is read. The variant of the same name without parameters does not necessarily have a variant with ID: see signatures.
- Reading without arguments also returns 0 for a missing or destroyed Player. This also applies to direct Mana/Stamina and their maximums, not just World.Get forms. A dead character present can retain values.
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.MaxStamina();
UO.Print("MaxStamina: " + Convert.ToString(result));Parameters and execution flow:
- The call without arguments reads self. value stores one number, Convert.ToString converts it for message only.
var value = UO.MaxStamina();
UO.Print("MaxStamina: " + Convert.ToString(value));Parameters and execution flow:
- The applied threshold or calculation for this field is shown. The numbers in the condition are example settings, not server limits. Before dividing by the maximum, its positivity is checked.
return RunScenario();
object? RunScenario()
{
var value = UO.MaxStamina();
if (Truth(value > 0))
{
UO.Print("Stamina percent: " + Convert.ToString(UO.Stamina() * 100 / value));
}
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:
- This name does not have a form with ID. ReadValue without parameters reads self; the two calls are separated by UO.Wait(1000). Comparing two snapshots may miss intermediate changes.
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 before = ReadValue();
await Delay(1000);
var after = ReadValue();
UO.Print("Before: " + Convert.ToString(before) + "; after: " + Convert.ToString(after));
return null;
}
dynamic ReadValue()
{
return UO.MaxStamina();
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
}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.RegisterCharacterGetterAliases [MaxStamina]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.MaxStamina:bridge.MaxStamina.
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.MaxStaminaAPI creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.MaxWeight();Reads your character's status counter: maximum weight in stones.
There are no parameters.
int — maximum weight in stones, 0..65535 in the client model. 0 can be a real value, no data, or a missing/destroyed Player. This is quantity, not bool, ID or type: 1 means one unit, not success. The command does not iterate over objects and does not return an array.
- The command takes no arguments. Use the exact signatures above.
- Reading on the game thread takes Player.WeightMax if the current Player exists and has not been destroyed; otherwise 0. Equipment is not sorted, bonuses are not recalculated, status is not requested, and there is no waiting for updates. A present ghost is not equal to a destroyed Player.
- MaxWeight reads WeightMax cache. The native status type >= 5 sets the server limit to UInt16, even if it is equal to 0. The old extended status calculates it once upon reception: protocol UO >= 5.0.0a - 7 * floor(Strength / 2) + 40; the older one is Strength * 4 + 25. The result is saved as UInt16; extreme values are wrapped modulo 65536. Strength=101 gives 390 or 429 respectively. When changing Strength separately, the getter itself does not recalculate the limit.
- CharacterStatus checks the required body before updating. Weight is in its own extended status, slots are with type 3, Luck - with type 4, server slots WeightMax - with type 5. A compact/old package without an optional counter leaves its previous cache. The new Player starts from scratch; the call does not prove receipt of a fresh status.
- These functions register the API. They do not run again for every command call. C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
- Each call reads the local data anew. The variable stores the snapshot; individual reads may receive different server updates. A non-zero result does not test the connection. Zero can be a value or no data.
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.MaxWeight();
UO.Print("MaxWeight: " + Convert.ToString(result));Parameters and execution flow:
- value stores one no-argument call to its own character; Convert.ToString formats the number for the log without changing its meaning.
var value = UO.MaxWeight();
UO.Print("WeightMax: " + Convert.ToString(value));Parameters and execution flow:
- UO.Wait(500) separates before and after by 500 milliseconds. difference can be positive, zero or negative; Interim updates and character changes may be skipped. Pause is an example.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.MaxWeight();
await Delay(500);
var after = UO.MaxWeight();
var difference = after - before;
UO.Print("Counter change: " + Convert.ToString(difference));
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));Parameters and execution flow:
- CanCarry(extra) gets extra weight in stones; 10 is an example, not the number of stacks. Rejects negative extra, no Player, or maximum <= 0, reads the current weight and limit, then returns bool: true or false by extra <= maximum - current. Subtraction avoids current + extra overflow. When overloaded, the result is false even for extra=0. This is a local assessment, not a server resolution; reads are not atomic, and the zero weight may be unknown.
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(Truth(CanCarry(10)) == true))
{
UO.Print("Local check passed");
}
else
{
UO.Print("Local check failed or data unavailable");
}
return null;
}
dynamic CanCarry(dynamic extra)
{
if (Truth(extra < 0) || Truth(UO.Self() == 0))
{
return false;
}
var current = UO.Weight();
var maximum = UO.MaxWeight();
if (Truth(maximum <= 0))
{
return false;
}
return extra <= maximum - current;
}
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.MaxWeight. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.MaxWeight:bridge.MaxWeight.
Internal implementation code; this is not a standalone script.
public int MaxWeight() => bridge.MaxWeight;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.Mount();
void UO.Mount(object? mount);Requests to mount the selected mount/item.
-
mount— Optional serial target. Without an argument, LastTarget is taken. This is ID, not graphic/type. A live mobile must be loaded and located no further than one cell; the item must be in the character's inventory (for example, an ethereal mount). An arbitrary item in the inventory does not become mountable: the server decides.
void - no return value. Call as a separate line, do not compare the result with 1/true. Check the 25 layer after the server responds.
- The command sends a request to use the protocol object UO (0x06), without mouse emulation. It bypasses the interface's common double-click handler: in war mode, the request is not replaced by an attack.
- The state of the mount is read from the layer 25. It changes after the server data; returning from the command does not confirm the completion of the landing/dismounting.
- Repeated mount/dismount requests are temporarily merged: no new request is sent until a layer change, character change, or 5 seconds have passed. This protects against duplication between scripts.
- If the character is absent, out of game or for a dead character, the request is not sent. The final rules for ownership, availability and seating are determined by the server.
- If the character is already mounted, the target is 0/self, destroyed, dead, or unavailable under the specified conditions, the request is not sent. The object on the ground is rejected.
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.Mount");
UO.Mount();Parameters and execution flow:
- No arguments: LastTarget is used. Print does not confirm the server's consent.
if (Truth(UO.GetSerial("lasttarget") == "0x00000000"))
{
UO.Print("Mount target not selected");
return null;
}
UO.Mount();
UO.Print("Mount request processed locally");
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:
- mount=target, number 25 refers to the custom character layer. If already riding, a new request is not required.
return RunScenario();
object? RunScenario()
{
var target = UO.GetSerial("lasttarget");
if (Truth(target == "0x00000000"))
{
return null;
}
if (Truth(UO.ObjAtLayer(25) == 0))
{
UO.Mount(target);
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- target — ID targets. One request, then up to 20 waits for 50 ms. true/false returns our helper, UO.Mount itself returns Unit.
- false means that the layer did not appear within this period; a late server response is still possible.
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 mounted = await TryMount("lasttarget");
UO.Print("Mounted within one second: " + Convert.ToString(mounted));
return null;
}
async Task<dynamic> TryMount(dynamic target)
{
if (Truth(UO.ObjAtLayer(25) != 0))
{
return true;
}
if (Truth(target == "0x00000000"))
{
return false;
}
UO.Mount(target);
var attempts = 0;
while (Truth(attempts < 20))
{
if (Truth(UO.ObjAtLayer(25) != 0))
{
return true;
}
await Delay(50);
attempts = attempts + 1;
}
return false;
}
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;
}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. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Mount:bridge.Mount(Arg(0, bridge.LastTarget)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias::Arg:Arg(0, bridge.LastTarget). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.LastTarget:bridge.LastTarget.
Internal implementation code; this is not a standalone script.
case "mount": bridge.Mount(Arg(0, bridge.LastTarget)); break;Parameters: mount (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Mount:bridge.Mount(Arg(0, bridge.LastTarget)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias::Arg:Arg(0, bridge.LastTarget). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.LastTarget:bridge.LastTarget.
Internal implementation code; this is not a standalone script.
case "mount": bridge.Mount(Arg(0, bridge.LastTarget)); break;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.ObjAtLayer(object? layer);Finds an item on the specified layer of your own character's equipment.
-
layer— One required argument: layer number 1..29 or a string name from the list below. The number 0 and the name Invalid give 0. Case and trailing spaces of the name are ignored. An unknown string name causes a script error; the number string "1" does not replace the number 1.
The numeric form returns int - serial for the item, or 0 for an empty/invalid layer. The string form returns string of the form "0x40001001" if the item is found, otherwise int 0. This is the ID of the item, not the layer number, graphic/type or quantity. Metadata object? string form reflect two possible result types.
- 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.
- Equipment data self is checked. The team does not open the bag, put on the item, or send an inspection request.
- Numbers outside 1..29 give 0 without modulo conversion 256; for example, 257 cannot select the right hand.
- All supported numeric layers and string names:
- 1 OneHanded/Rhand/RightHand; 2 TwoHanded/Lhand/LeftHand; 3 Shoes; 4 Pants; 5 Shirt; 6 Helmet/Hat; 7 Gloves; 8 Ring; 9 Talisman; 10 Necklace/Neck.
- 11 Hair; 12 Waist; 13 Torso; 14 Bracelet/Brace; 15 Face; 16 Beard; 17 Tunic; 18 Earrings/Ear; 19 Arms; 20 Cloak.
- 21 Backpack/Bpack/BackpackLayer; 22 Robe; 23 Skirt; 24 Legs; 25 Mount; 26 ShopBuyRestock/Rstk; 27 ShopBuy/NRstk; 28 ShopSell/Sell; 29 Bank.
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.
object? item = UO.ObjAtLayer("Rhand");
if (item is string serial) UO.Print("Equipped serial: " + serial);
else UO.Print("The layer is empty");Parameters and execution flow:
- Rhand selects layer 1. If successful, hand is a hex string; if absent, the number 0.
- Convert.ToString allows you to output both possible types. The result cannot be taken as the graphic of the weapon.
object? hand = UO.ObjAtLayer("Rhand");
if (hand is string serial)
{
UO.Print("Right hand serial: " + serial);
}
else
{
UO.Print("Right hand is empty or unavailable");
}
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 number 2 selects TwoHanded. This form always returns int.
- Exists checks that the item's properties can be read. GetGraphic returns a distinct type.
return RunScenario();
object? RunScenario()
{
var item = UO.ObjAtLayer(2);
if (Truth(UO.Exists(item)))
{
UO.Print("Two-handed layer serial: " + Convert.ToString(item));
UO.Print("Graphic: " + UO.GetGraphic(item));
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- 21 — Backpack layer; result 0 is possible before loading equipment.
- 257 is outside the list and always gives 0. This is not an alternative designation for the 1 layer.
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.ObjAtLayer(21);
var invalid = UO.ObjAtLayer(257);
UO.Print("Backpack serial: " + Convert.ToString(bag));
UO.Print("Invalid layer: " + Convert.ToString(invalid));
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: layer (Any/String)
Result: dynamic / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(ObjAtLayer(Text(0))). -
InjectionScript.Runtime.InjectionApiUO.ObjAtLayer:ObjAtLayer(Text(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ObjAtLayer:bridge.ObjAtLayer(Arg(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "objatlayer":
return new InjectionValue(arguments[0].Kind == InjectionValueKind.String
? GetObject(ObjAtLayer(Text(0))) : bridge.ObjAtLayer(Arg(0)));Parameters: layer (Any/String)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ObjAtLayer. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ObjAtLayer:bridge.ObjAtLayer(ConvertLayer(layer)). -
InjectionScript.Runtime.InjectionApiUO.ConvertLayer:ConvertLayer(layer).
Internal implementation code; this is not a standalone script.
public InjectionValue ObjAtLayer(string layer)
{
var id = bridge.ObjAtLayer(ConvertLayer(layer));
if (id == 0)
return InjectionValue.Zero;
return new InjectionValue("0x" + id.ToString("X8"));
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.ObjAtLayerEx(object? layerType, object? playerID);Reads an item/container in the specified layer for the specified loaded character.
-
layerType— Numerical number of the layer 1..29. Accepts an integer or a numeric string, such as 26 or "0x1A". String names Rhand/ShopBuyRestock and bare layer constants are not converted to numbers here. Use a number. -
playerID— Serial of the character/mobile, a number, a hex string, or a resolvable object name, such as "self"/"lasttarget". The Graphic/type of the item or the ID of the container itself are not suitable.
int: serial of the item/container on the layer or 0 if the layer is empty/unknown, the number is invalid or there is no Mobile loaded. This is not a bool or a layer number.
- Reading is local, without target, purchase, container opening and network request.
- The range 1..29 is checked. Converting an inappropriate string parameter may cause an error; An arbitrary layer name should not be passed in place of a number.
- A separate UO.ObjAtLayer is available for a custom character with a string layer name. Don't confuse layer with world Z, static index, or gump coordinate.
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.ObjAtLayerEx(26, UO.GetSerial("lasttarget"));
UO.Print("ObjAtLayerEx: " + Convert.ToString(result));Parameters and execution flow:
- LayerType=26; PlayerID=vendor; shop — serial of the container. For GetContent shop is passed, not the layer number.
- The array is indexed from 0 to length minus 1. Each element is serial. An empty array means there are no immediate elements loaded; the purchase is not fulfilled.
var vendor = UO.GetSerial("lasttarget");
if (Truth(vendor == "0x00000000"))
{
UO.Print("Vendor not selected");
return null;
}
var shop = UO.ObjAtLayerEx(26, vendor);
if (Truth(shop == 0))
{
UO.Print("ShopBuyRestock container is not loaded");
return null;
}
UO.Print("Shop container ID: " + Convert.ToString(shop));
var items = UO.GetContent(shop);
var i = 0;
while (Truth(i < ArrayLength(items)))
{
var item = items[i];
UO.Print(UO.GetName(item) + " | ID: " + Convert.ToString(item));
UO.Print("Graphic: " + Convert.ToString(UO.GetType(item)));
i = i + 1;
}
UO.Print("Loaded entries: " + Convert.ToString(ArrayLength(items)));
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:
- wantedType is graphic, and item is ID of an individual item. stacks counts records/stacks; units adds the number in them.
- This is a reading of the quantity already received, not the balance guaranteed by a future purchase. There is no price specified here.
return RunScenario();
object? RunScenario()
{
var vendor = UO.GetSerial("lasttarget");
if (Truth(vendor == "0x00000000"))
{
UO.Print("Vendor not selected");
return null;
}
var shop = UO.ObjAtLayerEx(26, vendor);
if (Truth(shop == 0))
{
UO.Print("Shop layer is not loaded");
return null;
}
var wantedType = 0x1766;
var stacks = 0;
var units = 0;
var items = UO.GetContent(shop);
var i = 0;
while (Truth(i < ArrayLength(items)))
{
var item = items[i];
if (Truth(UO.GetType(item) == wantedType))
{
stacks = stacks + 1;
units = units + UO.GetQuantity(item);
}
i = i + 1;
}
UO.Print("Stacks: " + Convert.ToString(stacks) + " | Units: " + Convert.ToString(units));
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:
- ShowVendorLayer is declared in its entirety. vendor - ID NPC, layerNumber - 26/27/28, caption - signature only.
- The containers may be unknown to the client. 0 is checked before GetContent: an explicit GetContent(0) would mean asking for items on the ground, which is not required here.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var vendor = UO.GetSerial("lasttarget");
if (Truth(vendor == "0x00000000"))
{
UO.Print("Vendor not selected");
return null;
}
ShowVendorLayer(vendor, 26, "ShopBuyRestock / Rstk");
ShowVendorLayer(vendor, 27, "ShopBuy / NRstk");
ShowVendorLayer(vendor, 28, "ShopSell / Sell");
return null;
}
void ShowVendorLayer(dynamic vendor, dynamic layerNumber, dynamic caption)
{
var container = UO.ObjAtLayerEx(layerNumber, vendor);
if (Truth(container == 0))
{
UO.Print(caption + ": not loaded");
return;
}
var items = UO.GetContent(container);
UO.Print(caption + " | Container ID: " + Convert.ToString(container));
UO.Print("Loaded entries: " + Convert.ToString(ArrayLength(items)));
}
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: layerType (Any), playerID (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ObjAtLayerEx:bridge.ObjAtLayerEx(Arg(0), Arg(1)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "objatlayerex": return new InjectionValue(bridge.ObjAtLayerEx(Arg(0), Arg(1)));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.Paralyzed();
int UO.Paralyzed(object? value);Checks the character's paralysis flag known to the client.
-
value- Optional serial/ID mobile: number, hex string, self, lasttarget or other standard object name or AddObject name. This is not a graphic/type. Without an argument, self is used. Unknown name resolves to 0; target doesn't open.
Numeric flag int: 1 (condition met) - loaded mobile has flag IsParalyzed; 0 (condition not met) - no flag, mobile unknown, deleted, or the object is an item. This is not a time of paralysis and does not guarantee the ability to move with a result of 0.
- Use Paralyzed to check the paralysis flag. The variants Is/Get, GetParalisa, Frozen and GetLocked read the same flag.
- The command only reads local data. It does not apply or remove paralysis, does not wait for it to end, and does not send an update request to the server.
- The result of this command is of type int: use if (value != 0) or if (value == 0). Direct comparisons with true/false and if (value) in C# are not allowed. The value preserves the meaning of the flag, not the quantity or ID.
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.Paralyzed();
UO.Print("Paralyzed: " + Convert.ToString(result));Parameters and execution flow:
- Empty parentheses select self. state stores one snapshot of the flag; true — numeric constant 1.
- A false result does not rule out a wall, lack of stamina, or other reason for stopping.
var state = UO.Paralyzed();
if (Truth(Truth(state) == true))
{
UO.Print("Paralysis flag is set");
}
else
{
UO.Print("Paralysis flag is absent or unavailable");
}
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:
- target stores the hex string serial of the last target. IsNpc checks that this is a loaded mobile, including players.
- The command with the argument reads target. She doesn't select a new character or change lasttarget.
return RunScenario();
object? RunScenario()
{
var target = UO.GetSerial("lasttarget");
if (Truth(UO.IsNPC(target)))
{
var state = UO.Paralyzed(target);
UO.Print("Selected mobile paralysis 1/0: " + Convert.ToString(state));
}
else
{
UO.Print("No loaded mobile selected");
}
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:
- No more than 10 pauses for 100 ms. Each call without an argument reads self again.
- After the loop, the presence of self is checked separately. This is an observation for about a second plus the execution of commands, and not a guaranteed removal of paralysis.
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 attempts = 0;
while (Truth(Truth(UO.Paralyzed()) == true) && Truth(attempts < 10))
{
await Delay(100);
attempts = attempts + 1;
}
if (Truth(UO.IsNPC("self")))
{
if (Truth(Truth(UO.Paralyzed()) == false))
{
UO.Print("Paralysis flag is clear");
}
else
{
UO.Print("Still paralyzed");
}
}
else
{
UO.Print("Self is unavailable");
}
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;
}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.GetLocked:bridge.GetLocked(bridge.Self). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
Internal implementation code; this is not a standalone script.
case "paralyzed": return new InjectionValue(bridge.GetLocked(bridge.Self));Parameters: value (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [Paralyzed]. -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetLocked:bridge.GetLocked(serial). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(value).
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.
serial => bridge.GetLocked(serial)Internal implementation code; this is not a standalone script.
value => getter(GetObject(value))API creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.PhysicalResist();Reads the current character's resistance field: physical armor/resistance.
There are no parameters.
int — signed status value, -32768..32767 in the client model. The negative value is retained. 0 can be real resistance, lack of data or missing/destroyed Player; GetResist also gives 0 for an unknown selector. This is not a bool, ID, skill or resistance limit. 1 means one point, not success.
- The command takes no arguments. Use the exact signatures above.
- Reading on the game thread takes Player.PhysicalResistance if the current Player exists and has not been destroyed; otherwise 0. Equipment is not sorted, bonuses are not recalculated, status is not requested, and there is no waiting for updates. A present ghost is not equal to a destroyed Player.
- PhysicalResistance - server armor/status field: the classic server can transmit armor rating, and rules with resistances can transmit physical resistance. API does not convert from one to the other and does not calculate the percentage of damage reduction. Armor and physical aliases read the same field.
- CharacterStatus checks the required body before changing the name, health and own characteristics, then translates each resistance word into a signed Int16. A trimmed mandatory body does not change the previous data. The optional tail type 6 retains the same rules; resistance commands do not read maximum limits from it.
- Each call reads the local data anew. The variable stores the snapshot; individual reads may receive different server updates. A non-zero result does not test the connection. Zero can be a value or no data.
- These functions register the API. They do not run again for every command call. C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
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.PhysicalResist();
UO.Print("PhysicalResist: " + Convert.ToString(result));Parameters and execution flow:
- value stores the result of one call. Convert.ToString formats the number for the log. There are no arguments: you can read your own character.
var value = UO.PhysicalResist();
UO.Print("PhysicalResistance: " + Convert.ToString(value));Parameters and execution flow:
- Between before and after there are UO.Wait(500) milliseconds; difference can be negative. Interim updates may be missed. The pause refers to the example, not the delay API.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.PhysicalResist();
await Delay(500);
var after = UO.PhysicalResist();
var difference = after - before;
UO.Print("Resistance change: " + Convert.ToString(difference));
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));Parameters and execution flow:
- minimum=50 is an example of a requirement, not a client limit. ResistanceAtLeast rejects the missing Player, reads one value and returns bool: true or false if value >= minimum. The resistance itself is not bool. The function is fully declared below.
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(Truth(ResistanceAtLeast(50)) == true))
{
UO.Print("Local resistance requirement met");
}
else
{
UO.Print("Requirement not met or no player");
}
return null;
}
dynamic ResistanceAtLeast(dynamic minimum)
{
if (Truth(UO.Self() == 0))
{
return false;
}
var value = UO.PhysicalResist();
return value >= minimum;
}
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.RegisterCharacterGetterAliases [PhysicalResist]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Armor:bridge.Armor.
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.ArmorAPI creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.Poison();
void UO.Poison(object? target);Uses the Poisoning skill, if necessary, on a given target.
-
target— Optional serial/alias target. No arguments - only UseSkill("Poisoning"). With argument - UseSkillAtTarget("Poisoning", target).
void - no value. Call on a separate line; completion does not confirm the server's action.
- The registered legacy command is not a getter for poison resistance or poison status. The branch summons the skill and discards it 1/0.
- In a form with a target, UseSkillAtTarget checks for positive serial, prepares the target before requesting the skill; if the skill is not accepted, cancels the target. Poisoning of the target by the server is not guaranteed.
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.Poison");
UO.Poison();Parameters and execution flow:
- Uses the Poisoning skill, if necessary, on a given target.
UO.Poison();Parameters and execution flow:
- The registered legacy command is not a getter for poison resistance or poison status. The branch summons the skill and discards it 1/0.
return RunScenario();
object? RunScenario()
{
if (Truth(UO.Exists("lasttarget")))
{
UO.Poison("lasttarget");
}
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:
- In a form with a target, UseSkillAtTarget checks for positive serial, prepares the target before requesting the skill; if the skill is not accepted, cancels the target. Poisoning of the target by the server is not guaranteed.
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.Poison(id);
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;
}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.UseSkillAtTarget:UseSkillAtTarget(new InjectionValue("Poisoning"), arguments[0]). -
InjectionScript.Runtime.InjectionApiUO.UseSkill:UseSkill("Poisoning").
Internal implementation code; this is not a standalone script.
case "poison":
if (arguments.Length > 0) UseSkillAtTarget(new InjectionValue("Poisoning"), arguments[0]);
else UseSkill("Poisoning");
break;Parameters: target (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias. -
InjectionScript.Runtime.InjectionApiUO.UseSkillAtTarget:UseSkillAtTarget(new InjectionValue("Poisoning"), arguments[0]). -
InjectionScript.Runtime.InjectionApiUO.UseSkill:UseSkill("Poisoning").
Internal implementation code; this is not a standalone script.
case "poison":
if (arguments.Length > 0) UseSkillAtTarget(new InjectionValue("Poisoning"), arguments[0]);
else UseSkill("Poisoning");
break;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.PoisonResist();Reads the current character's resistance field: poison.
There are no parameters.
int — signed status value, -32768..32767 in the client model. The negative value is retained. 0 can be real resistance, lack of data or missing/destroyed Player; GetResist also gives 0 for an unknown selector. This is not a bool, ID, skill or resistance limit. 1 means one point, not success.
- The command takes no arguments. Use the exact signatures above.
- Reading on the game thread takes Player.PoisonResistance if the current Player exists and has not been destroyed; otherwise 0. Equipment is not sorted, bonuses are not recalculated, status is not requested, and there is no waiting for updates. A present ghost is not equal to a destroyed Player.
- Elemental fields come in extended CharacterStatus (0x11), type >= 4. The command itself does not check the server epoch. Compact/old status without these fields leaves the previous cache; The new Player is originally 0. Poison Resistance is not a Poisoned flag; It's also not a Resisting Spells skill.
- CharacterStatus checks the required body before changing the name, health and own characteristics, then translates each resistance word into a signed Int16. A trimmed mandatory body does not change the previous data. The optional tail type 6 retains the same rules; resistance commands do not read maximum limits from it.
- Each call reads the local data anew. The variable stores the snapshot; individual reads may receive different server updates. A non-zero result does not test the connection. Zero can be a value or no data.
- These functions register the API. They do not run again for every command call. C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
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.PoisonResist();
UO.Print("PoisonResist: " + Convert.ToString(result));Parameters and execution flow:
- value stores the result of one call. Convert.ToString formats the number for the log. There are no arguments: you can read your own character.
var value = UO.PoisonResist();
UO.Print("PoisonResistance: " + Convert.ToString(value));Parameters and execution flow:
- Between before and after there are UO.Wait(500) milliseconds; difference can be negative. Interim updates may be missed. The pause refers to the example, not the delay API.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.PoisonResist();
await Delay(500);
var after = UO.PoisonResist();
var difference = after - before;
UO.Print("Resistance change: " + Convert.ToString(difference));
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));Parameters and execution flow:
- minimum=50 is an example of a requirement, not a client limit. ResistanceAtLeast rejects the missing Player, reads one value and returns bool: true or false if value >= minimum. The resistance itself is not bool. The function is fully declared below.
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(Truth(ResistanceAtLeast(50)) == true))
{
UO.Print("Local resistance requirement met");
}
else
{
UO.Print("Requirement not met or no player");
}
return null;
}
dynamic ResistanceAtLeast(dynamic minimum)
{
if (Truth(UO.Self() == 0))
{
return false;
}
var value = UO.PoisonResist();
return value >= minimum;
}
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.PoisonResistance:bridge.PoisonResistance.
Internal implementation code; this is not a standalone script.
case "poisonresist": return new InjectionValue(bridge.PoisonResistance);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.Poisoned();
int UO.Poisoned(object? id);Checks the character's poisoning.
-
id— Optional object in the forms shown: serial number/hex string, self, lasttarget, or registered name AddObject. This is not type. Without an argument, self is read. Unknown text in some forms causes a conversion error; check the name before calling.
Numeric flag int: 1 (condition met), 0 (condition not met). This is a numeric flag: in C# check result != 0 or result == 0. Direct comparison of int with true/false and if (result) is not allowed. 1 - mobile has IsPoisoned, 0 has no flag or mobile is missing. The degree of poison and the remaining time are not returned.
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.
- Reads the local model: does not open target, does not request status, does not change the flag, and does not send the packet. A destroyed object is considered missing even before the entry is deleted from the dictionary.
- The result is a separate reading. The world can change between Exists and the next challenge; multiple queries do not form an atomic snapshot.
- For Poisoned/Flying, the protocol version is taken into account: up to 7.0.0.0 bit 0x04 means poison; starting with 7.0.0.0 it means flight and the poison is stored separately. Flight is not calculated from Z.
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.Poisoned();
UO.Print("Poisoned: " + Convert.ToString(result));Parameters and execution flow:
- Empty parentheses read self. active saves the result once; true and false define two branches. Print only displays an example message.
var active = UO.Poisoned();
if (Truth(Truth(active) == true))
{
UO.Print("State is active");
}
else
{
UO.Print("State is inactive or unavailable");
}
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:
- lasttarget - previously selected object. Exists checks for its presence. obj is the only parameter ReadState; the function returns the result of the command without modification. Its definition is included in the copied code.
return RunScenario();
object? RunScenario()
{
if (Truth(UO.Exists("lasttarget")))
{
var observed = ReadState("lasttarget");
UO.Print("State 1/0: " + Convert.ToString(observed));
}
return null;
}
dynamic ReadState(dynamic obj)
{
return UO.Poisoned(obj);
}
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:
- Two calls without arguments read self, UO.Wait(500) sets 500 milliseconds. Two images are compared; intermediate transitions may be skipped. There is no endless waiting.
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 before = UO.Poisoned();
await Delay(500);
var after = UO.Poisoned();
if (Truth(before != after))
{
UO.Print("State changed: " + Convert.ToString(before) + " -> " + Convert.ToString(after));
}
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;
}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.Poisoned. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Poisoned:bridge.Poisoned(bridge.Self). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
Internal implementation code; this is not a standalone script.
public int Poisoned() => bridge.Poisoned(bridge.Self);Parameters: id (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Poisoned. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Poisoned:bridge.Poisoned(GetObject(id)). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(id).
Internal implementation code; this is not a standalone script.
public int Poisoned(InjectionValue id) => bridge.Poisoned(GetObject(id));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.Race();Reads the character's race from the client model.
There are no parameters.
int — 1=human, 2=elf, 3=gargoyle according to the client model. 0 means no character loaded. This is not body/graphic and not serial.
- 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.
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.Race();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- A call without arguments refers to self. The character's race is stored in value.
- Convert.ToString converts the number to be output and does not change the meaning of the result.
var value = UO.Race();
UO.Print("Race: " + Convert.ToString(value));Parameters and execution flow:
- The value is read once without any arguments. The character's race is used in the calculation or condition shown.
- Numerical thresholds are examples of script conditions and not new client limits. The field stores the server units and restrictions described above.
return RunScenario();
object? RunScenario()
{
var value = UO.Race();
if (Truth(value == 3))
{
UO.Print("Player race is gargoyle");
}
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:
- Both calls without an argument read their current value. UO.Wait(1000) gives a pause in milliseconds between shots.
- Change compared: character race. An example does not change anything in the world and does not wait endlessly. Events within this second may be missed.
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 before = UO.Race();
await Delay(1000);
var after = UO.Race();
if (Truth(before != after))
{
UO.Print("Before: " + Convert.ToString(before) + "; after: " + Convert.ToString(after));
}
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;
}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.Race:bridge.Race.
Internal implementation code; this is not a standalone script.
case "race": return new InjectionValue(bridge.Race);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.RemoveEarrings();Requests removal of an item from the Ear layer.
There are no parameters.
void - no value. Call on a separate line; completion does not confirm the server's action.
- ExecuteLegacyManualAlias calls Unequip("Ear"). ConvertLayer selects the numeric layer, bridge.Unequip requests transfer to the backpack.
- The result of the internal Unequip (1/0) of the legacy command is discarded; call on a separate line. If there is no item/backpack, the request may not be executed. The ObjAtLayer check after the call reads only the local state.
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.RemoveEarrings");
UO.RemoveEarrings();Parameters and execution flow:
- Requests removal of an item from the Ear layer.
UO.RemoveEarrings();Parameters and execution flow:
- ExecuteLegacyManualAlias calls Unequip("Ear"). ConvertLayer selects the numeric layer, bridge.Unequip requests transfer to the backpack.
return RunScenario();
object? RunScenario()
{
UO.Print(UO.ObjAtLayer("Ear"));
UO.RemoveEarrings();
return null;
}Parameters and execution flow:
- The result of the internal Unequip (1/0) of the legacy command is discarded; call on a separate line. If there is no item/backpack, the request may not be executed. The ObjAtLayer check after the call reads only the local state.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
UO.RemoveEarrings();
UO.Wait(500);
UO.Print(UO.ObjAtLayer("Ear"));
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.Unequip:Unequip("Ear").
Internal implementation code; this is not a standalone script.
case "removeearrings": Unequip("Ear"); break;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.RemoveHat();Requests removal of an item from the Hat layer.
There are no parameters.
void - no value. Call on a separate line; completion does not confirm the server's action.
- ExecuteLegacyManualAlias calls Unequip("Hat"). ConvertLayer selects the numeric layer, bridge.Unequip requests transfer to the backpack.
- The result of the internal Unequip (1/0) of the legacy command is discarded; call on a separate line. If there is no item/backpack, the request may not be executed. The ObjAtLayer check after the call reads only the local state.
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.RemoveHat");
UO.RemoveHat();Parameters and execution flow:
- Requests removal of an item from the Hat layer.
UO.RemoveHat();Parameters and execution flow:
- ExecuteLegacyManualAlias calls Unequip("Hat"). ConvertLayer selects the numeric layer, bridge.Unequip requests transfer to the backpack.
return RunScenario();
object? RunScenario()
{
UO.Print(UO.ObjAtLayer("Hat"));
UO.RemoveHat();
return null;
}Parameters and execution flow:
- The result of the internal Unequip (1/0) of the legacy command is discarded; call on a separate line. If there is no item/backpack, the request may not be executed. The ObjAtLayer check after the call reads only the local state.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
UO.RemoveHat();
UO.Wait(500);
UO.Print(UO.ObjAtLayer("Hat"));
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.Unequip:Unequip("Hat").
Internal implementation code; this is not a standalone script.
case "removehat": Unequip("Hat"); break;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.RemoveNeckless();Requests an item to be removed from the Neck layer.
There are no parameters.
void - no value. Call on a separate line; completion does not confirm the server's action.
- ExecuteLegacyManualAlias calls Unequip("Neck"). ConvertLayer selects the numeric layer, bridge.Unequip requests transfer to the backpack.
- The result of the internal Unequip (1/0) of the legacy command is discarded; call on a separate line. If there is no item/backpack, the request may not be executed. The ObjAtLayer check after the call reads only the local state.
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.RemoveNeckless");
UO.RemoveNeckless();Parameters and execution flow:
- Requests an item to be removed from the Neck layer.
UO.RemoveNeckless();Parameters and execution flow:
- ExecuteLegacyManualAlias calls Unequip("Neck"). ConvertLayer selects the numeric layer, bridge.Unequip requests transfer to the backpack.
return RunScenario();
object? RunScenario()
{
UO.Print(UO.ObjAtLayer("Neck"));
UO.RemoveNeckless();
return null;
}Parameters and execution flow:
- The result of the internal Unequip (1/0) of the legacy command is discarded; call on a separate line. If there is no item/backpack, the request may not be executed. The ObjAtLayer check after the call reads only the local state.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
UO.RemoveNeckless();
UO.Wait(500);
UO.Print(UO.ObjAtLayer("Neck"));
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.Unequip:Unequip("Neck").
Internal implementation code; this is not a standalone script.
case "removeneckless": Unequip("Neck"); break;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.RemoveRing();Requests removal of an item from the Ring layer.
There are no parameters.
void - no value. Call on a separate line; completion does not confirm the server's action.
- ExecuteLegacyManualAlias calls Unequip("Ring"). ConvertLayer selects the numeric layer, bridge.Unequip requests transfer to the backpack.
- The result of the internal Unequip (1/0) of the legacy command is discarded; call on a separate line. If there is no item/backpack, the request may not be executed. The ObjAtLayer check after the call reads only the local state.
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.RemoveRing");
UO.RemoveRing();Parameters and execution flow:
- Requests removal of an item from the Ring layer.
UO.RemoveRing();Parameters and execution flow:
- ExecuteLegacyManualAlias calls Unequip("Ring"). ConvertLayer selects the numeric layer, bridge.Unequip requests transfer to the backpack.
return RunScenario();
object? RunScenario()
{
UO.Print(UO.ObjAtLayer("Ring"));
UO.RemoveRing();
return null;
}Parameters and execution flow:
- The result of the internal Unequip (1/0) of the legacy command is discarded; call on a separate line. If there is no item/backpack, the request may not be executed. The ObjAtLayer check after the call reads only the local state.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
UO.RemoveRing();
UO.Wait(500);
UO.Print(UO.ObjAtLayer("Ring"));
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.Unequip:Unequip("Ring").
Internal implementation code; this is not a standalone script.
case "removering": Unequip("Ring"); break;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.RequestStats(object? objID);Requests the character's status via serial.
-
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.
void - no value. Call on a separate line; completion does not confirm the server's action.
- RequestStats calls RequestMobileStatus(_world, serial, true). The call does not return an array of characteristics and does not wait for a response; GetHP/GetStr is followed by reading the local model.
- Bridge sends the request on the game thread. Server rules apply; There is no built-in waiting for confirmation.
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.RequestStats");
UO.RequestStats(UO.GetSerial("lasttarget"));Parameters and execution flow:
- Requests the character's status via serial.
var id = UO.GetSerial("lasttarget");
if (Truth(UO.Exists(id)))
{
UO.RequestStats(id);
}
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:
- RequestStats calls RequestMobileStatus(_world, serial, true). The call does not return an array of characteristics and does not wait for a response; GetHP/GetStr is followed by reading the local model.
return RunScenario();
object? RunScenario()
{
var id = UO.GetSerial("self");
if (Truth(UO.Exists(id)))
{
UO.RequestStats(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:
- 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.RequestStats(id);
}
}
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: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.RequestStats:bridge.RequestStats(Arg(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "requeststats": bridge.RequestStats(Arg(0)); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.ResistCold();Reads the current character's resistance field: cold.
There are no parameters.
int — signed status value, -32768..32767 in the client model. The negative value is retained. 0 can be real resistance, lack of data or missing/destroyed Player; GetResist also gives 0 for an unknown selector. This is not a bool, ID, skill or resistance limit. 1 means one point, not success.
- The command takes no arguments. Use the exact signatures above.
- Reading on the game thread takes Player.ColdResistance if the current Player exists and has not been destroyed; otherwise 0. Equipment is not sorted, bonuses are not recalculated, status is not requested, and there is no waiting for updates. A present ghost is not equal to a destroyed Player.
- Elemental fields come in extended CharacterStatus (0x11), type >= 4. The command itself does not check the server epoch. Compact/old status without these fields leaves the previous cache; The new Player is originally 0. Poison Resistance is not a Poisoned flag; It's also not a Resisting Spells skill.
- CharacterStatus checks the required body before changing the name, health and own characteristics, then translates each resistance word into a signed Int16. A trimmed mandatory body does not change the previous data. The optional tail type 6 retains the same rules; resistance commands do not read maximum limits from it.
- Each call reads the local data anew. The variable stores the snapshot; individual reads may receive different server updates. A non-zero result does not test the connection. Zero can be a value or no data.
- These functions register the API. They do not run again for every command call. C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
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.ResistCold();
UO.Print("ResistCold: " + Convert.ToString(result));Parameters and execution flow:
- value stores the result of one call. Convert.ToString formats the number for the log. There are no arguments: you can read your own character.
var value = UO.ResistCold();
UO.Print("ColdResistance: " + Convert.ToString(value));Parameters and execution flow:
- Between before and after there are UO.Wait(500) milliseconds; difference can be negative. Interim updates may be missed. The pause refers to the example, not the delay API.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.ResistCold();
await Delay(500);
var after = UO.ResistCold();
var difference = after - before;
UO.Print("Resistance change: " + Convert.ToString(difference));
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));Parameters and execution flow:
- minimum=50 is an example of a requirement, not a client limit. ResistanceAtLeast rejects the missing Player, reads one value and returns bool: true or false if value >= minimum. The resistance itself is not bool. The function is fully declared below.
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(Truth(ResistanceAtLeast(50)) == true))
{
UO.Print("Local resistance requirement met");
}
else
{
UO.Print("Requirement not met or no player");
}
return null;
}
dynamic ResistanceAtLeast(dynamic minimum)
{
if (Truth(UO.Self() == 0))
{
return false;
}
var value = UO.ResistCold();
return value >= minimum;
}
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.RegisterCharacterGetterAliases [ResistCold]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ColdResistance:bridge.ColdResistance.
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.ColdResistanceAPI creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.ResistEnergy();Reads the current character's resistance field: energy.
There are no parameters.
int — signed status value, -32768..32767 in the client model. The negative value is retained. 0 can be real resistance, lack of data or missing/destroyed Player; GetResist also gives 0 for an unknown selector. This is not a bool, ID, skill or resistance limit. 1 means one point, not success.
- The command takes no arguments. Use the exact signatures above.
- Reading on the game thread takes Player.EnergyResistance if the current Player exists and has not been destroyed; otherwise 0. Equipment is not sorted, bonuses are not recalculated, status is not requested, and there is no waiting for updates. A present ghost is not equal to a destroyed Player.
- Elemental fields come in extended CharacterStatus (0x11), type >= 4. The command itself does not check the server epoch. Compact/old status without these fields leaves the previous cache; The new Player is originally 0. Poison Resistance is not a Poisoned flag; It's also not a Resisting Spells skill.
- CharacterStatus checks the required body before changing the name, health and own characteristics, then translates each resistance word into a signed Int16. A trimmed mandatory body does not change the previous data. The optional tail type 6 retains the same rules; resistance commands do not read maximum limits from it.
- Each call reads the local data anew. The variable stores the snapshot; individual reads may receive different server updates. A non-zero result does not test the connection. Zero can be a value or no data.
- These functions register the API. They do not run again for every command call. C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
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.ResistEnergy();
UO.Print("ResistEnergy: " + Convert.ToString(result));Parameters and execution flow:
- value stores the result of one call. Convert.ToString formats the number for the log. There are no arguments: you can read your own character.
var value = UO.ResistEnergy();
UO.Print("EnergyResistance: " + Convert.ToString(value));Parameters and execution flow:
- Between before and after there are UO.Wait(500) milliseconds; difference can be negative. Interim updates may be missed. The pause refers to the example, not the delay API.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.ResistEnergy();
await Delay(500);
var after = UO.ResistEnergy();
var difference = after - before;
UO.Print("Resistance change: " + Convert.ToString(difference));
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));Parameters and execution flow:
- minimum=50 is an example of a requirement, not a client limit. ResistanceAtLeast rejects the missing Player, reads one value and returns bool: true or false if value >= minimum. The resistance itself is not bool. The function is fully declared below.
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(Truth(ResistanceAtLeast(50)) == true))
{
UO.Print("Local resistance requirement met");
}
else
{
UO.Print("Requirement not met or no player");
}
return null;
}
dynamic ResistanceAtLeast(dynamic minimum)
{
if (Truth(UO.Self() == 0))
{
return false;
}
var value = UO.ResistEnergy();
return value >= minimum;
}
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.RegisterCharacterGetterAliases [ResistEnergy]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.EnergyResistance:bridge.EnergyResistance.
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.EnergyResistanceAPI creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.ResistFire();Reads the current character's resistance field: fire.
There are no parameters.
int — signed status value, -32768..32767 in the client model. The negative value is retained. 0 can be real resistance, lack of data or missing/destroyed Player; GetResist also gives 0 for an unknown selector. This is not a bool, ID, skill or resistance limit. 1 means one point, not success.
- The command takes no arguments. Use the exact signatures above.
- Reading on the game thread takes Player.FireResistance if the current Player exists and has not been destroyed; otherwise 0. Equipment is not sorted, bonuses are not recalculated, status is not requested, and there is no waiting for updates. A present ghost is not equal to a destroyed Player.
- Elemental fields come in extended CharacterStatus (0x11), type >= 4. The command itself does not check the server epoch. Compact/old status without these fields leaves the previous cache; The new Player is originally 0. Poison Resistance is not a Poisoned flag; It's also not a Resisting Spells skill.
- CharacterStatus checks the required body before changing the name, health and own characteristics, then translates each resistance word into a signed Int16. A trimmed mandatory body does not change the previous data. The optional tail type 6 retains the same rules; resistance commands do not read maximum limits from it.
- Each call reads the local data anew. The variable stores the snapshot; individual reads may receive different server updates. A non-zero result does not test the connection. Zero can be a value or no data.
- These functions register the API. They do not run again for every command call. C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
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.ResistFire();
UO.Print("ResistFire: " + Convert.ToString(result));Parameters and execution flow:
- value stores the result of one call. Convert.ToString formats the number for the log. There are no arguments: you can read your own character.
var value = UO.ResistFire();
UO.Print("FireResistance: " + Convert.ToString(value));Parameters and execution flow:
- Between before and after there are UO.Wait(500) milliseconds; difference can be negative. Interim updates may be missed. The pause refers to the example, not the delay API.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.ResistFire();
await Delay(500);
var after = UO.ResistFire();
var difference = after - before;
UO.Print("Resistance change: " + Convert.ToString(difference));
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));Parameters and execution flow:
- minimum=50 is an example of a requirement, not a client limit. ResistanceAtLeast rejects the missing Player, reads one value and returns bool: true or false if value >= minimum. The resistance itself is not bool. The function is fully declared below.
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(Truth(ResistanceAtLeast(50)) == true))
{
UO.Print("Local resistance requirement met");
}
else
{
UO.Print("Requirement not met or no player");
}
return null;
}
dynamic ResistanceAtLeast(dynamic minimum)
{
if (Truth(UO.Self() == 0))
{
return false;
}
var value = UO.ResistFire();
return value >= minimum;
}
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.RegisterCharacterGetterAliases [ResistFire]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.FireResistance:bridge.FireResistance.
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.FireResistanceAPI creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.ResistPhysical();Reads the current character's resistance field: physical armor/resistance.
There are no parameters.
int — signed status value, -32768..32767 in the client model. The negative value is retained. 0 can be real resistance, lack of data or missing/destroyed Player; GetResist also gives 0 for an unknown selector. This is not a bool, ID, skill or resistance limit. 1 means one point, not success.
- The command takes no arguments. Use the exact signatures above.
- Reading on the game thread takes Player.PhysicalResistance if the current Player exists and has not been destroyed; otherwise 0. Equipment is not sorted, bonuses are not recalculated, status is not requested, and there is no waiting for updates. A present ghost is not equal to a destroyed Player.
- PhysicalResistance - server armor/status field: the classic server can transmit armor rating, and rules with resistances can transmit physical resistance. API does not convert from one to the other and does not calculate the percentage of damage reduction. Armor and physical aliases read the same field.
- CharacterStatus checks the required body before changing the name, health and own characteristics, then translates each resistance word into a signed Int16. A trimmed mandatory body does not change the previous data. The optional tail type 6 retains the same rules; resistance commands do not read maximum limits from it.
- Each call reads the local data anew. The variable stores the snapshot; individual reads may receive different server updates. A non-zero result does not test the connection. Zero can be a value or no data.
- These functions register the API. They do not run again for every command call. C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
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.ResistPhysical();
UO.Print("ResistPhysical: " + Convert.ToString(result));Parameters and execution flow:
- value stores the result of one call. Convert.ToString formats the number for the log. There are no arguments: you can read your own character.
var value = UO.ResistPhysical();
UO.Print("PhysicalResistance: " + Convert.ToString(value));Parameters and execution flow:
- Between before and after there are UO.Wait(500) milliseconds; difference can be negative. Interim updates may be missed. The pause refers to the example, not the delay API.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.ResistPhysical();
await Delay(500);
var after = UO.ResistPhysical();
var difference = after - before;
UO.Print("Resistance change: " + Convert.ToString(difference));
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));Parameters and execution flow:
- minimum=50 is an example of a requirement, not a client limit. ResistanceAtLeast rejects the missing Player, reads one value and returns bool: true or false if value >= minimum. The resistance itself is not bool. The function is fully declared below.
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(Truth(ResistanceAtLeast(50)) == true))
{
UO.Print("Local resistance requirement met");
}
else
{
UO.Print("Requirement not met or no player");
}
return null;
}
dynamic ResistanceAtLeast(dynamic minimum)
{
if (Truth(UO.Self() == 0))
{
return false;
}
var value = UO.ResistPhysical();
return value >= minimum;
}
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.RegisterCharacterGetterAliases [ResistPhysical]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Armor:bridge.Armor.
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.ArmorAPI creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.ResistPoison();Reads the current character's resistance field: poison.
There are no parameters.
int — signed status value, -32768..32767 in the client model. The negative value is retained. 0 can be real resistance, lack of data or missing/destroyed Player; GetResist also gives 0 for an unknown selector. This is not a bool, ID, skill or resistance limit. 1 means one point, not success.
- The command takes no arguments. Use the exact signatures above.
- Reading on the game thread takes Player.PoisonResistance if the current Player exists and has not been destroyed; otherwise 0. Equipment is not sorted, bonuses are not recalculated, status is not requested, and there is no waiting for updates. A present ghost is not equal to a destroyed Player.
- Elemental fields come in extended CharacterStatus (0x11), type >= 4. The command itself does not check the server epoch. Compact/old status without these fields leaves the previous cache; The new Player is originally 0. Poison Resistance is not a Poisoned flag; It's also not a Resisting Spells skill.
- CharacterStatus checks the required body before changing the name, health and own characteristics, then translates each resistance word into a signed Int16. A trimmed mandatory body does not change the previous data. The optional tail type 6 retains the same rules; resistance commands do not read maximum limits from it.
- Each call reads the local data anew. The variable stores the snapshot; individual reads may receive different server updates. A non-zero result does not test the connection. Zero can be a value or no data.
- These functions register the API. They do not run again for every command call. C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
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.ResistPoison();
UO.Print("ResistPoison: " + Convert.ToString(result));Parameters and execution flow:
- value stores the result of one call. Convert.ToString formats the number for the log. There are no arguments: you can read your own character.
var value = UO.ResistPoison();
UO.Print("PoisonResistance: " + Convert.ToString(value));Parameters and execution flow:
- Between before and after there are UO.Wait(500) milliseconds; difference can be negative. Interim updates may be missed. The pause refers to the example, not the delay API.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.ResistPoison();
await Delay(500);
var after = UO.ResistPoison();
var difference = after - before;
UO.Print("Resistance change: " + Convert.ToString(difference));
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));Parameters and execution flow:
- minimum=50 is an example of a requirement, not a client limit. ResistanceAtLeast rejects the missing Player, reads one value and returns bool: true or false if value >= minimum. The resistance itself is not bool. The function is fully declared below.
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(Truth(ResistanceAtLeast(50)) == true))
{
UO.Print("Local resistance requirement met");
}
else
{
UO.Print("Requirement not met or no player");
}
return null;
}
dynamic ResistanceAtLeast(dynamic minimum)
{
if (Truth(UO.Self() == 0))
{
return false;
}
var value = UO.ResistPoison();
return value >= minimum;
}
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.RegisterCharacterGetterAliases [ResistPoison]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.PoisonResistance:bridge.PoisonResistance.
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.PoisonResistanceAPI creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.Self();Returns ID of the current character.
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. Reads World.Player.Serial; a missing or destroyed Player gives 0. Death is different from removal: the ghost present retains the character's ID.
- 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.Self();
UO.Print("Self: " + 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.Self();
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.Self();
await Delay(250);
var after = UO.Self();
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.Self();
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.Self:bridge.Self.
Internal implementation code; this is not a standalone script.
case "self": return new InjectionValue(bridge.Self);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.SetARExtParams();
void UO.SetARExtParams(object? shardName);
void UO.SetARExtParams(object? shardName, object? charName);
void UO.SetARExtParams(object? shardName, object? charName, object? useAtEveryConnect);Specifies a server from the list of shards and a character for subsequent login. Useful when the script needs to be reconnected by a certain character of the same account.
-
shardName— Optional display name of the server from the login list, not IP or port. An empty or missing value is taken by the current ShardName. Whitespace around the edges is removed. -
charName- Optional name of an existing account character. An empty or missing value takes the name self if known. This is a name, not a slot number and not serial; a non-empty name takes precedence over a profile slot. -
useAtEveryConnect- Optional flag: false/0 by default - one-time selection; true/1 or other non-zero integer—save the selection for future logins in this session.
void - no value. This is setting up the next input, not confirming the character's connection or existence.
- In the manager, nonces are saved across failed network attempts and are only consumed after entering the world. The next connection returns to the profile settings. A persistent choice lasts until a new setting or the session owner ends; The manager profile file is not overwritten. The new setting during login applies to the next login and is not lost when the current one is completed.
- In a separate graphical client, the server is saved as LastServerName, the character is saved as LastCharacterManager. After a successful login, the character also becomes the last used one: disposability does not mean an automatic return to the previous character. Permanent override lives in the current process.
- The command itself does not enable auto-reconnect and does not break the connection. To do this, SetARStatus, Connect and Disconnect are used separately. Names must be present in the server lists; the comparison is not case sensitive. If automatic character entry is disabled in the manager, manual selection remains. The name self may not be known offline: specify names explicitly. The command does not change the account, password, IP, port and Encryption; empty values with no current name available do not clear the previously set selection.
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.SetARExtParams");
UO.SetARExtParams("", "", true);Parameters and execution flow:
- The first example only works online. The two empty lines take the current names; true saves them for repeated logins, SetARStatus(true) enables the auto-reconnection policy. There is no immediate reconnection.
if (!(Truth(UO.Connected())))
{
return null;
}
UO.SetARExtParams("", "", true);
UO.SetARStatus(true);
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 second example selects Example Character only if this name is in the real GetCharsListForShard. The array is indexed with 0; ToLowerInvariant compares names in a case-insensitive manner. false means one successful input, after configuration, auto-reconnect is enabled and Disconnect is called. Replace the name with yours. If there is no name, the connection is preserved. Autopause may delay return until connection is restored.
return RunScenario();
object? RunScenario()
{
if (!(Truth(UO.Connected())))
{
return null;
}
var wanted = "Example Character";
var names = UO.GetCharsListForShard();
var i = 0;
while (Truth(i < ArrayLength(names)))
{
if (Truth(Convert.ToString(names[i]) == Convert.ToString(wanted)))
{
UO.SetARExtParams("", names[i], false);
UO.SetARStatus(true);
UO.Disconnect();
return null;
}
i += 1;
}
return null;
}
int ArrayLength(object? value) => value is System.Array array ? array.Length : 0;
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- The third example is launched from a running offline script. Example Shard and Example Character are explicitly specified; replace them with real names. true preserves the selection, false in SetARStatus disables automatic retries, Connect requests one input. You need your saved account details. Connect doesn't wait for the world to be ready; An automatically paused script will not reach these lines without resuming.
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(UO.Connected()))
{
return null;
}
UO.SetARExtParams("Example Shard", "Example Character", true);
UO.SetARStatus(false);
UO.Connect();
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.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetName:bridge.GetName(bridge.Self). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(2). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetReconnectSelection:bridge.SetReconnectSelection(state.AutoReconnectShard, state.AutoReconnectCharacter, useAtEveryConnect). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ShardName:bridge.ShardName. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
Internal implementation code; this is not a standalone script.
case "setarextparams":
{
string requestedShard = arguments.Length > 0 ? Text(0) : string.Empty;
string requestedCharacter = arguments.Length > 1 ? Text(1) : string.Empty;
state.AutoReconnectShard = string.IsNullOrWhiteSpace(requestedShard)
? bridge.ShardName
: requestedShard;
state.AutoReconnectCharacter = string.IsNullOrWhiteSpace(requestedCharacter)
? bridge.GetName(bridge.Self) ?? string.Empty
: requestedCharacter;
int useAtEveryConnect = arguments.Length > 2 ? Arg(2) : 0;
bridge.SetReconnectSelection(state.AutoReconnectShard, state.AutoReconnectCharacter, useAtEveryConnect);
return InjectionValue.Unit;
}Parameters: shardName (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetName:bridge.GetName(bridge.Self). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(2). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetReconnectSelection:bridge.SetReconnectSelection(state.AutoReconnectShard, state.AutoReconnectCharacter, useAtEveryConnect). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ShardName:bridge.ShardName. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
Internal implementation code; this is not a standalone script.
case "setarextparams":
{
string requestedShard = arguments.Length > 0 ? Text(0) : string.Empty;
string requestedCharacter = arguments.Length > 1 ? Text(1) : string.Empty;
state.AutoReconnectShard = string.IsNullOrWhiteSpace(requestedShard)
? bridge.ShardName
: requestedShard;
state.AutoReconnectCharacter = string.IsNullOrWhiteSpace(requestedCharacter)
? bridge.GetName(bridge.Self) ?? string.Empty
: requestedCharacter;
int useAtEveryConnect = arguments.Length > 2 ? Arg(2) : 0;
bridge.SetReconnectSelection(state.AutoReconnectShard, state.AutoReconnectCharacter, useAtEveryConnect);
return InjectionValue.Unit;
}Parameters: shardName (Any), charName (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetName:bridge.GetName(bridge.Self). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(2). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetReconnectSelection:bridge.SetReconnectSelection(state.AutoReconnectShard, state.AutoReconnectCharacter, useAtEveryConnect). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ShardName:bridge.ShardName. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
Internal implementation code; this is not a standalone script.
case "setarextparams":
{
string requestedShard = arguments.Length > 0 ? Text(0) : string.Empty;
string requestedCharacter = arguments.Length > 1 ? Text(1) : string.Empty;
state.AutoReconnectShard = string.IsNullOrWhiteSpace(requestedShard)
? bridge.ShardName
: requestedShard;
state.AutoReconnectCharacter = string.IsNullOrWhiteSpace(requestedCharacter)
? bridge.GetName(bridge.Self) ?? string.Empty
: requestedCharacter;
int useAtEveryConnect = arguments.Length > 2 ? Arg(2) : 0;
bridge.SetReconnectSelection(state.AutoReconnectShard, state.AutoReconnectCharacter, useAtEveryConnect);
return InjectionValue.Unit;
}Parameters: shardName (Any), charName (Any), useAtEveryConnect (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetName:bridge.GetName(bridge.Self). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(2). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetReconnectSelection:bridge.SetReconnectSelection(state.AutoReconnectShard, state.AutoReconnectCharacter, useAtEveryConnect). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ShardName:bridge.ShardName. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
Internal implementation code; this is not a standalone script.
case "setarextparams":
{
string requestedShard = arguments.Length > 0 ? Text(0) : string.Empty;
string requestedCharacter = arguments.Length > 1 ? Text(1) : string.Empty;
state.AutoReconnectShard = string.IsNullOrWhiteSpace(requestedShard)
? bridge.ShardName
: requestedShard;
state.AutoReconnectCharacter = string.IsNullOrWhiteSpace(requestedCharacter)
? bridge.GetName(bridge.Self) ?? string.Empty
: requestedCharacter;
int useAtEveryConnect = arguments.Length > 2 ? Arg(2) : 0;
bridge.SetReconnectSelection(state.AutoReconnectShard, state.AutoReconnectCharacter, useAtEveryConnect);
return InjectionValue.Unit;
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.SetARStatus(object? value);Enables or disables automatic reconnection.
-
value- 0 turns off; any non-zero integer includes.
void - no value. Call on a separate line; completion does not confirm the server's action.
- Bridge.SetAutoReconnect changes the automatic reconnection setting. The value is interpreted as enabled != 0; There is no immediate login/logout to the server.
- Changes the client setting. The value is not the result of a connection test and does not confirm processing by the server.
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.SetARStatus");
UO.SetARStatus(1);Parameters and execution flow:
- Enables or disables automatic reconnection.
UO.SetARStatus(1);Parameters and execution flow:
- Bridge.SetAutoReconnect changes the automatic reconnection setting. The value is interpreted as enabled != 0; There is no immediate login/logout to the server.
return RunScenario();
object? RunScenario()
{
UO.SetARStatus(0);
return null;
}Parameters and execution flow:
- Changes the client setting. The value is not the result of a connection test and does not confirm processing by 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()
{
ApplyMode(1);
return null;
}
void ApplyMode(dynamic mode)
{
UO.SetARStatus(mode);
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: value (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetAutoReconnect:bridge.SetAutoReconnect(Arg(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "setarstatus": bridge.SetAutoReconnect(Arg(0)); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.SetArm(object? name);Remembers the current weapon and shield in a named set.
-
name— String name of the set, such as "travel" or "battle". Names are case insensitive. Clothing and weapon sets are kept separately: the same name is allowed in both. This is not a ID thing or a filename. Only SetDress allows the absence of a name: then a separate set is recorded for DressSavedSet/EquipDressSet.
void - no value. Call on a separate line; do not assign the result or compare it to true. Saving and deleting changes the entry, not the equipment.
- Clothing: layers 3,4,5,6,7,8,10,12,13,14,17,18,19,20,22,23,24. Weapons: 1 and 2 only. Hair, beard, backpack, animal and bank are not included in these sets.
- Specific serial already loaded things are recorded in their own layers. Saving the same name again replaces the entry. Empty layers also make sense: when restored, the corresponding occupied layer will be released into its own backpack. Therefore, a saved completely empty set removes things from its layers.
- The set is stored in the runtime state. The call itself does not create a file and does not guarantee that the set will be transferred to another profile or a new runtime. First, save the desired set in its used state. Loading/saving the general state of the client is a separate mechanism.
- UO.SetDress · UO.Dress · UO.DressSavedSet · UO.SetArm · UO.Arm · UO.DressSpeed
- 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.SetArm");
UO.SetArm("battle");Parameters and execution flow:
- The picture is taken now, when the necessary things are already put on. The challenge does not equip items from the backpack.
UO.SetArm("battle");Parameters and execution flow:
- The same name is used in different repositories. SetDress() also stores the unnamed set separately; it is not a selection of a previously recorded name.
return RunScenario();
object? RunScenario()
{
UO.SetArm("battle");
UO.SetDress("battle");
return null;
}Parameters and execution flow:
- SaveIfReady checks the control layer: 3 - shoes for clothes, 1 - right hand for weapons. If it is empty, the snapshot is not overwritten. The returned 1/0 belongs to the helper, not SetDress/SetArm.
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()
{
return SaveIfReady("battle");
return null;
}
dynamic SaveIfReady(dynamic name)
{
if (Truth(UO.ObjAtLayerEx(1, UO.Self()) == 0))
{
return 0;
}
UO.SetArm(name);
return 1;
}
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 (String)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.SetArm. -
InjectionScript.Runtime.InjectionApiUO.SetEquip:SetEquip(name, armSets, weaponLayers, "Arm set.").
Internal implementation code; this is not a standalone script.
public void SetArm(string name)
=> SetEquip(name, armSets, weaponLayers, "Arm set.");Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.SetDress();
void UO.SetDress(object? name);Remembers currently worn clothing and armor for subsequent restoration.
-
name— String name of the set, such as "travel" or "battle". Names are case insensitive. Clothing and weapon sets are kept separately: the same name is allowed in both. This is not a ID thing or a filename. Only SetDress allows the absence of a name: then a separate set is recorded for DressSavedSet/EquipDressSet.
void - no value. Call on a separate line; do not assign the result or compare it to true. Saving and deleting changes the entry, not the equipment.
- Clothing: layers 3,4,5,6,7,8,10,12,13,14,17,18,19,20,22,23,24. Weapons: 1 and 2 only. Hair, beard, backpack, animal and bank are not included in these sets.
- Specific serial already loaded things are recorded in their own layers. Saving the same name again replaces the entry. Empty layers also make sense: when restored, the corresponding occupied layer will be released into its own backpack. Therefore, a saved completely empty set removes things from its layers.
- The set is stored in the runtime state. The call itself does not create a file and does not guarantee that the set will be transferred to another profile or a new runtime. First, save the desired set in its used state. Loading/saving the general state of the client is a separate mechanism.
- UO.SetDress · UO.Dress · UO.DressSavedSet · UO.SetArm · UO.Arm · UO.DressSpeed
- 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.SetDress");
UO.SetDress();Parameters and execution flow:
- The picture is taken now, when the necessary things are already put on. The challenge does not equip items from the backpack.
UO.SetDress("travel");Parameters and execution flow:
- The same name is used in different repositories. SetDress() also stores the unnamed set separately; it is not a selection of a previously recorded name.
return RunScenario();
object? RunScenario()
{
UO.SetArm("battle");
UO.SetDress("battle");
UO.SetDress();
return null;
}Parameters and execution flow:
- SaveIfReady checks the control layer: 3 - shoes for clothes, 1 - right hand for weapons. If it is empty, the snapshot is not overwritten. The returned 1/0 belongs to the helper, not SetDress/SetArm.
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()
{
return SaveIfReady("travel");
return null;
}
dynamic SaveIfReady(dynamic name)
{
if (Truth(UO.ObjAtLayerEx(3, UO.Self()) == 0))
{
return 0;
}
UO.SetDress(name);
return 1;
}
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.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.SetDress:SetDress("__stealth_saved_set__").
Internal implementation code; this is not a standalone script.
case "setdress": SetDress("__stealth_saved_set__"); return InjectionValue.Unit;Parameters: name (String)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.SetDress. -
InjectionScript.Runtime.InjectionApiUO.SetEquip:SetEquip(name, dressSets, dressLayers, "Clothing set.").
Internal implementation code; this is not a standalone script.
public void SetDress(string name)
=> SetEquip(name, dressSets, dressLayers, "Clothing set.");Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.SetDressSpeed(object? delayms);Sets a pause between requests to change clothes.
-
delayms— int, milliseconds. The value is limited to 10..10000 inclusive.
void - no value. Call on a separate line; completion does not confirm the server's action.
- SetDressSpeed saves state.DressSpeed = max(10, min(10000, delayms)). The operations of saved sets take advantage of this; the speed of actions allowed by the server does not change.
- A value less than 10 becomes 10, a value greater than 10000 becomes 10000. The team does not put on or take off items.
- 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.SetDressSpeed");
UO.SetDressSpeed(250);Parameters and execution flow:
- Sets a pause between requests to change clothes.
UO.SetDressSpeed(250);Parameters and execution flow:
- SetDressSpeed saves state.DressSpeed = max(10, min(10000, delayms)). The operations of saved sets take advantage of this; the speed of actions allowed by the server does not change.
return RunScenario();
object? RunScenario()
{
UO.SetDressSpeed(0);
UO.Print(UO.DressSpeed());
return null;
}Parameters and execution flow:
- A value less than 10 becomes 10, a value greater than 10000 becomes 10000. The team does not put on or take off items.
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.SetDressSpeed(20000);
UO.Print(UO.DressSpeed());
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: delayms (Integer)
Result: void / Unit.
During a call:
Internal implementation code; this is not a standalone script.
public void SetDressSpeed(int delayms) => state.DressSpeed = Math.Max(10, Math.Min(10_000, delayms));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.SetStatLockState(object? statNum, object? statState);Requests a change to the characteristic mode.
-
statNum- Mandatory characteristic number: 0 - STR, 1 - DEX, 2 - INT. This is not its current value and not the name of the string. -
statState— Mandatory mode: 0 — increase, 1 — decrease, 2 — blocking. These are three codes, not bool; true/false do not replace the names of all modes.
void - no return value. The result cannot be used as success/error or compared to true. The subsequent reading shows the local model, not the server's confirmation.
- A valid request sends one packet through GameActions and immediately changes local mode. The server can apply its own restrictions; Increases in skill or stats are not guaranteed. Unknown skill, invalid index/mode and missing character are ignored without a package.
- Mandatory characteristic number: 0 - STR, 1 - DEX, 2 - INT. This is not its current value and not the name of the string.
- ExecuteClientApiCompatibility selects the command branch. Text reads the skill selector, Arg reads the numeric numbers and modes. An unconvertible argument may fail the call with a conversion error.
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.SetStatLockState");
UO.SetStatLockState(0, 2);Parameters and execution flow:
- In the example, selector and, when recording, mode are explicitly specified. The first line selects a skill by name or a characteristic by number. Print only prints the result.
var selector = 0;
var mode = 2;
UO.SetStatLockState(selector, mode);
UO.Print(Convert.ToString(UO.GetStatLockState(selector)));Parameters and execution flow:
- The threshold 95.1 and modes 0/1/2 are given as an example. −1 is checked before changing mode. After writing, only the local copy is read; it's not waiting for the server to respond.
return RunScenario();
object? RunScenario()
{
var selector = 0;
var before = UO.GetStatLockState(selector);
if (Truth(before >= 0) && Truth(before <= 2))
{
UO.SetStatLockState(selector, 0);
UO.Print(Convert.ToString(UO.GetStatLockState(selector)));
}
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:
- All the helper code is given below Main. selector selects a skill/characteristic, mode sets the recording mode. ReadValue/ReadMode return the original number; ApplyMode checks the arguments, performs the action, and does not return a value. UO.Wait(1000) in the reading example separates two pictures.
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()
{
ApplyMode(0, 2);
return null;
}
void ApplyMode(dynamic selector, dynamic mode)
{
if (Truth(mode < 0) || Truth(mode > 2))
{
return;
}
if (Truth(UO.GetStatLockState(selector) < 0))
{
return;
}
UO.SetStatLockState(selector, mode);
}
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: statNum (Any), statState (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetStatLockState:bridge.SetStatLockState(Arg(0), Arg(1)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "setstatlockstate":
case "setstatstate": bridge.SetStatLockState(Arg(0), Arg(1)); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.SetStatState(object? statNum, object? statState);Requests a change to the characteristic mode.
-
statNum- Mandatory characteristic number: 0 - STR, 1 - DEX, 2 - INT. This is not its current value and not the name of the string. -
statState— Mandatory mode: 0 — increase, 1 — decrease, 2 — blocking. These are three codes, not bool; true/false do not replace the names of all modes.
void - no return value. The result cannot be used as success/error or compared to true. The subsequent reading shows the local model, not the server's confirmation.
- A valid request sends one packet through GameActions and immediately changes local mode. The server can apply its own restrictions; Increases in skill or stats are not guaranteed. Unknown skill, invalid index/mode and missing character are ignored without a package.
- Mandatory characteristic number: 0 - STR, 1 - DEX, 2 - INT. This is not its current value and not the name of the string.
- ExecuteClientApiCompatibility selects the command branch. Text reads the skill selector, Arg reads the numeric numbers and modes. An unconvertible argument may fail the call with a conversion error.
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.SetStatState");
UO.SetStatState(0, 2);Parameters and execution flow:
- In the example, selector and, when recording, mode are explicitly specified. The first line selects a skill by name or a characteristic by number. Print only prints the result.
var selector = 0;
var mode = 2;
UO.SetStatState(selector, mode);
UO.Print(Convert.ToString(UO.GetStatLockState(selector)));Parameters and execution flow:
- The threshold 95.1 and modes 0/1/2 are given as an example. −1 is checked before changing mode. After writing, only the local copy is read; it's not waiting for the server to respond.
return RunScenario();
object? RunScenario()
{
var selector = 0;
var before = UO.GetStatLockState(selector);
if (Truth(before >= 0) && Truth(before <= 2))
{
UO.SetStatState(selector, 0);
UO.Print(Convert.ToString(UO.GetStatLockState(selector)));
}
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:
- All the helper code is given below Main. selector selects a skill/characteristic, mode sets the recording mode. ReadValue/ReadMode return the original number; ApplyMode checks the arguments, performs the action, and does not return a value. UO.Wait(1000) in the reading example separates two pictures.
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()
{
ApplyMode(0, 2);
return null;
}
void ApplyMode(dynamic selector, dynamic mode)
{
if (Truth(mode < 0) || Truth(mode > 2))
{
return;
}
if (Truth(UO.GetStatLockState(selector) < 0))
{
return;
}
UO.SetStatState(selector, mode);
}
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: statNum (Any), statState (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetStatLockState:bridge.SetStatLockState(Arg(0), Arg(1)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "setstatlockstate":
case "setstatstate": bridge.SetStatLockState(Arg(0), Arg(1)); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.Sex();Reads the gender and race code from the client model.
There are no parameters.
int - compatible code: 0=human male, 1=human female, 2=elf male, 3=elf female, 4=gargoyle male, 5=gargoyle female. Without a character is also 0, so check Exists(self) for availability. This is not a simple bool female.
- 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.
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.Sex();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- A call without arguments refers to self. The gender and race code is stored in value.
- Convert.ToString converts the number to be output and does not change the meaning of the result.
var value = UO.Sex();
UO.Print("Sex: " + Convert.ToString(value));Parameters and execution flow:
- The value is read once without any arguments. The gender and race code is used in the calculation or condition shown.
- Numerical thresholds are examples of script conditions and not new client limits. The field stores the server units and restrictions described above.
return RunScenario();
object? RunScenario()
{
var value = UO.Sex();
if (Truth(value == 4) || Truth(value == 5))
{
UO.Print("Gargoyle sex/race code");
}
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:
- Both calls without an argument read their current value. UO.Wait(1000) gives a pause in milliseconds between shots.
- Change is compared: gender and race code. An example does not change anything in the world and does not wait endlessly. Events within this second may be missed.
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 before = UO.Sex();
await Delay(1000);
var after = UO.Sex();
if (Truth(before != after))
{
UO.Print("Before: " + Convert.ToString(before) + "; after: " + Convert.ToString(after));
}
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;
}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.Sex:bridge.Sex.
Internal implementation code; this is not a standalone script.
case "sex": return new InjectionValue(bridge.Sex);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.Stam();Reads the current stamina from the local model.
There are no parameters.
int is the value of the Stamina field, not a percentage or a bool. 0 can be a real value or an indication of missing data. Zero maximum cannot be used as a divisor. Someone else's mobile may have unknown meanings. HP/HitsMax may contain relative server scale instead of exact points. HP=0 does not prove death; That's what Dead/IsDead is for.
- The command does not open status and does not request a server update. The client only reads the already loaded data. Does not change characteristics and does not send packets.
- The result is a separate reading. The world can change between Exists and the next challenge; multiple queries do not form an atomic snapshot.
- When reading an object, World.Get rejects the missing or IsDestroyed and produces 0. HP/HitsMax are read from the Entity, including items with these fields; Mana/Stamina - only for Mobile. Without an argument, self is read. The variant of the same name without parameters does not necessarily have a variant with ID: see signatures.
- Reading without arguments also returns 0 for a missing or destroyed Player. This also applies to direct Mana/Stamina and their maximums, not just World.Get forms. A dead character present can retain values.
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.Stam();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- The call without arguments reads self. value stores one number, Convert.ToString converts it for message only.
var value = UO.Stam();
UO.Print("Stam: " + Convert.ToString(value));Parameters and execution flow:
- The applied threshold or calculation for this field is shown. The numbers in the condition are example settings, not server limits. Before dividing by the maximum, its positivity is checked.
return RunScenario();
object? RunScenario()
{
var value = UO.Stam();
if (Truth(value < 15))
{
UO.Print("Known stamina is below the movement threshold of 15");
}
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:
- This name does not have a form with ID. ReadValue without parameters reads self; the two calls are separated by UO.Wait(1000). Comparing two snapshots may miss intermediate changes.
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 before = ReadValue();
await Delay(1000);
var after = ReadValue();
UO.Print("Before: " + Convert.ToString(before) + "; after: " + Convert.ToString(after));
return null;
}
dynamic ReadValue()
{
return UO.Stam();
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
}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.Stamina:bridge.Stamina.
Internal implementation code; this is not a standalone script.
case "stam": return new InjectionValue(bridge.Stamina);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.Stamina();Reads the current stamina from the local model.
There are no parameters.
int is the value of the Stamina field, not a percentage or a bool. 0 can be a real value or an indication of missing data. Zero maximum cannot be used as a divisor. Someone else's mobile may have unknown meanings. HP/HitsMax may contain relative server scale instead of exact points. HP=0 does not prove death; That's what Dead/IsDead is for.
- The command does not open status and does not request a server update. The client only reads the already loaded data. Does not change characteristics and does not send packets.
- The result is a separate reading. The world can change between Exists and the next challenge; multiple queries do not form an atomic snapshot.
- When reading an object, World.Get rejects the missing or IsDestroyed and produces 0. HP/HitsMax are read from the Entity, including items with these fields; Mana/Stamina - only for Mobile. Without an argument, self is read. The variant of the same name without parameters does not necessarily have a variant with ID: see signatures.
- Reading without arguments also returns 0 for a missing or destroyed Player. This also applies to direct Mana/Stamina and their maximums, not just World.Get forms. A dead character present can retain values.
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.Stamina();
UO.Print("Stamina: " + Convert.ToString(result));Parameters and execution flow:
- The call without arguments reads self. value stores one number, Convert.ToString converts it for message only.
var value = UO.Stamina();
UO.Print("Stamina: " + Convert.ToString(value));Parameters and execution flow:
- The applied threshold or calculation for this field is shown. The numbers in the condition are example settings, not server limits. Before dividing by the maximum, its positivity is checked.
return RunScenario();
object? RunScenario()
{
var value = UO.Stamina();
if (Truth(value < 15))
{
UO.Print("Known stamina is below the movement threshold of 15");
}
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:
- This name does not have a form with ID. ReadValue without parameters reads self; the two calls are separated by UO.Wait(1000). Comparing two snapshots may miss intermediate changes.
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 before = ReadValue();
await Delay(1000);
var after = ReadValue();
UO.Print("Before: " + Convert.ToString(before) + "; after: " + Convert.ToString(after));
return null;
}
dynamic ReadValue()
{
return UO.Stamina();
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
}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.RegisterCharacterGetterAliases [Stamina]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Stamina:bridge.Stamina.
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.StaminaAPI creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.Str();Reads the character's current Strength.
There are no parameters.
int — current stat points, 0..65535 in the client model; not percentage, ID, skill, lock mode or bool. 0 also means missing/deleted character or inaccessible object. Compare with the numerical requirement, not == true. This is not a stat cap or a guaranteed base value without modifiers.
- The command takes no arguments. Use the exact signatures above.
- Reads Player.Strength if Player exists and has not been destroyed; otherwise 0. A dead character present is not a removed object. The stat is not calculated from HP, mana, or stamina.
- GetStr/GetInt/GetDex accept ObjID. Data PlayerMobile is only available for self; for another serial - 0, even for loaded mobile. Someone else's characteristics are not substituted or guessed.
- Invoke reads on the game thread with the ability to cancel the wait by script. Does not query status, does not open target, does not send a packet, does not change the characteristic and does not add delay.
- Each call reads the local data anew. The variable stores the snapshot; individual reads may receive different server updates. A non-zero result does not test the connection. Zero can be a value or no data.
- Use the exact C# names:
UO.Str(),UO.Strength(),UO.GetStr()orUO.GetStrength(). C# names are case sensitive.
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.Str();
UO.Print("Str: " + Convert.ToString(result));Parameters and execution flow:
- value stores the numeric result; Convert.ToString just formats it for the journal. There are no arguments or character actions.
var value = UO.Str();
UO.Print("Strength: " + Convert.ToString(value));Parameters and execution flow:
- before and after separate 1000 ms; UO.Wait added to the example. change=after-before can be positive, zero or negative. By itself, it does not distinguish between all intermediate updates and exit from the world.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.Str();
await Delay(1000);
var after = UO.Str();
var change = after - before;
UO.Print("Change: " + Convert.ToString(change));
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));Parameters and execution flow:
- minimum=80 is an example of a requirement, not a client limit. AttributeAtLeast(minimum) rejects the missing character, reads the characteristic once and returns bool: true or false if >= minimum. The logical meaning is given by the comparison, not the characteristic itself.
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(Truth(AttributeAtLeast(80)) == true))
{
UO.Print("Requirement met");
}
else
{
UO.Print("Requirement not met or no player");
}
return null;
}
dynamic AttributeAtLeast(dynamic minimum)
{
if (Truth(UO.Self() == 0))
{
return false;
}
var value = UO.Str();
return value >= minimum;
}
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.Strength:bridge.Strength.
Internal implementation code; this is not a standalone script.
case "str": return new InjectionValue(bridge.Strength);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.Strength();Reads the current power (Strength, Str) of the character.
There are no parameters.
int — current stat points, 0..65535 in the client model; not percentage, ID, skill, lock mode or bool. 0 also means missing/deleted character or inaccessible object. Compare with the numerical requirement, not == true. This is not a stat cap or a guaranteed base value without modifiers.
- The command takes no arguments. Use the exact signatures above.
- Reads Player.Strength if Player exists and has not been destroyed; otherwise 0. A dead character present is not a removed object. The stat is not calculated from HP, mana, or stamina.
- GetStr/GetInt/GetDex accept ObjID. Data PlayerMobile is only available for self; for another serial - 0, even for loaded mobile. Someone else's characteristics are not substituted or guessed.
- Invoke reads on the game thread with the ability to cancel the wait by script. Does not query status, does not open target, does not send a packet, does not change the characteristic and does not add delay.
- Each call reads the local data anew. The variable stores the snapshot; individual reads may receive different server updates. A non-zero result does not test the connection. Zero can be a value or no data.
- C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
UO.Str(),UO.Strength(),UO.GetStr(),UO.GetStrength().
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.Strength();
UO.Print("Strength: " + Convert.ToString(result));Parameters and execution flow:
- value stores the numeric result; Convert.ToString just formats it for the journal. There are no arguments or character actions.
var value = UO.Strength();
UO.Print("Strength: " + Convert.ToString(value));Parameters and execution flow:
- before and after separate 1000 ms; UO.Wait added to the example. change=after-before can be positive, zero or negative. By itself, it does not distinguish between all intermediate updates and exit from the world.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.Strength();
await Delay(1000);
var after = UO.Strength();
var change = after - before;
UO.Print("Change: " + Convert.ToString(change));
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));Parameters and execution flow:
- minimum=80 is an example of a requirement, not a client limit. AttributeAtLeast(minimum) rejects the missing character, reads the characteristic once and returns bool: true or false if >= minimum. The logical meaning is given by the comparison, not the characteristic itself.
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(Truth(AttributeAtLeast(80)) == true))
{
UO.Print("Requirement met");
}
else
{
UO.Print("Requirement not met or no player");
}
return null;
}
dynamic AttributeAtLeast(dynamic minimum)
{
if (Truth(UO.Self() == 0))
{
return false;
}
var value = UO.Strength();
return value >= minimum;
}
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.RegisterCharacterGetterAliases [Strength]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Strength:bridge.Strength.
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.StrengthAPI creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.TicksDead();Reads or marks a noticed death for the first time.
There are no parameters.
int — UO.Timer in tenths of a second from the start of runtime, initially 0. Not the number of deaths and not the duration of death.
- On each call, if bridge.Dead()!=0 and ticksDead==0, saves Timer(). Otherwise it returns the previous ticksDead. After revival, the field is not reset by this method.
- This is the mark of the first call TicksDead at the time of the observed death, not the exact time of the server event. In the first tenth of a second, the value of 0 can be reset.
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.TicksDead();
UO.Print("TicksDead: " + Convert.ToString(result));Parameters and execution flow:
- Reads or marks a noticed death for the first time.
UO.Print(UO.TicksDead());Parameters and execution flow:
- On each call, if bridge.Dead()!=0 and ticksDead==0, saves Timer(). Otherwise it returns the previous ticksDead. After revival, the field is not reset by this method.
return RunScenario();
object? RunScenario()
{
if (Truth(UO.IsDead()))
{
var stamp = UO.TicksDead();
UO.Print(UO.Timer() - stamp);
}
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:
- This is the mark of the first call TicksDead at the time of the observed death, not the exact time of the server event. In the first tenth of a second, the value of 0 can be 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()
{
var before = UO.TicksDead();
UO.Wait(500);
UO.Print(before = UO.TicksDead());
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: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.TicksDead. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Dead:bridge.Dead(). -
InjectionScript.Runtime.InjectionApiUO.Timer:Timer().
Internal implementation code; this is not a standalone script.
public int TicksDead()
{
if (bridge.Dead() != 0 && ticksDead == 0)
ticksDead = Timer();
return ticksDead;
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.ToggleFly();Requests switching the flight of your own Gargoyle: from ground to flight, from flight to ground. This is an action, and UO.Flying() only checks the status. The command will be useful before a route that requires a certain mode.
There are no parameters.
void - no value. This is not true/false or server confirmation. Check the actual result through UO.Flying() after processing the server response.
- The only form is UO.ToggleFly(), without ID, coordinates and parameter true/false. Relates to your character; The flight of another mobile cannot be changed.
- Sends a request 0xBF with a subcommand 0x0032. The call itself does not check race, protocol version, server permissions, or current mode; choose it for your own Gargoyle on a flight-enabled server.
- The server may fail, and the status update comes later. Do not call ToggleFly in a wait loop: calling again may cancel the previous switch. Send one request and read Flying until it times out.
- The altitude Z and the flight sign are different data. UO.Flying() returns int 1/true or 0/false; false is also possible if there is no character or the old protocol.
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.ToggleFly");
UO.ToggleFly();Parameters and execution flow:
- The example is for your Gargoyle on a flight-supporting server. EnsureFlight(timeoutMs) returns 1/true if flight is observed, otherwise 0/false. 2000 — waiting limit in milliseconds; checks every 50 ms. If you are already flying, ToggleFly is not called. At most one request is sent, then the response status is checked. Script pause/scheduler delay can increase real time.
if (Truth(await EnsureFlight(2000)))
{
UO.Print("Flight confirmed; ready for the next stage");
}
else
{
UO.Print("Flight not confirmed; route was not started");
}
async Task<dynamic> EnsureFlight(dynamic timeoutMs)
{
if (!(Truth(UO.Connected())) || Truth(UO.Dead()))
{
return false;
}
if (Truth(UO.Flying()))
{
return true;
}
UO.ToggleFly();
var waited = 0;
while (Truth(waited < timeoutMs))
{
if (!(Truth(UO.Connected())))
{
return false;
}
if (Truth(UO.Flying()))
{
return true;
}
await Delay(50);
waited += 50;
}
return UO.Flying();
}
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;Parameters and execution flow:
- Up to 40 waits for 50 ms, only one request. The Connected check prevents a disconnection from being accepted as a successful landing. Pausing the script can increase the actual time.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
if (Truth(UO.Connected()) && Truth(UO.Flying()))
{
UO.ToggleFly();
var checks = 0;
while (Truth(UO.Connected()) && Truth(UO.Flying()) && Truth(checks < 40))
{
await Delay(50);
checks += 1;
}
if (Truth(UO.Connected()) && !(Truth(UO.Flying())))
{
UO.Print("Landing state observed");
}
else
{
UO.Print("Landing not confirmed");
}
}
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;Parameters and execution flow:
- Assign Main to a key for one switch request. This is not EnsureFlight: pressing again during flight requests landing. A key repeat or two parallel scripts can send multiple requests; no limiter is installed here.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
if (Truth(UO.Connected()) && !(Truth(UO.Dead())))
{
UO.ToggleFly();
}
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.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ToggleFly:bridge.ToggleFly().
Internal implementation code; this is not a standalone script.
case "togglefly": bridge.ToggleFly(); return InjectionValue.Unit;ClassicUO — Bad Newbie & C# Scripts IDE