Repository navigation
EN UO Topic character
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
Home · C# · IDE · UO API · A–Z · Examples · Languages
The state of your character, characteristics, resistances and equipment. For a specific entity, use the serial overload if it is in the command card.
UO.Self · UO.CharacterTitle · UO.CharName · UO.CharTitle · UO.GetRace · UO.GetSex · UO.Race · UO.Sex · UO.IsFemale · UO.GetTitle
UO.Armor · UO.GetArmor · UO.HP · UO.GetHP · UO.Life · UO.GetLife · UO.MaxHP · UO.GetMaxHP · UO.MaxLife · UO.GetMaxLife · UO.Mana · UO.GetMana · UO.MaxMana · UO.GetMaxMana · UO.Stam · UO.GetStam · UO.Stamina · UO.GetStamina · UO.MaxStam · UO.GetMaxStam · UO.MaxStamina · UO.GetMaxStamina · UO.Str · UO.GetStr · UO.Strength · UO.GetStrength · UO.Dex · UO.GetDex · UO.Dexterity · UO.GetDexterity · UO.Int · UO.GetInt · UO.Intelligence · UO.GetIntelligence · UO.Weight · UO.GetWeight · UO.MaxWeight · UO.GetMaxWeight · UO.Luck · UO.GetLuck · UO.Gold · UO.GetGold · UO.GetStatLockState · UO.SetStatLockState · UO.SetStatState · UO.RequestStats · UO.GetStatus · UO.GetPlayerStatusText · UO.LastStatus · UO.LastStatusX · UO.LastStatusY · UO.GetARStatus · UO.SetARStatus · UO.SetARExtParams
UO.Alive · UO.GetAlive · UO.IsAlive · UO.Dead · UO.GetDead · UO.IsDead · UO.Hidden · UO.GetHidden · UO.IsHidden · UO.Poison · UO.Poisoned · UO.GetPoisoned · UO.IsPoisoned · UO.Frozen · UO.GetFrozen · UO.IsFrozen · UO.Paralyzed · UO.GetParalisa · UO.GetParalysed · UO.GetParalyzed · UO.IsParalysed · UO.IsParalyzed · UO.Flying · UO.GetFlying · UO.IsFlying · UO.ToggleFly · UO.GetYellowBar · UO.IsYellowHits · UO.TicksDead
UO.PhysicalResist · UO.GetPhysicalResist · UO.ResistPhysical · UO.GetResistPhysical · UO.FireResist · UO.GetFireResist · UO.ResistFire · UO.GetResistFire · UO.ColdResist · UO.GetColdResist · UO.ResistCold · UO.GetResistCold · UO.PoisonResist · UO.GetPoisonResist · UO.ResistPoison · UO.GetResistPoison · UO.EnergyResist · UO.GetEnergyResist · UO.ResistEnergy · UO.GetResistEnergy · UO.GetResist
UO.GetEquipment · UO.ObjAtLayer · UO.ObjAtLayerEx · UO.Equip · UO.EquipT · UO.EquipItems · UO.Unequip · UO.UnequipItems · UO.WearItem · UO.EquipLastWeapon · UO.RemoveEarrings · UO.RemoveHat · UO.RemoveNeckless · UO.RemoveRing
UO.Dress · UO.Undress · UO.SetDress · UO.UnsetDress · UO.DressSavedSet · UO.EquipDressSet · UO.DressSpeed · UO.SetDressSpeed
UO.Arm · UO.Disarm · UO.SetArm · UO.UnsetArm
UO.UseSelfPaperdollScroll · UO.UseOtherPaperdollScroll
All layers: purpose, meanings and examples. The layer number, serial of the item being worn and its graphic are different values.
Each command card has several independent scenarios: direct code, functions and classes. Below are selected short scenarios; restrictions and full analysis are in the cards.
Parameters, result and all scenarios
var value = UO.HP();
UO.Print("HP: " + Convert.ToString(value));Parameters, result and all scenarios
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;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.Alive();
int UO.Alive(object? value);Checks for the presence of an object without a sign of death.
-
value— 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 - positive serial exists and is not marked dead. The famous item also gives 1: this is not the mobile filter. A dead/missing object gives 0.
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.
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.Alive();
UO.Print("Alive: " + 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.Alive();
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.Alive(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.Alive();
await Delay(500);
var after = UO.Alive();
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.RegisterCharacterGetterAliases [Alive]. -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Exists:bridge.Exists(serial). -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases::IsDeadState:IsDeadState(serial). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
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 => serial > 0 && bridge.Exists(serial) != 0 && IsDeadState(serial) == 0 ? 1 : 0Internal implementation code; this is not a standalone script.
() => getter(bridge.Self)API creation: These functions register the API. They do not run again for every command call.
Parameters: value (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [Alive]. -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Exists:bridge.Exists(serial). -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases::IsDeadState:IsDeadState(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 => serial > 0 && bridge.Exists(serial) != 0 && IsDeadState(serial) == 0 ? 1 : 0Internal 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 · 繁體中文 · 日本語 · 한국어
void UO.Arm(object? name);Restores a previously saved named set of weapons and shields.
-
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.
- An exact match between the current and saved ID is skipped, without being used/raised again. A missing item is not replaced by a similar type. The failure of one operation does not cancel successful ones and does not interfere with the attempts of others; There is no automatic rollback. Need connection and loaded stuff. When removed, a real backpack is used.
- UO.Set("equipfordress", 0) selects the request to use the item (initial mode); non-zero value - pickup/equip. The desired wearable layer is checked in both modes. An item already worn cannot be switched by repeated use. DressSpeed is valid after the accepted request, withdrawal additionally respects DropDelay.
- Dress and Arm return void even on failure. The message that requests have been accepted does not mean confirmation by the server. For continuation dependent on donning, check actual layers with limited expectation.
- UO.SetDress · UO.Dress · UO.DressSavedSet · UO.SetArm · UO.Arm · UO.DressSpeed
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.Arm");
UO.Arm("battle");Parameters and execution flow:
- The required set must be saved earlier in the same runtime state. Don't call SetDress/SetArm just before each restore: this will overwrite the target with the current items.
UO.Arm("battle");Parameters and execution flow:
- A non-zero equipfordress selects pickup/equip; 350 — milliseconds DressSpeed. These settings remain at runtime after the example. Removal and donning is decided by the server.
return RunScenario();
object? RunScenario()
{
UO.Set("equipfordress", 1);
UO.DressSpeed(350);
UO.Arm("battle");
return null;
}Parameters and execution flow:
- lasttarget — ID things that should be included in a previously saved set. The control layer 3 means shoes, 1 means right hand. AwaitSlot makes up to 20 checks with a 100 ms pause and does not repeat the command. This confirms only the selected item, not the entire set.
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 expected = Asc(UO.GetSerial("lasttarget"), 0);
if (Truth(expected == 0))
{
return 0;
}
UO.Arm("battle");
return AwaitSlot(1, expected);
return null;
}
dynamic AwaitSlot(dynamic layer, dynamic expected)
{
for (int attempt = (int)(1); attempt <= 20; attempt += (int)(1))
{
if (Truth(UO.ObjAtLayerEx(layer, UO.Self()) == expected))
{
return 1;
}
UO.Wait(100);
}
return 0;
}
int Asc(object? value, int fallback = 0)
{
string text = Convert.ToString(value) ?? "";
if (text.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
return int.TryParse(text[2..], System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture, out int hex) ? hex : fallback;
return int.TryParse(text, out int number) ? number : fallback;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}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.Arm. -
InjectionScript.Runtime.InjectionApiUO.Equip:Equip(name, armSets, weaponLayers, "Weapon set requests processed.", "No weapons set with setarm.").
Internal implementation code; this is not a standalone script.
public void Arm(string name)
=> Equip(name, armSets, weaponLayers, "Weapon set requests processed.", "No weapons set with setarm.");Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.Armor();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.Armor();
UO.Print("Armor: " + 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.Armor();
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.Armor();
await Delay(500);
var after = UO.Armor();
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.Armor();
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.Armor:bridge.Armor.
Internal implementation code; this is not a standalone script.
case "armor": return new InjectionValue(bridge.Armor);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.CharName();Reads the character's name.
There are no parameters.
string is a name known to the client. An empty string means an empty/unknown value or no object. This is not serial or a profile path. The game name/title is not translated by language IDE.
- 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.CharName();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- There are no parameters: self is read.
- The empty string is handled explicitly; this is not the text "0".
var text = UO.CharName();
if (Truth(text != ""))
{
UO.Print(text);
}
else
{
UO.Print("Text is unavailable");
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- Your character is read, the value is stored as a line.
- The + operator joins strings; Convert.ToString is not needed for this result.
return RunScenario();
object? RunScenario()
{
var text = UO.CharName();
UO.Print("Player имя: " + text);
return null;
}Parameters and execution flow:
- Both calls refer to self; UO.Wait sets the pause 1000 ms.
- The difference may mean updating data or leaving the world. The example does not change the name or title.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
async public Task<object?> RunScenarioAsync()
{
var previous = UO.CharName();
await Delay(1000);
var current = UO.CharName();
if (Truth(previous != current))
{
UO.Print("Updated text: " + current);
}
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}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.GetName:bridge.GetName(Arg(0, bridge.Self)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0, bridge.Self). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
Internal implementation code; this is not a standalone script.
case "getname":
case "charname": return new InjectionValue(bridge.GetName(Arg(0, bridge.Self)));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.CharTitle();Reads the character's title.
There are no parameters.
string is a title known to the client. An empty string means an empty/unknown value or no object. This is not serial or a profile path. The game name/title is not translated by language IDE.
- 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.CharTitle();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- There are no parameters: self is read.
- The empty string is handled explicitly; this is not the text "0".
var text = UO.CharTitle();
if (Truth(text != ""))
{
UO.Print(text);
}
else
{
UO.Print("Text is unavailable");
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- Your character is read, the value is stored as a line.
- The + operator joins strings; Convert.ToString is not needed for this result.
return RunScenario();
object? RunScenario()
{
var text = UO.CharTitle();
UO.Print("Player титул: " + text);
return null;
}Parameters and execution flow:
- Both calls refer to self; UO.Wait sets the pause 1000 ms.
- The difference may mean updating data or leaving the world. The example does not change the name or title.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
async public Task<object?> RunScenarioAsync()
{
var previous = UO.CharTitle();
await Delay(1000);
var current = UO.CharTitle();
if (Truth(previous != current))
{
UO.Print("Updated text: " + current);
}
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}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.CharacterTitle:bridge.CharacterTitle.
Internal implementation code; this is not a standalone script.
case "chartitle": return new InjectionValue(bridge.CharacterTitle);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
string UO.CharacterTitle();Reads the character's title.
There are no parameters.
string is a title known to the client. An empty string means an empty/unknown value or no object. This is not serial or a profile path. The game name/title is not translated by language IDE.
- 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.
var result = UO.CharacterTitle();
UO.Print("CharacterTitle: " + Convert.ToString(result));Parameters and execution flow:
- There are no parameters: self is read.
- The empty string is handled explicitly; this is not the text "0".
var text = UO.CharacterTitle();
if (Truth(text != ""))
{
UO.Print(text);
}
else
{
UO.Print("Text is unavailable");
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- Your character is read, the value is stored as a line.
- The + operator joins strings; Convert.ToString is not needed for this result.
return RunScenario();
object? RunScenario()
{
var text = UO.CharacterTitle();
UO.Print("Player титул: " + text);
return null;
}Parameters and execution flow:
- Both calls refer to self; UO.Wait sets the pause 1000 ms.
- The difference may mean updating data or leaving the world. The example does not change the name or title.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
async public Task<object?> RunScenarioAsync()
{
var previous = UO.CharacterTitle();
await Delay(1000);
var current = UO.CharacterTitle();
if (Truth(previous != current))
{
UO.Print("Updated text: " + current);
}
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}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: string / String.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [CharacterTitle]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.CharacterTitle:bridge.CharacterTitle.
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.CharacterTitleAPI creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.ColdResist();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.ColdResist();
UO.Print("ColdResist: " + 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.ColdResist();
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.ColdResist();
await Delay(500);
var after = UO.ColdResist();
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.ColdResist();
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.ColdResistance:bridge.ColdResistance.
Internal implementation code; this is not a standalone script.
case "coldresist": return new InjectionValue(bridge.ColdResistance);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.Dead();
int UO.Dead(object? id);Checks character death.
-
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 IsDead, 0 has no sign or mobile is absent. HP=0 by itself does not mean death.
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.
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.Dead();
UO.Print("Dead: " + 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.Dead();
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.Dead(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.Dead();
await Delay(500);
var after = UO.Dead();
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.Dead. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Dead:bridge.Dead().
Internal implementation code; this is not a standalone script.
public int Dead() => bridge.Dead();Parameters: id (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Dead. -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(id). -
InjectionScript.Runtime.InjectionApiUO.Dead:Dead(). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.IsDead:bridge.IsDead(serial). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
Internal implementation code; this is not a standalone script.
public int Dead(InjectionValue id)
{
int serial = GetObject(id);
if (serial == bridge.Self)
return Dead();
return serial > 0 ? bridge.IsDead(serial) : 0;
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.Dex();Reads the character's current Dexterity, DEX.
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.Dexterity 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.Dex(),UO.Dexterity(),UO.GetDex(),UO.GetDexterity().
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.Dex();
UO.Print("Dex: " + 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.Dex();
UO.Print("Dexterity: " + 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.Dex();
await Delay(1000);
var after = UO.Dex();
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.Dex();
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.Dexterity:bridge.Dexterity.
Internal implementation code; this is not a standalone script.
case "dex": return new InjectionValue(bridge.Dexterity);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.Dexterity();Reads the character's current Dexterity, DEX.
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.Dexterity 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.Dex(),UO.Dexterity(),UO.GetDex(),UO.GetDexterity().
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.Dexterity();
UO.Print("Dexterity: " + 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.Dexterity();
UO.Print("Dexterity: " + 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.Dexterity();
await Delay(1000);
var after = UO.Dexterity();
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.Dexterity();
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 [Dexterity]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Dexterity:bridge.Dexterity.
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.DexterityAPI creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.Disarm();Removes weapons and shields from hands: layers 1 and 2. Does not affect clothing.
There are no parameters.
Numerical flag int: 1 (condition met) - local operation accepted, 0 (condition not met) - refusal. This is not a server confirmation, not ID, and not a quantity. The server may fail later; check the actual equipment after answering.
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.
- Need loaded items and free hand dragging. When removed, a real self backpack is required: the spare GrabBag is not used. Unknown, destroyed and unsuitable items are rejected. Other people's items cannot be removed via UnequipItems. A set is not an atomic transaction.
- EquipItems/UnequipItems apply DressSpeed after the accepted operation before the next element; Disarm/Undress - after each occupied layer. The withdrawal additionally respects DropDelay when the carry is accepted. The same settings of other runtimes do not change; acceleration does not override server limitations.
- An incorrect call form, an unknown layer name, or a value that is not convertible to a number may cause a script error instead of 0. The equipment snapshot only contains data that has already been loaded. In the assistant, ChangeAndConfirm layer=1 is the right hand: for another thing, pass its real layer.
- For an array, 1 means that all listed operations are accepted; in case of any refusal, 0 is returned. The remaining elements are still processed, there is no rollback. An empty array produces 1 with no action. Disarm/Undress give 1 also when the required layers are already empty; partial failure gives 0.
- UO.EquipItems · UO.UnequipItems · UO.DressSpeed · UO.DropDelay · UO.ObjAtLayerEx
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.Disarm();
UO.Print("Disarm: " + Convert.ToString(result));Parameters and execution flow:
- First, select the appropriate item in the game: lasttarget - its ID. In the Equip/WearItem example, the 1 layer requires an off-hand weapon. Unequip(1) removes the right hand; Disarm/Undress work with their own fixed layers. There are no automatic replays after a refusal.
return UO.Disarm();Parameters and execution flow:
- To equip, 0x0F5E is an example of a sword, 0x1B76 is an example of a shield. FindType looks for them among the loaded items of the backpack, ASC converts the returned hex-ID. For removal, the own current layers are read. If the required item is not available, the script ends. The array stores two ID; Each item is transferred entirely.
return RunScenario();
object? RunScenario()
{
var first = UO.ObjAtLayerEx(1, UO.Self());
var second = UO.ObjAtLayerEx(2, UO.Self());
if (Truth(first == 0) || Truth(second == 0))
{
return 0;
}
UO.AddObject("saved_first", first);
UO.AddObject("saved_second", second);
return UO.Disarm();
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:
- ChangeAndConfirm executes the command once. Then checks the actual state up to 20 times with a pause of 100 ms. 1 - the check saw the expected state, 0 - failure or expired wait. This is the result of our helper, not a new built-in command. Calling the operation itself may also take time.
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 ChangeAndConfirm();
return null;
}
dynamic ChangeAndConfirm()
{
if (!(Truth(UO.Disarm())))
{
return 0;
}
dynamic[] layers = new dynamic[checked((int)(1) + 1)];
layers[0] = 1;
layers[1] = 2;
for (int attempt = (int)(1); attempt <= 20; attempt += (int)(1))
{
dynamic empty = true;
for (int i = (int)(0); i <= ArrayLength(layers) - 1; i += (int)(1))
{
if (Truth(UO.ObjAtLayerEx(layers[i], UO.Self()) != 0))
{
empty = false;
}
}
if (Truth(empty))
{
return 1;
}
UO.Wait(100);
}
return 0;
}
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: No parameters.
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Disarm. -
InjectionScript.Runtime.InjectionApiUO.Unequip:Unequip(weaponLayers, "Weapons disarmed.").
Internal implementation code; this is not a standalone script.
public int Disarm()
=> Unequip(weaponLayers, "Weapons disarmed.");int UO.Dismount();Mount and Dismount send a protocol use-object request without a manual double-click or the war-mode attack policy. The int result is the current Mount-layer item serial, not a success flag. Server confirmation is asynchronous: Mount may still return 0 and Dismount may return the serial before removal is confirmed. Read ObjAtLayer("Mount") after the server reply.
No parameters.
Each block is a complete standalone .csx. Replace demonstration serials, types and coordinates. Arguments follow the signature order; named C# arguments make their roles explicit.
#dismount
Each block is a complete standalone .csx. Replace demonstration serials, types and coordinates. Arguments follow the signature order; named C# arguments make their roles explicit.
int mountLayerSerial = UO.Dismount();
UO.Print(UO.Int2Hex(mountLayerSerial));var before = UO.ObjAtLayer("Mount");
int currentSerial = UO.Dismount();
UO.Print($"{before} -> {UO.Int2Hex(currentSerial)}");UO.Dismount();
await WaitAsync(250);
UO.Print(Convert.ToString(UO.ObjAtLayer("Mount")));new CommandSample().Execute(UO);
sealed class CommandSample
{
public void Execute(global::ClassicUO.CSharp.CSharpGameApi api)
{
int mountLayerSerial = api.Dismount();
api.Print(api.Int2Hex(mountLayerSerial));
}
}CSharpGameApi.Dismount
-> CSharpScriptGlobals
-> InjectionScript.Runtime.InjectionApiUO.Dismount
ClassicUOInjectionApiBridge -> NativeMountController.Request
-> OutgoingPackets.Send_UseObjectRequest (0x06)
-> MountedLayerSerialUnsafe -> Player.FindItemByLayer(Layer.Mount)
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.Dress(object? name);Restores a previously saved named clothing 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.
- An exact match between the current and saved ID is skipped, without being used/raised again. A missing item is not replaced by a similar type. The failure of one operation does not cancel successful ones and does not interfere with the attempts of others; There is no automatic rollback. Need connection and loaded stuff. When removed, a real backpack is used.
- UO.Set("equipfordress", 0) selects the request to use the item (initial mode); non-zero value - pickup/equip. The desired wearable layer is checked in both modes. An item already worn cannot be switched by repeated use. DressSpeed is valid after the accepted request, withdrawal additionally respects DropDelay.
- Dress and Arm return void even on failure. The message that requests have been accepted does not mean confirmation by the server. For continuation dependent on donning, check actual layers with limited expectation.
- UO.SetDress · UO.Dress · UO.DressSavedSet · UO.SetArm · UO.Arm · UO.DressSpeed
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.Dress");
UO.Dress("travel");Parameters and execution flow:
- The required set must be saved earlier in the same runtime state. Don't call SetDress/SetArm just before each restore: this will overwrite the target with the current items.
UO.Dress("travel");Parameters and execution flow:
- A non-zero equipfordress selects pickup/equip; 350 — milliseconds DressSpeed. These settings remain at runtime after the example. Removal and donning is decided by the server.
return RunScenario();
object? RunScenario()
{
UO.Set("equipfordress", 1);
UO.DressSpeed(350);
UO.Dress("travel");
return null;
}Parameters and execution flow:
- lasttarget — ID things that should be included in a previously saved set. The control layer 3 means shoes, 1 means right hand. AwaitSlot makes up to 20 checks with a 100 ms pause and does not repeat the command. This confirms only the selected item, not the entire set.
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 expected = Asc(UO.GetSerial("lasttarget"), 0);
if (Truth(expected == 0))
{
return 0;
}
UO.Dress("travel");
return AwaitSlot(3, expected);
return null;
}
dynamic AwaitSlot(dynamic layer, dynamic expected)
{
for (int attempt = (int)(1); attempt <= 20; attempt += (int)(1))
{
if (Truth(UO.ObjAtLayerEx(layer, UO.Self()) == expected))
{
return 1;
}
UO.Wait(100);
}
return 0;
}
int Asc(object? value, int fallback = 0)
{
string text = Convert.ToString(value) ?? "";
if (text.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
return int.TryParse(text[2..], System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture, out int hex) ? hex : fallback;
return int.TryParse(text, out int number) ? number : fallback;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}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.Dress. -
InjectionScript.Runtime.InjectionApiUO.Equip:Equip(name, dressSets, dressLayers, "Clothing set requests processed.", "No clothing set with setdress.").
Internal implementation code; this is not a standalone script.
public void Dress(string name)
=> Equip(name, dressSets, dressLayers, "Clothing set requests processed.", "No clothing set with setdress.");Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.DressSavedSet();Restores a set of clothes saved by calling UO.SetDress() without a name.
There are no parameters.
In fact, Numeric flag int: 1 (condition met) - all necessary requests are locally accepted or the necessary layers have already matched; 0 (condition not met) - no dialing, no connection, or at least one request was rejected. Registration object? allows this int. This is not ID, the number of items worn, or server confirmation.
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.
- 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.
- An exact match between the current and saved ID is skipped, without being used/raised again. A missing item is not replaced by a similar type. The failure of one operation does not cancel successful ones and does not interfere with the attempts of others; There is no automatic rollback. Need connection and loaded stuff. When removed, a real backpack is used.
- UO.Set("equipfordress", 0) selects the request to use the item (initial mode); non-zero value - pickup/equip. The desired wearable layer is checked in both modes. An item already worn cannot be switched by repeated use. DressSpeed is valid after the accepted request, withdrawal additionally respects DropDelay.
- Dress and Arm return null even on failure. The message that requests have been accepted does not mean confirmation by the server. For continuation dependent on donning, check actual layers with limited expectation.
- UO.SetDress · UO.Dress · UO.DressSavedSet · UO.SetArm · UO.Arm · UO.DressSpeed
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.DressSavedSet();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- The required set must be saved earlier in the same runtime state. Don't call SetDress/SetArm just before each restore: this will overwrite the target with the current items.
return UO.DressSavedSet();Parameters and execution flow:
- A non-zero equipfordress selects pickup/equip; 350 — milliseconds DressSpeed. These settings remain at runtime after the example. Removal and donning is decided by the server.
return RunScenario();
object? RunScenario()
{
UO.Set("equipfordress", 1);
UO.DressSpeed(350);
return UO.DressSavedSet();
return null;
}Parameters and execution flow:
- lasttarget — ID things that should be included in a previously saved set. The control layer 3 means shoes, 1 means right hand. AwaitSlot makes up to 20 checks with a 100 ms pause and does not repeat the command. This confirms only the selected item, not the entire set.
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 expected = Asc(UO.GetSerial("lasttarget"), 0);
if (Truth(expected == 0))
{
return 0;
}
if (!(Truth(UO.DressSavedSet())))
{
return 0;
}
return AwaitSlot(3, expected);
return null;
}
dynamic AwaitSlot(dynamic layer, dynamic expected)
{
for (int attempt = (int)(1); attempt <= 20; attempt += (int)(1))
{
if (Truth(UO.ObjAtLayerEx(layer, UO.Self()) == expected))
{
return 1;
}
UO.Wait(100);
}
return 0;
}
int Asc(object? value, int fallback = 0)
{
string text = Convert.ToString(value) ?? "";
if (text.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
return int.TryParse(text[2..], System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture, out int hex) ? hex : fallback;
return int.TryParse(text, out int number) ? number : fallback;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}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. -
InjectionScript.Runtime.InjectionApiUO.Equip:Equip("__stealth_saved_set__", dressSets, dressLayers, "Clothing set requests processed.", "No clothing set with setdress.").
Internal implementation code; this is not a standalone script.
case "dresssavedset":
case "equipdressset": return new InjectionValue(Equip("__stealth_saved_set__", dressSets, dressLayers, "Clothing set requests processed.", "No clothing set with setdress."));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.DressSpeed();
dynamic UO.DressSpeed(object? value);Reads or sets the pause between dressing/undressing operations in the current runtime. Helps to avoid sending a series of actions too quickly for server rules.
-
value- Optional milliseconds. Without argument - reading; with argument the value is limited to 10..10000. The initial value of runtime can be 0 if the delay has not yet been specified; You cannot write 0 using this command.
No argument: int, current milliseconds. With argument: null, there is no return value; then read UO.DressSpeed() separately. This is not bool.
- EquipItems/UnequipItems apply DressSpeed after the accepted operation before the next element; Disarm/Undress - after each occupied layer. The withdrawal additionally respects DropDelay when the carry is accepted. The same settings of other runtimes do not change; acceleration does not override server limitations.
- UO.EquipItems · UO.UnequipItems · UO.DressSpeed · UO.DropDelay · UO.ObjAtLayerEx
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.DressSpeed();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- Read the current pause and select the minimum for the next set; 0 means a delay that has not yet been specified.
var delay = UO.DressSpeed();
if (Truth(delay < 350))
{
UO.DressSpeed(350);
}
return UO.DressSpeed();
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:
- Set 350 ms and check the stored value separately. You cannot assign the result of a setter to a variable: setter returns Unit.
return RunScenario();
object? RunScenario()
{
UO.DressSpeed(350);
return UO.DressSpeed();
return null;
}Parameters and execution flow:
- ConfigureDressDelay accepts the script setting. 15000 is limited to 10000 ms; The assistant returns the actual saved milliseconds.
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 ConfigureDressDelay(15000);
return null;
}
dynamic ConfigureDressDelay(dynamic requested)
{
UO.DressSpeed(requested);
return UO.DressSpeed();
}
}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. -
InjectionScript.Runtime.InjectionApiUO.SetDressSpeed:SetDressSpeed(Arg(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "dressspeed":
if (arguments.Length > 0) { SetDressSpeed(Arg(0)); return InjectionValue.Unit; }
return new InjectionValue(state.DressSpeed);Parameters: value (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.SetDressSpeed:SetDressSpeed(Arg(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "dressspeed":
if (arguments.Length > 0) { SetDressSpeed(Arg(0)); return InjectionValue.Unit; }
return new InjectionValue(state.DressSpeed);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.EnergyResist();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.EnergyResist();
UO.Print("EnergyResist: " + 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.EnergyResist();
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.EnergyResist();
await Delay(500);
var after = UO.EnergyResist();
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.EnergyResist();
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.EnergyResistance:bridge.EnergyResistance.
Internal implementation code; this is not a standalone script.
case "energyresist": return new InjectionValue(bridge.EnergyResistance);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.Equip(object? layer, object? id);Equips the selected item to the specified layer of your character.
-
layer- Layer number, for example 1 - right hand, 2 - left. Equip and Unequip also accept a layer name, such as "Rhand". WearItem uses a number layer. The layer must match the wearable layer of the item; it is not graphic and not ID. -
id- ID of the specific thing loaded: integer, hex string, "lasttarget" or name AddObject. This is not type. The example with 0x0F5E first looks for the sword of this graphic and gets it ID.
Numerical flag int: 1 (condition met) - local operation accepted, 0 (condition not met) - refusal. This is not a server confirmation, not ID, and not a quantity. The server may fail later; check the actual equipment after answering.
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.
- Need loaded items and free hand dragging. When removed, a real self backpack is required: the spare GrabBag is not used. Unknown, destroyed and unsuitable items are rejected. Other people's items cannot be removed via UnequipItems. A set is not an atomic transaction.
- EquipItems/UnequipItems apply DressSpeed after the accepted operation before the next element; Disarm/Undress - after each occupied layer. The withdrawal additionally respects DropDelay when the carry is accepted. The same settings of other runtimes do not change; acceleration does not override server limitations.
- An incorrect call form, an unknown layer name, or a value that is not convertible to a number may cause a script error instead of 0. The equipment snapshot only contains data that has already been loaded. In the assistant, ChangeAndConfirm layer=1 is the right hand: for another thing, pass its real layer.
- UO.EquipItems · UO.UnequipItems · UO.DressSpeed · UO.DropDelay · UO.ObjAtLayerEx
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.
int item = UO.LastTarget();
if (item != 0)
UO.Print("Accepted flag: " + UO.Equip(1, item));Parameters and execution flow:
- First, select the appropriate item in the game: lasttarget - its ID. In the Equip/WearItem example, the 1 layer requires an off-hand weapon. Unequip(1) removes the right hand; Disarm/Undress work with their own fixed layers. There are no automatic replays after a refusal.
var item = Asc(UO.GetSerial("lasttarget"), 0);
if (Truth(item == 0))
{
return 0;
}
return UO.Equip(1, item);
int Asc(object? value, int fallback = 0) { string text = Convert.ToString(value) ?? ""; if (text.StartsWith("0x", StringComparison.OrdinalIgnoreCase)) return int.TryParse(text[2..], System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture, out int hex) ? hex : fallback; return int.TryParse(text, out int number) ? number : fallback; }
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- To equip, 0x0F5E is an example of a sword, 0x1B76 is an example of a shield. FindType looks for them among the loaded items of the backpack, ASC converts the returned hex-ID. For removal, the own current layers are read. If the required item is not available, the script ends. The array stores two ID; Each item is transferred entirely.
return RunScenario();
object? RunScenario()
{
var first = Asc(UO.FindType(0x0F5E, -1, "backpack"), 0);
var second = Asc(UO.FindType(0x1B76, -1, "backpack"), 0);
if (Truth(first == 0) || Truth(second == 0))
{
return 0;
}
UO.AddObject("saved_first", first);
UO.AddObject("saved_second", second);
var firstOk = UO.Equip(1, first);
var secondOk = UO.Equip(2, second);
return firstOk != 0 && secondOk != 0;
return null;
}
int Asc(object? value, int fallback = 0)
{
string text = Convert.ToString(value) ?? "";
if (text.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
return int.TryParse(text[2..], System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture, out int hex) ? hex : fallback;
return int.TryParse(text, out int number) ? number : fallback;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- ChangeAndConfirm executes the command once. Then checks the actual state up to 20 times with a pause of 100 ms. 1 - the check saw the expected state, 0 - failure or expired wait. This is the result of our helper, not a new built-in command. Calling the operation itself may also take time.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var item = Asc(UO.GetSerial("lasttarget"), 0);
if (Truth(item == 0))
{
return 0;
}
return ChangeAndConfirm(1, item);
return null;
}
dynamic ChangeAndConfirm(dynamic layer, dynamic item)
{
if (Truth(item == 0))
{
return 0;
}
if (!(Truth(UO.Equip(layer, item))))
{
return 0;
}
for (int attempt = (int)(1); attempt <= 20; attempt += (int)(1))
{
if (Truth(UO.ObjAtLayerEx(layer, UO.Self()) == item))
{
return 1;
}
UO.Wait(100);
}
return 0;
}
int Asc(object? value, int fallback = 0)
{
string text = Convert.ToString(value) ?? "";
if (text.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
return int.TryParse(text[2..], System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture, out int hex) ? hex : fallback;
return int.TryParse(text, out int number) ? number : fallback;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}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), id (Any/Integer/String)
Result: int / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.Equip:Equip(Text(0), Arg(1)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(1). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Equip:bridge.Equip(Arg(0), Arg(1)).
Internal implementation code; this is not a standalone script.
case "equip":
return new InjectionValue(arguments[0].Kind == InjectionValueKind.String ? Equip(Text(0), Arg(1)) : bridge.Equip(Arg(0), Arg(1)));Parameters: layer (Any/String), id (Any/Integer/String)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Equip. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Equip:bridge.Equip(ConvertLayer(layer), id). -
InjectionScript.Runtime.InjectionApiUO.ConvertLayer:ConvertLayer(layer).
Internal implementation code; this is not a standalone script.
public int Equip(string layer, int id) => bridge.Equip(ConvertLayer(layer), id);Parameters: layer (Any/String), id (Any/Integer/String)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Equip. -
InjectionScript.Runtime.InjectionApiUO.Equip:Equip(layer, GetObject(id)). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(id).
Internal implementation code; this is not a standalone script.
public int Equip(string layer, string id) => Equip(layer, GetObject(id));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.EquipDressSet();Alternate name DressSavedSet: Restores the same unnamed set of clothes.
There are no parameters.
In fact, Numeric flag int: 1 (condition met) - all necessary requests are locally accepted or the necessary layers have already matched; 0 (condition not met) - no dialing, no connection, or at least one request was rejected. Registration object? allows this int. This is not ID, the number of items worn, or server confirmation.
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.
- 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.
- An exact match between the current and saved ID is skipped, without being used/raised again. A missing item is not replaced by a similar type. The failure of one operation does not cancel successful ones and does not interfere with the attempts of others; There is no automatic rollback. Need connection and loaded stuff. When removed, a real backpack is used.
- UO.Set("equipfordress", 0) selects the request to use the item (initial mode); non-zero value - pickup/equip. The desired wearable layer is checked in both modes. An item already worn cannot be switched by repeated use. DressSpeed is valid after the accepted request, withdrawal additionally respects DropDelay.
- Dress and Arm return null even on failure. The message that requests have been accepted does not mean confirmation by the server. For continuation dependent on donning, check actual layers with limited expectation.
- UO.SetDress · UO.Dress · UO.DressSavedSet · UO.SetArm · UO.Arm · UO.DressSpeed
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.EquipDressSet();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- The required set must be saved earlier in the same runtime state. Don't call SetDress/SetArm just before each restore: this will overwrite the target with the current items.
return UO.EquipDressSet();Parameters and execution flow:
- A non-zero equipfordress selects pickup/equip; 350 — milliseconds DressSpeed. These settings remain at runtime after the example. Removal and donning is decided by the server.
return RunScenario();
object? RunScenario()
{
UO.Set("equipfordress", 1);
UO.DressSpeed(350);
return UO.EquipDressSet();
return null;
}Parameters and execution flow:
- lasttarget — ID things that should be included in a previously saved set. The control layer 3 means shoes, 1 means right hand. AwaitSlot makes up to 20 checks with a 100 ms pause and does not repeat the command. This confirms only the selected item, not the entire set.
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 expected = Asc(UO.GetSerial("lasttarget"), 0);
if (Truth(expected == 0))
{
return 0;
}
if (!(Truth(UO.EquipDressSet())))
{
return 0;
}
return AwaitSlot(3, expected);
return null;
}
dynamic AwaitSlot(dynamic layer, dynamic expected)
{
for (int attempt = (int)(1); attempt <= 20; attempt += (int)(1))
{
if (Truth(UO.ObjAtLayerEx(layer, UO.Self()) == expected))
{
return 1;
}
UO.Wait(100);
}
return 0;
}
int Asc(object? value, int fallback = 0)
{
string text = Convert.ToString(value) ?? "";
if (text.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
return int.TryParse(text[2..], System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture, out int hex) ? hex : fallback;
return int.TryParse(text, out int number) ? number : fallback;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}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. -
InjectionScript.Runtime.InjectionApiUO.Equip:Equip("__stealth_saved_set__", dressSets, dressLayers, "Clothing set requests processed.", "No clothing set with setdress.").
Internal implementation code; this is not a standalone script.
case "dresssavedset":
case "equipdressset": return new InjectionValue(Equip("__stealth_saved_set__", dressSets, dressLayers, "Clothing set requests processed.", "No clothing set with setdress."));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.EquipItems(object? items);Equip one item or an array of items. The layer of each item is determined by its wearable data, so the item can be put on from a backpack.
-
items- Required ID or array ID of items. Array elements are numbers or numeric hex strings. The single argument also accepts "lasttarget"/name AddObject. For an array, use the variable declaration items[1] for two elements at indexes 0 and 1. Things are transmitted, not layer numbers and not type.
Numerical flag int: 1 (condition met) - local operation accepted, 0 (condition not met) - refusal. This is not a server confirmation, not ID, and not a quantity. The server may fail later; check the actual equipment after answering.
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.
- Need loaded items and free hand dragging. When removed, a real self backpack is required: the spare GrabBag is not used. Unknown, destroyed and unsuitable items are rejected. Other people's items cannot be removed via UnequipItems. A set is not an atomic transaction.
- EquipItems/UnequipItems apply DressSpeed after the accepted operation before the next element; Disarm/Undress - after each occupied layer. The withdrawal additionally respects DropDelay when the carry is accepted. The same settings of other runtimes do not change; acceleration does not override server limitations.
- An incorrect call form, an unknown layer name, or a value that is not convertible to a number may cause a script error instead of 0. The equipment snapshot only contains data that has already been loaded. In the assistant, ChangeAndConfirm layer=1 is the right hand: for another thing, pass its real layer.
- For an array, 1 means that all listed operations are accepted; in case of any refusal, 0 is returned. The remaining elements are still processed, there is no rollback. An empty array produces 1 with no action. Disarm/Undress give 1 also when the required layers are already empty; partial failure gives 0.
- UO.EquipItems · UO.UnequipItems · UO.DressSpeed · UO.DropDelay · UO.ObjAtLayerEx
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.EquipItems(UO.LastTarget());
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- First, select the appropriate item in the game: lasttarget - its ID. In the Equip/WearItem example, the 1 layer requires an off-hand weapon. Unequip(1) removes the right hand; Disarm/Undress work with their own fixed layers. There are no automatic replays after a refusal.
var item = Asc(UO.GetSerial("lasttarget"), 0);
if (Truth(item == 0))
{
return 0;
}
return UO.EquipItems(item);
int Asc(object? value, int fallback = 0) { string text = Convert.ToString(value) ?? ""; if (text.StartsWith("0x", StringComparison.OrdinalIgnoreCase)) return int.TryParse(text[2..], System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture, out int hex) ? hex : fallback; return int.TryParse(text, out int number) ? number : fallback; }
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- To equip, 0x0F5E is an example of a sword, 0x1B76 is an example of a shield. FindType looks for them among the loaded items of the backpack, ASC converts the returned hex-ID. For removal, the own current layers are read. If the required item is not available, the script ends. The array stores two ID; Each item is transferred entirely.
return RunScenario();
object? RunScenario()
{
var first = Asc(UO.FindType(0x0F5E, -1, "backpack"), 0);
var second = Asc(UO.FindType(0x1B76, -1, "backpack"), 0);
if (Truth(first == 0) || Truth(second == 0))
{
return 0;
}
UO.AddObject("saved_first", first);
UO.AddObject("saved_second", second);
dynamic[] items = new dynamic[checked((int)(1) + 1)];
items[0] = first;
items[1] = second;
return UO.EquipItems(items);
return null;
}
int Asc(object? value, int fallback = 0)
{
string text = Convert.ToString(value) ?? "";
if (text.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
return int.TryParse(text[2..], System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture, out int hex) ? hex : fallback;
return int.TryParse(text, out int number) ? number : fallback;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- ChangeAndConfirm executes the command once. Then checks the actual state up to 20 times with a pause of 100 ms. 1 - the check saw the expected state, 0 - failure or expired wait. This is the result of our helper, not a new built-in command. Calling the operation itself may also take time.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var item = Asc(UO.GetSerial("lasttarget"), 0);
if (Truth(item == 0))
{
return 0;
}
return ChangeAndConfirm(1, item);
return null;
}
dynamic ChangeAndConfirm(dynamic layer, dynamic item)
{
if (Truth(item == 0))
{
return 0;
}
if (!(Truth(UO.EquipItems(item))))
{
return 0;
}
for (int attempt = (int)(1); attempt <= 20; attempt += (int)(1))
{
if (Truth(UO.ObjAtLayerEx(layer, UO.Self()) == item))
{
return 1;
}
UO.Wait(100);
}
return 0;
}
int Asc(object? value, int fallback = 0)
{
string text = Convert.ToString(value) ?? "";
if (text.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
return int.TryParse(text[2..], System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture, out int hex) ? hex : fallback;
return int.TryParse(text, out int number) ? number : fallback;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: items (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ChangeEquipmentItems:ChangeEquipmentItems(ArrayArg(0), true). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::ArrayArg:ArrayArg(0).
Internal implementation code; this is not a standalone script.
case "equipitems":
return new InjectionValue(ChangeEquipmentItems(ArrayArg(0), true));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.EquipLastWeapon();Requests re-equipment of the last saved right and left hand items.
There are no parameters.
void - no return value.
- Bridge stores _lastRightHand and _lastLeftHand. A non-zero right serial is transmitted Equip(OneHanded), a non-zero left - Equip(TwoHanded). Empty entries are skipped. These are two possible requests, not an atomic confirmed recovery 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.EquipLastWeapon");
UO.EquipLastWeapon();Parameters and execution flow:
- Only saved bridge serial hands are used.
UO.EquipLastWeapon();Parameters and execution flow:
- Connection testing is performed before requests are sent.
return RunScenario();
object? RunScenario()
{
if (Truth(UO.Connected()))
{
UO.EquipLastWeapon();
}
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:
- A fully declared helper causes one set of hands to be restored.
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()
{
RestoreWeapons();
return null;
}
void RestoreWeapons()
{
UO.EquipLastWeapon();
}
}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.EquipLastWeapon:bridge.EquipLastWeapon().
Internal implementation code; this is not a standalone script.
case "equiplastweapon": bridge.EquipLastWeapon(); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.EquipT(object? layer, object? @type);-
layer— Equipment layer. The line "Rhand" is the right hand (1), "Lhand" is the left hand (2); a numeric number is also acceptable. All recognized names are listed in the layer table. The string "1" does not replace the number 1: an unknown string name causes an error. Select the actual layer of the thing itself: the command does not change its valid slot. -
type- One graphic item, for example 0x0F51 - dagger. This is not a serial of a specific thing and not a graphic of a mobile body. A number or numeric hex string. Color is not specified: any hue is searched; the search recursively includes the loaded subcontainers of the knapsack. -1/0xFFFF as wildcard searches here are practically useless for choosing weapons: the first thing that may not match the layer will be taken.
void: This C# form does not return a value. Don't assign its call to a variable and don't use it in if. To test for acceptance of a request with two integer arguments, use UO.Equipt. In both cases, check the actual equipment after the server responds via ObjAtLayer and GetType.
- Both arguments are required. First, FindType looks for an item in the backpack, then Equip checks its suitability. The search updates the overall results FindItem/FindCount/GetFoundItems. If there are multiple matches, the first item suitable for the search is selected; There is no separate choice for quality, hue or name.
- The client checks the wearable flag, the actual layer of the item (1..29) and the ability to lift it. The item must be loaded. The server additionally decides whether it is allowed to be worn; an accepted local request does not prove success.
- If there is no item, the void form displays the message No item found; the numeric form returns 0. If you need to select a specific item by color/serial, use separate FindType and Equip. UO.Equip takes ID of the found item.
- While waiting for a response, do not start another item transfer at the same time. Check the layer changes rather than repeating the action endlessly.
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.EquipT");
UO.EquipT("Rhand", 0x0F51);Parameters and execution flow:
- The Rhand line selects the right hand layer. The dagger must be accessible in a loaded backpack. Any color; the number of arguments is always two.
if (Truth(UO.Connected()))
{
UO.EquipT("Rhand", 0x0F51);
}
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:
- 1 - layer, 0x0F51 - type. The string C# form EquipT returns void; The acceptance of a request cannot be verified by its result. 300 ms - short wait for example; the absence of a thing after it does not prove definitive server failure.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
UO.EquipT("Rhand", 0x0F51);
await Delay(300);
var worn = UO.ObjAtLayer(1);
if (Truth(worn != 0) && Truth(UO.GetType(worn) == 0x0F51))
{
UO.AddObject("equipped_dagger", worn);
}
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:
- timeoutMs=2000 specifies the maximum wait in milliseconds. Checking every 50 ms does not send re-equipment. true of this custom function means that the client already sees the desired type on the layer; this is a stronger check than Equipt's acceptance of the request.
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()
{
if (Truth(UO.Connected()) && !(Truth(await EnsureDagger(2000))))
{
UO.Print("Dagger was not confirmed within the timeout");
}
return null;
}
async Task<dynamic> EnsureDagger(dynamic timeoutMs)
{
var worn = UO.ObjAtLayer(1);
if (Truth(worn != 0) && Truth(UO.GetType(worn) == 0x0F51))
{
return true;
}
UO.EquipT("Rhand", 0x0F51);
var started = Now();
while (Truth(Now() - started < timeoutMs))
{
await Delay(50);
worn = UO.ObjAtLayer(1);
if (Truth(worn != 0) && Truth(UO.GetType(worn) == 0x0F51))
{
return true;
}
}
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;
private int Now() => global::ClassicUO.CSharp.CSharpScriptContext.Current.Now();
}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), type (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.EquipT. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.FindType:bridge.FindType(ResolveType(type), -1, bridge.Backpack, -1, true). -
InjectionScript.Runtime.InjectionApiUO.ResolveType:ResolveType(type). -
InjectionScript.Runtime.InjectionApiUO.SystemMessage:SystemMessage("No item found."). -
InjectionScript.Runtime.InjectionApiUO.Equip:Equip(layer.String, obj). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Equip:bridge.Equip(NumberConversions.ToInt(layer), obj). -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(layer). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Backpack:bridge.Backpack.
Internal implementation code; this is not a standalone script.
public void EquipT(InjectionValue layer, InjectionValue type)
{
var obj = bridge.FindType(ResolveType(type), -1, bridge.Backpack, -1, true);
if (obj == 0)
{
SystemMessage("No item found.");
return;
}
if (layer.Kind == InjectionValueKind.String)
Equip(layer.String, obj);
else
bridge.Equip(NumberConversions.ToInt(layer), obj);
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.Equipt(object? layer, object? @type);-
layer/ layer - integer number of the equipment layer. Right hand - 1, left - 2. Choose a real item slot. -
type/ type - a whole graphic of an item, for example 0x0F51 for a dagger. This is not serial. Searches for any hue in the loaded contents of the backpack and nested containers.
This C# form returns int: 1 if the client accepted the outfit request, 0 otherwise. Pass two integers (layer number and graphic); string values select a different runtime contract and are not suitable for this form. The call does not wait for server confirmation. For a string layer name, use UO.EquipT, which returns void.
- Both arguments are required. First, FindType looks for an item in the backpack, then Equip checks its suitability. The search updates the overall results FindItem/FindCount/GetFoundItems. If there are multiple matches, the first item suitable for the search is selected; There is no separate choice for quality, hue or name.
- The client checks the wearable flag, the actual layer of the item (1..29) and the ability to lift it. The item must be loaded. The server additionally decides whether it is allowed to be worn; an accepted local request does not prove success.
- If there is no item, the null form displays the message No item found; the numeric form returns 0. If you need to select a specific item by color/serial, use separate FindType and Equip. UO.Equip takes ID of the found item.
- While waiting for a response, do not start another item transfer at the same time. Check the layer changes rather than repeating the action endlessly.
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.Equipt(1, 0x0F51);
UO.Print("Equipt: " + Convert.ToString(result));Parameters and execution flow:
- Both arguments are integers: the layer 1 and the dagger graphic. The value 1 confirms that the request was accepted by the client rather than the server.
int accepted = UO.Equipt(1, 0x0F51);
UO.Print(accepted != 0 ? "Equip request accepted locally" : "Equip request not accepted");Parameters and execution flow:
- Waiting is not a substitute for checking: the actual thing on the layer is read. The script does not repeat the transfer endlessly.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
int accepted = UO.Equipt(1, 0x0F51);
if (accepted == 0)
return false;
await WaitAsync(300);
int worn = UO.ObjAtLayer(1);
return worn != 0 && UO.GetType(worn) == 0x0F51;
return null;
}Parameters and execution flow:
- First, the current equipment is checked; After one request, verification is limited to twenty attempts.
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()
{
return await EnsureDagger();
return null;
}
async Task<bool> EnsureDagger()
{
int current = UO.ObjAtLayer(1);
if (current != 0 && UO.GetType(current) == 0x0F51)
return true;
if (UO.Equipt(1, 0x0F51) == 0)
return false;
for (int attempt = 0; attempt < 20; attempt++)
{
await WaitAsync(100);
current = UO.ObjAtLayer(1);
if (current != 0 && UO.GetType(current) == 0x0F51)
return true;
}
return false;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: layer (Integer), type (Integer)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Equipt. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.FindType:bridge.FindType(type, -1, bridge.Backpack, -1, true). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Equip:bridge.Equip(layer, item). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Backpack:bridge.Backpack.
Internal implementation code; this is not a standalone script.
public int Equipt(int layer, int type)
{
int item = bridge.FindType(type, -1, bridge.Backpack, -1, true);
return item == 0 ? 0 : bridge.Equip(layer, item);
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.FireResist();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.FireResist();
UO.Print("FireResist: " + 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.FireResist();
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.FireResist();
await Delay(500);
var after = UO.FireResist();
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.FireResist();
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.FireResistance:bridge.FireResistance.
Internal implementation code; this is not a standalone script.
case "fireresist": return new InjectionValue(bridge.FireResistance);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.Flying();
int UO.Flying(object? id);Checks if the character is currently flying. This is usually needed for Gargoyle: for example, before starting a route or before requesting to enable a flight. Answers the question “is my character flying now?” without argument. The command only reads the state: it does not enable flight, land or move the character.
-
id- Optional character serial: number, hex string, self, lasttarget or name saved via UO.AddObject. Without argument, your character is used. This is the ID of a specific mobile, not the graphic/type and not the Z coordinate. An unknown name, missing/deleted mobile or item gives 0.
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 IsFlying, 0 has no flag or mobile is missing. Altitude Z by itself does not mean flight.
The result of the command is a numeric flag: 1 means a fulfilled condition, 0 means an unfulfilled one. After var result = command(...) check if (result != 0) or if (result == 0). Save the result of one call: a repeated call can perform the action again or read the state that has already changed.
- The main gaming application is the flight of Gargoyle. However, the getter does not check the race: in this client it reads the 0x04 bit of mobile with protocol version 7.0.0.0 and newer. On the old protocol it returns 0. Standing on a roof, high Z, wing animations, or the Gargoyle race itself are not proof of flight enabled.
- There is a separate UO.ToggleFly() for changing state: it sends a switch request rather than a "turn on" command. If you are already flying, a repeat call requests landing. The server may fail; after prompting, read Flying again with limited waiting. false is also possible without character/data available, so check Connected before playing the action.
- 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.
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.Flying();
UO.Print("Flying: " + Convert.ToString(result));Parameters and execution flow:
- Empty parentheses indicate self. true is equal to 1, false is equal to 0; if UO.Flying() { ... } is acceptable. This example doesn't switch anything.
var active = UO.Flying();
if (Truth(Truth(active) == true))
{
UO.Print("Flying mode active");
}
else
{
UO.Print("Ground mode or character data 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:
- ReadState(obj) accepts serial/alias and returns state. The full definition is below; the absence of an object is handled before reading. Someone else's character is also checked against the data already received by the client.
return RunScenario();
object? RunScenario()
{
var target = Asc(UO.GetSerial("lasttarget"), 0);
if (Truth(target != 0) && Truth(UO.Exists(target)))
{
if (Truth(ReadState(target)))
{
UO.AddObject("flying_mobile", target);
}
}
return null;
}
dynamic ReadState(dynamic obj)
{
if (!(Truth(UO.Exists(obj))))
{
return false;
}
return UO.Flying(obj);
}
int Asc(object? value, int fallback = 0)
{
string text = Convert.ToString(value) ?? "";
if (text.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
return int.TryParse(text[2..], System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture, out int hex) ? hex : fallback;
return int.TryParse(text, out int number) ? number : fallback;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;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.
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()
{
if (Truth(await EnsureFlight(2000)))
{
UO.Print("Flight confirmed; ready for the next stage");
}
else
{
UO.Print("Flight not confirmed; route was not started");
}
return null;
}
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;
}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.Flying. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Flying:bridge.Flying(bridge.Self). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
Internal implementation code; this is not a standalone script.
public int Flying() => bridge.Flying(bridge.Self);Parameters: id (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Flying. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Flying:bridge.Flying(GetObject(id)). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(id).
Internal implementation code; this is not a standalone script.
public int Flying(InjectionValue id) => bridge.Flying(GetObject(id));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.Frozen();
int UO.Frozen(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.Frozen();
UO.Print("Frozen: " + 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.Frozen();
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.Frozen(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.Frozen()) == true) && Truth(attempts < 10))
{
await Delay(100);
attempts = attempts + 1;
}
if (Truth(UO.IsNPC("self")))
{
if (Truth(Truth(UO.Frozen()) == 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.RegisterCharacterGetterAliases [Frozen]. -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetLocked:bridge.GetLocked(serial). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
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.
() => getter(bridge.Self)API creation: These functions register the API. They do not run again for every command call.
Parameters: value (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [Frozen]. -
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 · 繁體中文 · 日本語 · 한국어
dynamic UO.GetARStatus();Reads the flag for automatic reconnection of the current manager session or global client.
There are no parameters.
int 1 — automatic reconnect is enabled; 0 — disabled.
- SessionControl.AutoReconnect has priority. If SessionControl is missing, Settings.GlobalSettings.Reconnect is used. This is a setting, not the state of the current connection or the number of attempts.
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.GetARStatus();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- Read does not connect.
var enabled = UO.GetARStatus();
UO.Print(Convert.ToString(enabled));Parameters and execution flow:
- The AR setting and the actual connection are two separate values.
return RunScenario();
object? RunScenario()
{
var enabled = UO.GetARStatus();
var online = UO.Connected();
UO.Print(Convert.ToString(enabled) + " " + Convert.ToString(online));
return null;
}Parameters and execution flow:
- Connect manually allowed when automatic reconnect is disabled.
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.GetARStatus() == 0) && !(Truth(UO.Connected())))
{
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: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetAutoReconnect:bridge.GetAutoReconnect().
Internal implementation code; this is not a standalone script.
case "getarstatus": return new InjectionValue(bridge.GetAutoReconnect());Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetAlive();
int UO.GetAlive(object? value);Checks for the presence of an object without a sign of death.
-
value— 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 - positive serial exists and is not marked dead. The famous item also gives 1: this is not the mobile filter. A dead/missing object gives 0.
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.
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.GetAlive();
UO.Print("GetAlive: " + 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.GetAlive();
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.GetAlive(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.GetAlive();
await Delay(500);
var after = UO.GetAlive();
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.RegisterCharacterGetterAliases [GetAlive]. -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Exists:bridge.Exists(serial). -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases::IsDeadState:IsDeadState(serial). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
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 => serial > 0 && bridge.Exists(serial) != 0 && IsDeadState(serial) == 0 ? 1 : 0Internal implementation code; this is not a standalone script.
() => getter(bridge.Self)API creation: These functions register the API. They do not run again for every command call.
Parameters: value (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetAlive]. -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Exists:bridge.Exists(serial). -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases::IsDeadState:IsDeadState(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 => serial > 0 && bridge.Exists(serial) != 0 && IsDeadState(serial) == 0 ? 1 : 0Internal 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.GetArmor();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.GetArmor();
UO.Print("GetArmor: " + 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.GetArmor();
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.GetArmor();
await Delay(500);
var after = UO.GetArmor();
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.GetArmor();
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 [GetArmor]. -
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.GetColdResist();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.GetColdResist();
UO.Print("GetColdResist: " + 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.GetColdResist();
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.GetColdResist();
await Delay(500);
var after = UO.GetColdResist();
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.GetColdResist();
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 [GetColdResist]. -
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.GetDead();
int UO.GetDead(object? value);Checks character death.
-
value— 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 IsDead, 0 has no sign or mobile is absent. HP=0 by itself does not mean death.
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.
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.GetDead();
UO.Print("GetDead: " + 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.GetDead();
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.GetDead(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.GetDead();
await Delay(500);
var after = UO.GetDead();
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.RegisterCharacterGetterAliases [GetDead]. -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
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.
IsDeadStateInternal implementation code; this is not a standalone script.
() => getter(bridge.Self)API creation: These functions register the API. They do not run again for every command call.
Parameters: value (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetDead]. -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases. -
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.
IsDeadStateInternal 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.GetDex();
int UO.GetDex(object? objID);Reads the character's current Dexterity, DEX.
-
objID— ObjID only in the form shown with one argument: serial character number, decimal/0x hex string, "self", "lasttarget" or name AddObject. Selects an object, not a graphic/type. Without an argument, the current character is read.
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.
- Supported are () for self and (ObjID) for an explicit object. There are no other optional arguments.
- Reads Player.Dexterity 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.Dex(),UO.Dexterity(),UO.GetDex(),UO.GetDexterity(). - ExecuteClientApiCompatibility.Arg first resolves the object name, then converts the number. An unknown non-numeric string causes a conversion error, not a target. double is converted to int, Array/void is converted to 0. To select a character, use the correct serial, not such transformations.
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.GetDex();
UO.Print("GetDex: " + 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.GetDex();
UO.Print("Dexterity: " + 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.GetDex();
await Delay(1000);
var after = UO.GetDex();
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.GetDex();
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;
}Parameters and execution flow:
- id is the result of UO.Self(), not type. AddObject stores ID as statSubject without target cursor because the second argument is specified. Both calls select the same character, but the readings are not atomic.
var id = UO.Self();
if (Truth(id != 0))
{
UO.AddObject("statSubject", id);
var direct = UO.GetDex(id);
var byName = UO.GetDex("statSubject");
UO.Print("Direct: " + Convert.ToString(direct) + "; alias: " + Convert.ToString(byName));
}
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 [GetDex]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Dexterity:bridge.Dexterity.
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.DexterityAPI creation: These functions register the API. They do not run again for every command call.
Parameters: objID (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetDexterity:bridge.GetDexterity(Arg(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Dexterity:bridge.Dexterity.
Internal implementation code; this is not a standalone script.
case "getdex": return new InjectionValue(arguments.Length > 0 ? bridge.GetDexterity(Arg(0)) : bridge.Dexterity);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetDexterity();Reads the character's current Dexterity, DEX.
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.Dexterity 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.Dex(),UO.Dexterity(),UO.GetDex(),UO.GetDexterity().
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.GetDexterity();
UO.Print("GetDexterity: " + 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.GetDexterity();
UO.Print("Dexterity: " + 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.GetDexterity();
await Delay(1000);
var after = UO.GetDexterity();
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.GetDexterity();
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 [GetDexterity]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Dexterity:bridge.Dexterity.
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.DexterityAPI creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetEnergyResist();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.GetEnergyResist();
UO.Print("GetEnergyResist: " + 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.GetEnergyResist();
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.GetEnergyResist();
await Delay(500);
var after = UO.GetEnergyResist();
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.GetEnergyResist();
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 [GetEnergyResist]. -
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.
ClassicUO — Bad Newbie & C# Scripts IDE