Repository navigation
EN UO Topic character Part 5
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
Home · C# · IDE · UO API · A–Z · Examples · Languages
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.Undress();Removes clothing and armor from layers 3,4,5,6,7,8,10,12,13,14,17,18,19,20,22,23,24. Hands, hair, beard, backpack, mount and bank are not affected.
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.Undress();
UO.Print("Undress: " + 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.Undress();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(5, UO.Self());
var second = UO.ObjAtLayerEx(4, UO.Self());
if (Truth(first == 0) || Truth(second == 0))
{
return 0;
}
UO.AddObject("saved_first", first);
UO.AddObject("saved_second", second);
return UO.Undress();
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.Undress())))
{
return 0;
}
dynamic[] layers = new dynamic[checked((int)(16) + 1)];
layers[0] = 3;
layers[1] = 4;
layers[2] = 5;
layers[3] = 6;
layers[4] = 7;
layers[5] = 8;
layers[6] = 10;
layers[7] = 12;
layers[8] = 13;
layers[9] = 14;
layers[10] = 17;
layers[11] = 18;
layers[12] = 19;
layers[13] = 20;
layers[14] = 22;
layers[15] = 23;
layers[16] = 24;
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.Undress. -
InjectionScript.Runtime.InjectionApiUO.Unequip:Unequip(dressLayers, "Clothing removed.").
Internal implementation code; this is not a standalone script.
public int Undress()
=> Unequip(dressLayers, "Clothing removed.");Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.Unequip(object? layer);Removes his item from the specified layer into his own backpack.
-
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.
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.
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.Unequip(1);
UO.Print("Unequip: " + 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.Unequip(1);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);
var firstOk = UO.Unequip(1);
var secondOk = UO.Unequip(2);
return firstOk != 0 && secondOk != 0;
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;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 = UO.ObjAtLayerEx(1, UO.Self());
return ChangeAndConfirm(1, item);
return null;
}
dynamic ChangeAndConfirm(dynamic layer, dynamic item)
{
if (Truth(item == 0))
{
return 0;
}
if (Truth(UO.ObjAtLayerEx(layer, UO.Self()) != item))
{
return 0;
}
if (!(Truth(UO.Unequip(layer))))
{
return 0;
}
for (int attempt = (int)(1); attempt <= 20; attempt += (int)(1))
{
if (Truth(UO.ObjAtLayerEx(layer, UO.Self()) == 0))
{
return 1;
}
UO.Wait(100);
}
return 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: layer (Any/String)
Result: int / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.Unequip:Unequip(Text(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Unequip:bridge.Unequip(Arg(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "unequip":
return new InjectionValue(arguments[0].Kind == InjectionValueKind.String ? Unequip(Text(0)) : bridge.Unequip(Arg(0)));Parameters: layer (Any/String)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Unequip. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Unequip:bridge.Unequip(ConvertLayer(layer)). -
InjectionScript.Runtime.InjectionApiUO.ConvertLayer:ConvertLayer(layer).
Internal implementation code; this is not a standalone script.
public int Unequip(string layer) => bridge.Unequip(ConvertLayer(layer));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.UnequipItems(object? items);Takes the listed personal items into the backpack. ID of someone else's item does not remove your item from the same layer.
-
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.UnequipItems(UO.ObjAtLayerEx(1, "self"));
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.UnequipItems(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 = 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);
dynamic[] items = new dynamic[checked((int)(1) + 1)];
items[0] = first;
items[1] = second;
return UO.UnequipItems(items);
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()
{
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.ObjAtLayerEx(layer, UO.Self()) != item))
{
return 0;
}
if (!(Truth(UO.UnequipItems(item))))
{
return 0;
}
for (int attempt = (int)(1); attempt <= 20; attempt += (int)(1))
{
if (Truth(UO.ObjAtLayerEx(layer, UO.Self()) == 0))
{
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), false). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::ArrayArg:ArrayArg(0).
Internal implementation code; this is not a standalone script.
case "unequipitems":
return new InjectionValue(ChangeEquipmentItems(ArrayArg(0), false));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.UnsetArm(object? name);Removes an entry for a named weapon set without disarming the character.
-
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.
- The deletion only affects the entry of the selected name. Items remain on the character, other names and other types of sets are not affected. Re-deleting a missing entry is acceptable. UnsetDress and UnsetArm have a name required.
- UO.SetDress · UO.Dress · UO.DressSavedSet · UO.SetArm · UO.Arm · UO.DressSpeed
- In a regular client host, this state data is taken from the GetPersistentState manager and is common to scripts/chat/macros of the same world/profile, and does not belong to one script. Another process or an apparently separate InjectionRuntimeState has a different state. Loading/clearing a profile can replace it; saved serial are still checked against the loaded world.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The command is a separate statement. The message before it marks the start of the call; it does not confirm a server action.
UO.Print("Calling UO.UnsetArm");
UO.UnsetArm("battle");Parameters and execution flow:
- Only the specified entry is deleted. Clothes/weapons cannot be removed.
UO.UnsetArm("battle");Parameters and execution flow:
- The names travel and battle are deleted separately. The same name of a different type of set is retained.
return RunScenario();
object? RunScenario()
{
UO.UnsetArm("travel");
UO.UnsetArm("battle");
return null;
}Parameters and execution flow:
- CleanupSets is a fully declared procedure for cleaning up two proper names. prefix generates entry names, not file paths.
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()
{
CleanupSets("mine_");
return null;
}
void CleanupSets(dynamic prefix)
{
UO.UnsetArm(prefix + "travel");
UO.UnsetArm(prefix + "battle");
}
}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.UnsetArm. -
InjectionScript.Runtime.State.RuntimeDictionary.Remove:armSets.Remove(name). -
InjectionScript.Runtime.InjectionApiUO.SystemMessage:SystemMessage("Arm set removed.").
Internal implementation code; this is not a standalone script.
public void UnsetArm(string name)
{
armSets.Remove(name);
SystemMessage("Arm set removed.");
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.UnsetDress(object? name);Deletes an entry for a named set of clothes without removing the items.
-
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.
- The deletion only affects the entry of the selected name. Items remain on the character, other names and other types of sets are not affected. Re-deleting a missing entry is acceptable. UnsetDress and UnsetArm have a name required.
- UO.SetDress · UO.Dress · UO.DressSavedSet · UO.SetArm · UO.Arm · UO.DressSpeed
- In a regular client host, this state data is taken from the GetPersistentState manager and is common to scripts/chat/macros of the same world/profile, and does not belong to one script. Another process or an apparently separate InjectionRuntimeState has a different state. Loading/clearing a profile can replace it; saved serial are still checked against the loaded world.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The command is a separate statement. The message before it marks the start of the call; it does not confirm a server action.
UO.Print("Calling UO.UnsetDress");
UO.UnsetDress("travel");Parameters and execution flow:
- Only the specified entry is deleted. Clothes/weapons cannot be removed.
UO.UnsetDress("travel");Parameters and execution flow:
- The names travel and battle are deleted separately. The same name of a different type of set is retained.
return RunScenario();
object? RunScenario()
{
UO.UnsetDress("travel");
UO.UnsetDress("battle");
return null;
}Parameters and execution flow:
- CleanupSets is a fully declared procedure for cleaning up two proper names. prefix generates entry names, not file paths.
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()
{
CleanupSets("mine_");
return null;
}
void CleanupSets(dynamic prefix)
{
UO.UnsetDress(prefix + "travel");
UO.UnsetDress(prefix + "battle");
}
}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.UnsetDress. -
InjectionScript.Runtime.State.RuntimeDictionary.Remove:dressSets.Remove(name). -
InjectionScript.Runtime.InjectionApiUO.SystemMessage:SystemMessage("Dress set removed.").
Internal implementation code; this is not a standalone script.
public void UnsetDress(string name)
{
dressSets.Remove(name);
SystemMessage("Dress set removed.");
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.UseOtherPaperdollScroll(object? objID);Uses the specified serial via bridge.UseObject, usually opening the character's paperdoll.
-
objID— Serial/ID object: int, numeric/hex string or set alias, for example "lasttarget". This is not a graphic/type. Check the loaded object before taking action.
void - no value. Call on a separate line; completion does not confirm the server's action.
- ObjID refers to the character, not the ID scroll button. The call does not read the paperdoll structure and does not wait for it to open.
- Bridge sends the request on the game thread. Server rules apply; There is no built-in waiting for confirmation.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The command is a separate statement. The message before it marks the start of the call; it does not confirm a server action.
UO.Print("Calling UO.UseOtherPaperdollScroll");
UO.UseOtherPaperdollScroll(UO.GetSerial("lasttarget"));Parameters and execution flow:
- Uses the specified serial via bridge.UseObject, usually opening the character's paperdoll.
var id = UO.GetSerial("lasttarget");
if (Truth(UO.Exists(id)))
{
UO.UseOtherPaperdollScroll(id);
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- ObjID refers to the character, not the ID scroll button. The call does not read the paperdoll structure and does not wait for it to open.
return RunScenario();
object? RunScenario()
{
var id = UO.GetSerial("self");
if (Truth(UO.Exists(id)))
{
UO.UseOtherPaperdollScroll(id);
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- Bridge sends the request on the game thread. Server rules apply; There is no built-in waiting for confirmation.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
ApplyToLoaded(UO.GetSerial("lasttarget"));
return null;
}
void ApplyToLoaded(dynamic id)
{
if (Truth(UO.Exists(id)))
{
UO.UseOtherPaperdollScroll(id);
}
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: objID (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.UseObject:bridge.UseObject(Arg(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "useotherpaperdollscroll": bridge.UseObject(Arg(0)); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.UseSelfPaperdollScroll();Uses the current character, usually opening a paperdoll.
There are no parameters.
void - no value. Call on a separate line; completion does not confirm the server's action.
- ExecuteClientApiCompatibility calls bridge.UseObject(bridge.Self). There is no separate reading or clicking of the paperdoll element; this is a normal UseObject request for self.
- In the examples, UO.Wait specifies only a script pause; the end of the pause does not prove that the server has completed the request.
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.UseSelfPaperdollScroll");
UO.UseSelfPaperdollScroll();Parameters and execution flow:
- Uses the current character, usually opening a paperdoll.
UO.UseSelfPaperdollScroll();Parameters and execution flow:
- ExecuteClientApiCompatibility calls bridge.UseObject(bridge.Self). There is no separate reading or clicking of the paperdoll element; this is a normal UseObject request for self.
return RunScenario();
object? RunScenario()
{
if (Truth(UO.Self() != 0))
{
UO.UseSelfPaperdollScroll();
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- In the examples, UO.Wait specifies only a script pause; the end of the pause does not prove that the server has completed the request.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
UO.UseSelfPaperdollScroll();
UO.Wait(500);
UO.Print(UO.Name());
return null;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.UseObject:bridge.UseObject(bridge.Self). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
Internal implementation code; this is not a standalone script.
case "useselfpaperdollscroll": bridge.UseObject(bridge.Self); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.WearItem(object? layer, object? objID);Equips the selected item to your character's number layer.
-
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. -
objID- 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: " + Convert.ToString(UO.WearItem(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.WearItem(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.WearItem(1, first);
var secondOk = UO.WearItem(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.WearItem(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), objID (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Equip:bridge.Equip(Arg(0), Arg(1)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "wearitem": return new InjectionValue(bridge.Equip(Arg(0), Arg(1)));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.Weight();Reads your character's status counter: current weight in stones.
There are no parameters.
int — current weight in stones, 0..65535 in the client model. 0 can be a real value, no data, or a missing/destroyed Player. This is quantity, not bool, ID or type: 1 means one unit, not success. The command does not iterate over objects and does not return an array.
- The command takes no arguments. Use the exact signatures above.
- Reading on the game thread takes Player.Weight 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.
- Weight reads the total weight reported by the server, in stones. What weights of the body, equipment and enclosed bags are included in the amount are determined by the rules of the shard. The team does not walk through containers, add up item weights, or update closed bags. This is not the Weight property of an individual item, nor is it the number of items.
- CharacterStatus checks the required body before updating. Weight is in its own extended status, slots are with type 3, Luck - with type 4, server slots WeightMax - with type 5. A compact/old package without an optional counter leaves its previous cache. The new Player starts from scratch; the call does not prove receipt of a fresh status.
- These functions register the API. They do not run again for every command call. C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
- Each call reads the local data anew. The variable stores the snapshot; individual reads may receive different server updates. A non-zero result does not test the connection. Zero can be a value or no data.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.
var result = UO.Weight();
UO.Print("Weight: " + Convert.ToString(result));Parameters and execution flow:
- value stores one no-argument call to its own character; Convert.ToString formats the number for the log without changing its meaning.
var value = UO.Weight();
UO.Print("Weight: " + Convert.ToString(value));Parameters and execution flow:
- UO.Wait(500) separates before and after by 500 milliseconds. difference can be positive, zero or negative; Interim updates and character changes may be skipped. Pause is an example.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.Weight();
await Delay(500);
var after = UO.Weight();
var difference = after - before;
UO.Print("Counter change: " + Convert.ToString(difference));
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));Parameters and execution flow:
- CanCarry(extra) gets extra weight in stones; 10 is an example, not the number of stacks. Rejects negative extra, no Player, or maximum <= 0, reads the current weight and limit, then returns bool: true or false by extra <= maximum - current. Subtraction avoids current + extra overflow. When overloaded, the result is false even for extra=0. This is a local assessment, not a server resolution; reads are not atomic, and the zero weight may be unknown.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
if (Truth(Truth(CanCarry(10)) == true))
{
UO.Print("Local check passed");
}
else
{
UO.Print("Local check failed or data unavailable");
}
return null;
}
dynamic CanCarry(dynamic extra)
{
if (Truth(extra < 0) || Truth(UO.Self() == 0))
{
return false;
}
var current = UO.Weight();
var maximum = UO.MaxWeight();
if (Truth(maximum <= 0))
{
return false;
}
return extra <= maximum - current;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Weight:bridge.Weight.
Internal implementation code; this is not a standalone script.
case "weight": return new InjectionValue(bridge.Weight);ClassicUO — Bad Newbie & C# Scripts IDE