Repository navigation
EN UO Topic character Part 3
Українська · Русский · 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.GetSex();Reads the gender and race code from the client model.
There are no parameters.
int - compatible code: 0=human male, 1=human female, 2=elf male, 3=elf female, 4=gargoyle male, 5=gargoyle female. Without a character is also 0, so check Exists(self) for availability. This is not a simple bool female.
- Already received local data is read. The request does not open status and does not force the server to send an update. After death, map transition, or object deletion, the values may change between two calls.
- C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.
var result = UO.GetSex();
UO.Print("GetSex: " + Convert.ToString(result));Parameters and execution flow:
- A call without arguments refers to self. The gender and race code is stored in value.
- Convert.ToString converts the number to be output and does not change the meaning of the result.
var value = UO.GetSex();
UO.Print("GetSex: " + Convert.ToString(value));Parameters and execution flow:
- The value is read once without any arguments. The gender and race code is used in the calculation or condition shown.
- Numerical thresholds are examples of script conditions and not new client limits. The field stores the server units and restrictions described above.
return RunScenario();
object? RunScenario()
{
var value = UO.GetSex();
if (Truth(value == 4) || Truth(value == 5))
{
UO.Print("Gargoyle sex/race code");
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- Both calls without an argument read their current value. UO.Wait(1000) gives a pause in milliseconds between shots.
- Change is compared: gender and race code. An example does not change anything in the world and does not wait endlessly. Events within this second may be missed.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
async public Task<object?> RunScenarioAsync()
{
var before = UO.GetSex();
await Delay(1000);
var after = UO.GetSex();
if (Truth(before != after))
{
UO.Print("Before: " + Convert.ToString(before) + "; after: " + Convert.ToString(after));
}
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetSex]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Sex:bridge.Sex.
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.SexAPI creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetStam();
dynamic UO.GetStam(object? objID);Reads the current stamina from the local model.
-
objID— 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.
int is the value of the Stamina field, not a percentage or a bool. 0 can be a real value or an indication of missing data. Zero maximum cannot be used as a divisor. Someone else's mobile may have unknown meanings. HP/HitsMax may contain relative server scale instead of exact points. HP=0 does not prove death; That's what Dead/IsDead is for.
- The command does not open status and does not request a server update. The client only reads the already loaded data. Does not change characteristics and does not send packets.
- The result is a separate reading. The world can change between Exists and the next challenge; multiple queries do not form an atomic snapshot.
- When reading an object, World.Get rejects the missing or IsDestroyed and produces 0. HP/HitsMax are read from the Entity, including items with these fields; Mana/Stamina - only for Mobile. Without an argument, self is read. The variant of the same name without parameters does not necessarily have a variant with ID: see signatures.
- Reading without arguments also returns 0 for a missing or destroyed Player. This also applies to direct Mana/Stamina and their maximums, not just World.Get forms. A dead character present can retain values.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.
var result = UO.GetStam();
UO.Print("GetStam: " + Convert.ToString(result));Parameters and execution flow:
- The call without arguments reads self. value stores one number, Convert.ToString converts it for message only.
var value = UO.GetStam();
UO.Print("GetStam: " + Convert.ToString(value));Parameters and execution flow:
- The applied threshold or calculation for this field is shown. The numbers in the condition are example settings, not server limits. Before dividing by the maximum, its positivity is checked.
return RunScenario();
object? RunScenario()
{
var value = UO.GetStam();
if (Truth(value < 15))
{
UO.Print("Known stamina is below the movement threshold of 15");
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- lasttarget - previously selected object; Exists checks for existence. obj is the only parameter of ReadValue. The function returns the command number unchanged and is given in its entirety.
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.Exists("lasttarget")))
{
var value = ReadValue("lasttarget");
UO.Print("Selected value: " + Convert.ToString(value));
}
return null;
}
dynamic ReadValue(dynamic obj)
{
return UO.GetStam(obj);
}
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 [GetStam]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Stamina:bridge.Stamina.
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
() => bridge.StaminaAPI creation: These functions register the API. They do not run again for every command call.
Parameters: objID (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetStamina:bridge.GetStamina(Arg(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Stamina:bridge.Stamina.
Internal implementation code; this is not a standalone script.
case "getstam": return new InjectionValue(arguments.Length > 0 ? bridge.GetStamina(Arg(0)) : bridge.Stamina);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetStamina();Reads the current stamina from the local model.
There are no parameters.
int is the value of the Stamina field, not a percentage or a bool. 0 can be a real value or an indication of missing data. Zero maximum cannot be used as a divisor. Someone else's mobile may have unknown meanings. HP/HitsMax may contain relative server scale instead of exact points. HP=0 does not prove death; That's what Dead/IsDead is for.
- The command does not open status and does not request a server update. The client only reads the already loaded data. Does not change characteristics and does not send packets.
- The result is a separate reading. The world can change between Exists and the next challenge; multiple queries do not form an atomic snapshot.
- When reading an object, World.Get rejects the missing or IsDestroyed and produces 0. HP/HitsMax are read from the Entity, including items with these fields; Mana/Stamina - only for Mobile. Without an argument, self is read. The variant of the same name without parameters does not necessarily have a variant with ID: see signatures.
- Reading without arguments also returns 0 for a missing or destroyed Player. This also applies to direct Mana/Stamina and their maximums, not just World.Get forms. A dead character present can retain values.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.
var result = UO.GetStamina();
UO.Print("GetStamina: " + Convert.ToString(result));Parameters and execution flow:
- The call without arguments reads self. value stores one number, Convert.ToString converts it for message only.
var value = UO.GetStamina();
UO.Print("GetStamina: " + Convert.ToString(value));Parameters and execution flow:
- The applied threshold or calculation for this field is shown. The numbers in the condition are example settings, not server limits. Before dividing by the maximum, its positivity is checked.
return RunScenario();
object? RunScenario()
{
var value = UO.GetStamina();
if (Truth(value < 15))
{
UO.Print("Known stamina is below the movement threshold of 15");
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- This name does not have a form with ID. ReadValue without parameters reads self; the two calls are separated by UO.Wait(1000). Comparing two snapshots may miss intermediate changes.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
async public Task<object?> RunScenarioAsync()
{
var before = ReadValue();
await Delay(1000);
var after = ReadValue();
UO.Print("Before: " + Convert.ToString(before) + "; after: " + Convert.ToString(after));
return null;
}
dynamic ReadValue()
{
return UO.GetStamina();
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [GetStamina]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Stamina:bridge.Stamina.
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
() => bridge.StaminaAPI creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetStatLockState(object? statNum);Reads the local characteristic change mode.
-
statNum- Mandatory characteristic number: 0 - STR, 1 - DEX, 2 - INT. This is not its current value and not the name of the string.
int: 0 — increase, 1 — decrease, 2 — blocking. This is a mode code, not true/false. For a number outside 0..2 returns −1. If the character is missing, a valid number returns 0 by default; this is not a confirmation of the state of the server.
- Reading is performed via Invoke on the game thread based on the data already received; network packets are not sent. The skill is not used or trained. Two requests - two separate snapshots.
- Mandatory characteristic number: 0 - STR, 1 - DEX, 2 - INT. This is not its current value and not the name of the string.
- ExecuteClientApiCompatibility selects the command branch. Text reads the skill selector, Arg reads the numeric numbers and modes. An unconvertible argument may fail the call with a conversion error.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The 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.GetStatLockState(0);
UO.Print("GetStatLockState: " + Convert.ToString(result));Parameters and execution flow:
- In the example, selector and, when recording, mode are explicitly specified. The first line selects a skill by name or a characteristic by number. Print only prints the result.
var selector = 0;
var mode = UO.GetStatLockState(selector);
UO.Print(Convert.ToString(mode));Parameters and execution flow:
- The threshold 95.1 and modes 0/1/2 are given as an example. −1 is checked before changing mode. After writing, only the local copy is read; it's not waiting for the server to respond.
return RunScenario();
object? RunScenario()
{
var mode = UO.GetStatLockState(0);
if (Truth(mode == 2))
{
UO.Print("Locked");
}
else
{
if (Truth(mode == -1))
{
UO.Print("Unknown selector");
}
else
{
UO.Print("Mode: " + Convert.ToString(mode));
}
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- All the helper code is given below Main. selector selects a skill/characteristic, mode sets the recording mode. ReadValue/ReadMode return the original number; ApplyMode checks the arguments, performs the action, and does not return a value. UO.Wait(1000) in the reading example separates two pictures.
return 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 = ReadMode(0);
await Delay(1000);
var after = ReadMode(0);
UO.Print(Convert.ToString(before) + " -> " + Convert.ToString(after));
return null;
}
dynamic ReadMode(dynamic selector)
{
return UO.GetStatLockState(selector);
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: statNum (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetStatLockState:bridge.GetStatLockState(Arg(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "getstatlockstate": return new InjectionValue(bridge.GetStatLockState(Arg(0)));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.GetStatus(object? id);Sends a server request for the status of the specified mobile.
-
id— Serial of the object or supported name of self/backpack/lasttarget/saved object; numeric strings and 0x strings are resolved by runtime.
void - no return value.
- string-form resolves name via GetObject; The int-form renders serial directly. Bridge calls GameActions.RequestMobileStatus(world,serial,true). The command does not return data and does not wait for a response. Read GetHP/GetMaxHP and other getters separately after the world update.
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.GetStatus");
UO.GetStatus("self");Parameters and execution flow:
- A status request is sent without waiting for a response.
UO.GetStatus("self");Parameters and execution flow:
- The int form sends the same request.
return RunScenario();
object? RunScenario()
{
var id = UO.Self();
UO.GetStatus(id);
return null;
}Parameters and execution flow:
- A pause does not guarantee a new answer; getters return the current local model.
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()
{
UO.GetStatus("self");
await Delay(500);
UO.Print(Convert.ToString(UO.GetHP()) + "/" + Convert.ToString(UO.GetMaxHP()));
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: id (Integer/String)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.GetStatus. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetStatus:bridge.GetStatus(id).
Internal implementation code; this is not a standalone script.
public void GetStatus(int id) => bridge.GetStatus(id);Parameters: id (Integer/String)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.GetStatus. -
InjectionScript.Runtime.InjectionApiUO.GetStatus:GetStatus(GetObject(id)). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(id).
Internal implementation code; this is not a standalone script.
public void GetStatus(string id) => GetStatus(GetObject(id));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetStr();
int UO.GetStr(object? objID);Reads the current power (Strength, Str) of the character.
-
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.Strength if Player exists and has not been destroyed; otherwise 0. A dead character present is not a removed object. The stat is not calculated from HP, mana, or stamina.
- GetStr/GetInt/GetDex accept ObjID. Data PlayerMobile is only available for self; for another serial - 0, even for loaded mobile. Someone else's characteristics are not substituted or guessed.
- Invoke reads on the game thread with the ability to cancel the wait by script. Does not query status, does not open target, does not send a packet, does not change the characteristic and does not add delay.
- Each call reads the local data anew. The variable stores the snapshot; individual reads may receive different server updates. A non-zero result does not test the connection. Zero can be a value or no data.
- C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
UO.Str(),UO.Strength(),UO.GetStr(),UO.GetStrength(). - 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.GetStr();
UO.Print("GetStr: " + 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.GetStr();
UO.Print("Strength: " + Convert.ToString(value));Parameters and execution flow:
- before and after separate 1000 ms; UO.Wait added to the example. change=after-before can be positive, zero or negative. By itself, it does not distinguish between all intermediate updates and exit from the world.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.GetStr();
await Delay(1000);
var after = UO.GetStr();
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.GetStr();
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.GetStr(id);
var byName = UO.GetStr("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 [GetStr]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Strength:bridge.Strength.
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
() => bridge.StrengthAPI creation: These functions register the API. They do not run again for every command call.
Parameters: objID (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetStrength:bridge.GetStrength(Arg(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Strength:bridge.Strength.
Internal implementation code; this is not a standalone script.
case "getstr": return new InjectionValue(arguments.Length > 0 ? bridge.GetStrength(Arg(0)) : bridge.Strength);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetStrength();Reads the current power (Strength, Str) of the character.
There are no parameters.
int — current stat points, 0..65535 in the client model; not percentage, ID, skill, lock mode or bool. 0 also means missing/deleted character or inaccessible object. Compare with the numerical requirement, not == true. This is not a stat cap or a guaranteed base value without modifiers.
- The command takes no arguments. Use the exact signatures above.
- Reads Player.Strength if Player exists and has not been destroyed; otherwise 0. A dead character present is not a removed object. The stat is not calculated from HP, mana, or stamina.
- GetStr/GetInt/GetDex accept ObjID. Data PlayerMobile is only available for self; for another serial - 0, even for loaded mobile. Someone else's characteristics are not substituted or guessed.
- Invoke reads on the game thread with the ability to cancel the wait by script. Does not query status, does not open target, does not send a packet, does not change the characteristic and does not add delay.
- Each call reads the local data anew. The variable stores the snapshot; individual reads may receive different server updates. A non-zero result does not test the connection. Zero can be a value or no data.
- C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
UO.Str(),UO.Strength(),UO.GetStr(),UO.GetStrength().
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.
var result = UO.GetStrength();
UO.Print("GetStrength: " + 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.GetStrength();
UO.Print("Strength: " + Convert.ToString(value));Parameters and execution flow:
- before and after separate 1000 ms; UO.Wait added to the example. change=after-before can be positive, zero or negative. By itself, it does not distinguish between all intermediate updates and exit from the world.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.GetStrength();
await Delay(1000);
var after = UO.GetStrength();
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.GetStrength();
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 [GetStrength]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Strength:bridge.Strength.
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
() => bridge.StrengthAPI creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.GetTitle(object? objID);Reads the character's title known to the client: for example, profession or signature after the name.
-
objID— Required serial/ID object, not type and not cliloc. Allows int, decimal/hex string, self, backpack, lasttarget, finditem or name AddObject. 0 means no object.
string — text of the Title field for Mobile. Empty string if title is unknown, the object is not a character, or ID is missing. It is not serial, a full name, or an array of properties. GetAltName uses the same field as GetTitle.
- The call itself reads local data, does not wait for the server and does not send a single click. To request a name/title, use ClickOnObject alone; the response comes asynchronously.
- An empty string is also acceptable for an existing character. The Exists check answers another question: whether the object is loaded.
- In this implementation, the alternate name is mapped to the character's Title field.
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.GetTitle("self");
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- ObjID=self — character of the current client.
- title contains only the title; an empty field does not mean a script error.
var title = UO.GetTitle("self");
UO.Print(title);Parameters and execution flow:
- ObjID=id — serial of the last target. GetName and title are read separately.
- The item target does not have a Title field and will give an empty string.
return RunScenario();
object? RunScenario()
{
var id = UO.GetSerial("lasttarget");
if (Truth(UO.Exists(id)))
{
var title = UO.GetTitle(id);
if (Truth(title != ""))
{
UO.Print(UO.GetName(id) + " " + title);
}
}
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:
- 350 — example of a pause in milliseconds after a single click; this is not a getter parameter.
- The server may respond later or may not transfer the title. Preserve handling of empty string.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var id = UO.GetSerial("lasttarget");
if (Truth(UO.Exists(id)))
{
UO.ClickOnObject(id);
UO.Wait(350);
UO.Print(UO.GetTitle(id));
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: objID (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetTitle:bridge.GetTitle(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 "gettitle": return new InjectionValue(bridge.GetTitle(Arg(0, bridge.Self)));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetWeight();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.GetWeight();
UO.Print("GetWeight: " + 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.GetWeight();
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.GetWeight();
await Delay(500);
var after = UO.GetWeight();
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.GetWeight();
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.Weight. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Weight:bridge.Weight.
Internal implementation code; this is not a standalone script.
public int Weight() => bridge.Weight;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetYellowBar(object? id);Checks the yellow health bar flag mobile.
-
id— Mandatory serial/ID of a specific object: int, hex-string or alias self, backpack, lasttarget, lastobject, lastcontainer, laststatus, finditem, lastcorpse or name AddObject. This is not a graphic/type. Unspecified name resolves to 0; the command does not open any new target. The argument is required; for yourself, pass self.
int 1 — the loaded mobile has the attribute IsYellowHits. int 0 - the attribute is missing, the object is not mobile, unknown or deleted. This is a server/compatible flag, not a theme color IDE or a quantity HP. The absence of a flag does not prove vulnerability: the server may indicate protection differently.
The result of the command is a numeric flag: 1 means a fulfilled condition, 0 means an unfulfilled one. After var result = command(...) check if (result != 0) or if (result == 0). Save the result of one call: a repeated call can perform the action again or read the state that has already changed.
- The local client model is read; There are no requests to the server, no waiting or moving.
- The result refers to the moment of reading. After UO.Wait or other action, the object and its flags may change.
- This is a server/compatible flag, not the theme color IDE or the quantity HP. The absence of a flag does not prove vulnerability: the server may indicate protection differently.
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.GetYellowBar("self");
UO.Print("GetYellowBar: " + Convert.ToString(result));Parameters and execution flow:
- The self argument explicitly selects its character. state - 1/0 only.
- This is a server/compatible flag, not the theme color IDE or the quantity HP. The absence of a flag does not prove vulnerability: the server may indicate protection differently.
var state = UO.GetYellowBar("self");
var hp = UO.GetHP("self");
UO.Print("Yellow flag: " + Convert.ToString(state));
UO.Print("Known HP: " + Convert.ToString(hp));Parameters and execution flow:
- IsNpc excludes subject and unknown object. target stores one serial, not a live link to a changing lasttarget.
- The result refers to the field IsYellowHits. The data is updated only after the client receives the appropriate state.
return RunScenario();
object? RunScenario()
{
var target = UO.GetSerial("lasttarget");
if (Truth(UO.IsNPC(target)))
{
var state = UO.GetYellowBar(target);
UO.Print("Selected mobile state 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:
- UO.Wait(500) — pause in milliseconds. After it, it is separately checked that mobile still exists.
- Two photographs are compared. Intermediate changes may be missed, and this is not a continuous subscription to server events.
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 target = UO.GetSerial("lasttarget");
if (Truth(UO.IsNPC(target)))
{
var before = UO.GetYellowBar(target);
await Delay(500);
if (Truth(UO.IsNPC(target)))
{
var after = UO.GetYellowBar(target);
if (Truth(before != after))
{
UO.Print("Flag changed: " + Convert.ToString(before) + " -> " + Convert.ToString(after));
}
}
else
{
UO.Print("Mobile left the local world");
}
}
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: id (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.GetYellowBar. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetYellowBar:bridge.GetYellowBar(GetObject(id)). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(id).
Internal implementation code; this is not a standalone script.
public int GetYellowBar(InjectionValue id) => bridge.GetYellowBar(GetObject(id));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.Gold();Reads the amount of gold from the current character's status.
There are no parameters.
int/double — non-negative sum 0..4294967295. Up to 2147483647 inclusive, an int is returned, above - a double (Double), exactly representing any 32-bit unsigned integer. 0 also means no current undeleted Player or amount received. It's not bool, ID, number of stacks, or knapsack/bank traversal.
- There are no parameters. Reads the Player.Gold cache from CharacterStatus (0x11). The server determines what gold is included in its counter; the team does not go through the bags or ask for bank balances. No/destroyed Player - 0; a ghost present can maintain a status amount.
- ReadGoldValue reads bridge.Gold once. The old C# bridge retains the Int32 signature and transmits UInt32 bits. unchecked conversion restores the unsigned sum; a small amount turns into int, a large amount into double. The most significant bit no longer turns the balance negative. The conversion is local, there are no packages.
- 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.
object? result = UO.Gold();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- amount stores one result; Convert.ToString formats it for journal. Gold is not sought, carried, or spent.
var amount = UO.Gold();
UO.Print("Status gold: " + Convert.ToString(amount));Parameters and execution flow:
- price=3000000000.0 is an example of price, not the limit. CanAfford(price) rejects a negative price or no Player, reads the amount once and returns bool: true or false if amount >= price. The amount itself is not bool. The function is fully defined below.
return RunScenario();
object? RunScenario()
{
var price = 3000000000.0;
if (Truth(Truth(CanAfford(price)) == true))
{
UO.Print("Local balance is sufficient");
}
else
{
UO.Print("Local check failed");
}
return null;
}
dynamic CanAfford(dynamic price)
{
if (Truth(price < 0) || Truth(UO.Self() == 0))
{
return false;
}
var amount = UO.Gold();
return amount >= price;
}
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:
- before/after separates UO.Wait(500) milliseconds. difference=after-before can be negative when the balance decreases; This is not a fixed unsigned counter overflow. Interim updates and character changes may be missed.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
async public Task<object?> RunScenarioAsync()
{
var before = UO.Gold();
await Delay(500);
var after = UO.Gold();
var difference = after - before;
UO.Print("Balance change: " + Convert.ToString(difference));
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ReadGoldValue:ReadGoldValue().
Internal implementation code; this is not a standalone script.
case "gold": return ReadGoldValue();Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.HP();Reads the current health from the local model.
There are no parameters.
int is the value of the Hits field, not a percentage or a bool. 0 can be a real value or an indication of missing data. Zero maximum cannot be used as a divisor. Someone else's mobile may have unknown meanings. HP/HitsMax may contain relative server scale instead of exact points. HP=0 does not prove death; That's what Dead/IsDead is for.
- The command does not open status and does not request a server update. The client only reads the already loaded data. Does not change characteristics and does not send packets.
- The result is a separate reading. The world can change between Exists and the next challenge; multiple queries do not form an atomic snapshot.
- When reading an object, World.Get rejects the missing or IsDestroyed and produces 0. HP/HitsMax are read from the Entity, including items with these fields; Mana/Stamina - only for Mobile. Without an argument, self is read. The variant of the same name without parameters does not necessarily have a variant with ID: see signatures.
- Reading without arguments also returns 0 for a missing or destroyed Player. This also applies to direct Mana/Stamina and their maximums, not just World.Get forms. A dead character present can retain values.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.
var result = UO.HP();
UO.Print("HP: " + Convert.ToString(result));Parameters and execution flow:
- The call without arguments reads self. value stores one number, Convert.ToString converts it for message only.
var value = UO.HP();
UO.Print("HP: " + Convert.ToString(value));Parameters and execution flow:
- The applied threshold or calculation for this field is shown. The numbers in the condition are example settings, not server limits. Before dividing by the maximum, its positivity is checked.
return RunScenario();
object? RunScenario()
{
var value = UO.HP();
var maximum = UO.GetMaxHP();
if (Truth(maximum > 0) && Truth(value * 100 / maximum < 50))
{
UO.Print("Health below half of the known maximum");
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- This name does not have a form with ID. ReadValue without parameters reads self; the two calls are separated by UO.Wait(1000). Comparing two snapshots may miss intermediate changes.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
async public Task<object?> RunScenarioAsync()
{
var before = ReadValue();
await Delay(1000);
var after = ReadValue();
UO.Print("Before: " + Convert.ToString(before) + "; after: " + Convert.ToString(after));
return null;
}
dynamic ReadValue()
{
return UO.HP();
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [HP]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetHP:bridge.GetHP(bridge.Self). -
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.
() => bridge.GetHP(bridge.Self)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.Hidden();
int UO.Hidden(object? id);Tests the character's stealth.
-
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 IsHidden, 0 has no flag or mobile is missing. This is a server flag, not visibility behind a wall.
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.Hidden();
UO.Print("Hidden: " + 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.Hidden();
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.Hidden(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.Hidden();
await Delay(500);
var after = UO.Hidden();
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.Hidden. -
InjectionScript.Runtime.InjectionApiUO.Hidden:Hidden("self").
Internal implementation code; this is not a standalone script.
public int Hidden() => Hidden("self");Parameters: id (Integer/String)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Hidden. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Hidden:bridge.Hidden(id).
Internal implementation code; this is not a standalone script.
public int Hidden(int id) => bridge.Hidden(id);Parameters: id (Integer/String)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Hidden. -
InjectionScript.Runtime.InjectionApiUO.Hidden:Hidden(GetObject(idText)). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(idText).
Internal implementation code; this is not a standalone script.
public int Hidden(string idText) => Hidden(GetObject(idText));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.Int();Reads the character's current Intelligence (INT).
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.Intelligence 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.Int(),UO.Intelligence(),UO.GetInt(),UO.GetIntelligence().
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.Int();
UO.Print("Int: " + 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.Int();
UO.Print("Intelligence: " + 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.Int();
await Delay(1000);
var after = UO.Int();
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.Int();
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.Intelligence:bridge.Intelligence.
Internal implementation code; this is not a standalone script.
case "int": return new InjectionValue(bridge.Intelligence);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.Intelligence();Reads the character's current Intelligence (INT).
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.Intelligence 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.Int(),UO.Intelligence(),UO.GetInt(),UO.GetIntelligence().
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.Intelligence();
UO.Print("Intelligence: " + 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.Intelligence();
UO.Print("Intelligence: " + 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.Intelligence();
await Delay(1000);
var after = UO.Intelligence();
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.Intelligence();
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 [Intelligence]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Intelligence:bridge.Intelligence.
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.IntelligenceAPI creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.IsAlive();
int UO.IsAlive(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.IsAlive();
UO.Print("IsAlive: " + 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.IsAlive();
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.IsAlive(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.IsAlive();
await Delay(500);
var after = UO.IsAlive();
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 [IsAlive]. -
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 [IsAlive]. -
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.IsDead();
dynamic UO.IsDead(object? objID);Checks character death.
-
objID— 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.IsDead();
UO.Print("IsDead: " + 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.IsDead();
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.IsDead(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.IsDead();
await Delay(500);
var after = UO.IsDead();
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 [IsDead]. -
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: objID (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.IsDead:bridge.IsDead(Arg(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Dead:bridge.Dead().
Internal implementation code; this is not a standalone script.
case "isdead": return new InjectionValue(arguments.Length > 0 ? bridge.IsDead(Arg(0)) : bridge.Dead());Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.IsFemale(object? objID);Checks the sign of female gender mobile.
-
objID— Mandatory serial/ID of a specific object: int, hex-string or alias self, backpack, lasttarget, lastobject, lastcontainer, laststatus, finditem, lastcorpse or name AddObject. This is not a graphic/type. Unspecified name resolves to 0; the command does not open any new target. The argument is required; for yourself, pass self.
int 1 — the loaded mobile has the attribute IsFemale. int 0 - the attribute is missing, the object is not mobile, unknown or deleted. Does not determine the race, name, age, or type of the object's owner.
The result of the command is a numeric flag: 1 means a fulfilled condition, 0 means an unfulfilled one. After var result = command(...) check if (result != 0) or if (result == 0). Save the result of one call: a repeated call can perform the action again or read the state that has already changed.
- The local client model is read; There are no requests to the server, no waiting or moving.
- The result refers to the moment of reading. After UO.Wait or other action, the object and its flags may change.
- Does not determine the race, name, age, or type of the object's owner.
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.IsFemale("self");
UO.Print("IsFemale: " + Convert.ToString(result));Parameters and execution flow:
- The self argument explicitly selects its character. state - 1/0 only.
- Does not determine the race, name, age, or type of the object's owner.
var state = UO.IsFemale("self");
if (Truth(state))
{
UO.Print("Female flag is set");
}
else
{
UO.Print("Female flag is not set");
}
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:
- IsNpc excludes subject and unknown object. target stores one serial, not a live link to a changing lasttarget.
- The result refers to the field IsFemale. The data is updated only after the client receives the appropriate state.
return RunScenario();
object? RunScenario()
{
var target = UO.GetSerial("lasttarget");
if (Truth(UO.IsNPC(target)))
{
var state = UO.IsFemale(target);
UO.Print("Selected mobile state 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:
- UO.Wait(500) — pause in milliseconds. After it, it is separately checked that mobile still exists.
- Two photographs are compared. Intermediate changes may be missed, and this is not a continuous subscription to server events.
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 target = UO.GetSerial("lasttarget");
if (Truth(UO.IsNPC(target)))
{
var before = UO.IsFemale(target);
await Delay(500);
if (Truth(UO.IsNPC(target)))
{
var after = UO.IsFemale(target);
if (Truth(before != after))
{
UO.Print("Flag changed: " + Convert.ToString(before) + " -> " + Convert.ToString(after));
}
}
else
{
UO.Print("Mobile left the local world");
}
}
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: objID (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.IsFemale:bridge.IsFemale(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 "isfemale": return new InjectionValue(bridge.IsFemale(Arg(0, bridge.Self)));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.IsFlying();
int UO.IsFlying(object? value);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.
-
value- 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.IsFlying();
UO.Print("IsFlying: " + 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.IsFlying();
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.IsFlying(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.IsFlying()))
{
return true;
}
UO.ToggleFly();
var waited = 0;
while (Truth(waited < timeoutMs))
{
if (!(Truth(UO.Connected())))
{
return false;
}
if (Truth(UO.IsFlying()))
{
return true;
}
await Delay(50);
waited += 50;
}
return UO.IsFlying();
}
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 [IsFlying]. -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Flying:bridge.Flying(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.Flying(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 [IsFlying]. -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Flying:bridge.Flying(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.Flying(serial)Internal implementation code; this is not a standalone script.
value => getter(GetObject(value))API creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.IsFrozen();
int UO.IsFrozen(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.IsFrozen();
UO.Print("IsFrozen: " + 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.IsFrozen();
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.IsFrozen(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.IsFrozen()) == true) && Truth(attempts < 10))
{
await Delay(100);
attempts = attempts + 1;
}
if (Truth(UO.IsNPC("self")))
{
if (Truth(Truth(UO.IsFrozen()) == 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 [IsFrozen]. -
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 [IsFrozen]. -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetLocked:bridge.GetLocked(serial). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(value).
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
serial => bridge.GetLocked(serial)Internal implementation code; this is not a standalone script.
value => getter(GetObject(value))API creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.IsHidden();
dynamic UO.IsHidden(object? objID);Tests the character's stealth.
-
objID— 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 IsHidden, 0 has no flag or mobile is missing. This is a server flag, not visibility behind a wall.
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.IsHidden();
UO.Print("IsHidden: " + 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.IsHidden();
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.IsHidden(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.IsHidden();
await Delay(500);
var after = UO.IsHidden();
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 [IsHidden]. -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Hidden:bridge.Hidden(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.Hidden(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: objID (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Hidden:bridge.Hidden(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 "ishidden": return new InjectionValue(bridge.Hidden(Arg(0, bridge.Self)));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.IsParalysed();
int UO.IsParalysed(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.IsParalysed();
UO.Print("IsParalysed: " + 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.IsParalysed();
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.IsParalysed(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.IsParalysed()) == true) && Truth(attempts < 10))
{
await Delay(100);
attempts = attempts + 1;
}
if (Truth(UO.IsNPC("self")))
{
if (Truth(Truth(UO.IsParalysed()) == 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 [IsParalysed]. -
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 [IsParalysed]. -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetLocked:bridge.GetLocked(serial). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(value).
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
serial => bridge.GetLocked(serial)Internal implementation code; this is not a standalone script.
value => getter(GetObject(value))API creation: These functions register the API. They do not run again for every command call.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.IsParalyzed();
int UO.IsParalyzed(object? objID);Checks the character's paralysis flag known to the client.
-
objID- 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.IsParalyzed();
UO.Print("IsParalyzed: " + 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.IsParalyzed();
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.IsParalyzed(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.IsParalyzed()) == true) && Truth(attempts < 10))
{
await Delay(100);
attempts = attempts + 1;
}
if (Truth(UO.IsNPC("self")))
{
if (Truth(Truth(UO.IsParalyzed()) == 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 [IsParalyzed]. -
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: objID (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetLocked:bridge.GetLocked(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 "isparalyzed": return new InjectionValue(bridge.GetLocked(Arg(0, bridge.Self)));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.IsPoisoned();
dynamic UO.IsPoisoned(object? objID);Checks the character's poisoning.
-
objID— Optional object in the forms shown: serial number/hex string, self, lasttarget, or registered name AddObject. This is not type. Without an argument, self is read. Unknown text in some forms causes a conversion error; check the name before calling.
Numeric flag int: 1 (condition met), 0 (condition not met). This is a numeric flag: in C# check result != 0 or result == 0. Direct comparison of int with true/false and if (result) is not allowed. 1 - mobile has IsPoisoned, 0 has no flag or mobile is missing. The degree of poison and the remaining time are not returned.
The result of the command is a numeric flag: 1 means a fulfilled condition, 0 means an unfulfilled one. After var result = command(...) check if (result != 0) or if (result == 0). Save the result of one call: a repeated call can perform the action again or read the state that has already changed.
- Reads the local model: does not open target, does not request status, does not change the flag, and does not send the packet. A destroyed object is considered missing even before the entry is deleted from the dictionary.
- The result is a separate reading. The world can change between Exists and the next challenge; multiple queries do not form an atomic snapshot.
- For Poisoned/Flying, the protocol version is taken into account: up to 7.0.0.0 bit 0x04 means poison; starting with 7.0.0.0 it means flight and the poison is stored separately. Flight is not calculated from Z.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.
var result = UO.IsPoisoned();
UO.Print("IsPoisoned: " + 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.IsPoisoned();
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.IsPoisoned(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.IsPoisoned();
await Delay(500);
var after = UO.IsPoisoned();
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 [IsPoisoned]. -
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Poisoned:bridge.Poisoned(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.Poisoned(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: objID (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Poisoned:bridge.Poisoned(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 "ispoisoned": return new InjectionValue(bridge.Poisoned(Arg(0, bridge.Self)));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.IsYellowHits(object? objID);Checks the yellow health bar flag mobile.
-
objID— Mandatory serial/ID of a specific object: int, hex-string or alias self, backpack, lasttarget, lastobject, lastcontainer, laststatus, finditem, lastcorpse or name AddObject. This is not a graphic/type. Unspecified name resolves to 0; the command does not open any new target. The argument is required; for yourself, pass self.
int 1 — the loaded mobile has the attribute IsYellowHits. int 0 - the attribute is missing, the object is not mobile, unknown or deleted. This is a server/compatible flag, not a theme color IDE or a quantity HP. The absence of a flag does not prove vulnerability: the server may indicate protection differently.
The result of the command is a numeric flag: 1 means a fulfilled condition, 0 means an unfulfilled one. After var result = command(...) check if (result != 0) or if (result == 0). Save the result of one call: a repeated call can perform the action again or read the state that has already changed.
- The local client model is read; There are no requests to the server, no waiting or moving.
- The result refers to the moment of reading. After UO.Wait or other action, the object and its flags may change.
- This is a server/compatible flag, not the theme color IDE or the quantity HP. The absence of a flag does not prove vulnerability: the server may indicate protection differently.
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.IsYellowHits("self");
UO.Print("IsYellowHits: " + Convert.ToString(result));Parameters and execution flow:
- The self argument explicitly selects its character. state - 1/0 only.
- This is a server/compatible flag, not the theme color IDE or the quantity HP. The absence of a flag does not prove vulnerability: the server may indicate protection differently.
var state = UO.IsYellowHits("self");
var hp = UO.GetHP("self");
UO.Print("Yellow flag: " + Convert.ToString(state));
UO.Print("Known HP: " + Convert.ToString(hp));Parameters and execution flow:
- IsNpc excludes subject and unknown object. target stores one serial, not a live link to a changing lasttarget.
- The result refers to the field IsYellowHits. The data is updated only after the client receives the appropriate state.
return RunScenario();
object? RunScenario()
{
var target = UO.GetSerial("lasttarget");
if (Truth(UO.IsNPC(target)))
{
var state = UO.IsYellowHits(target);
UO.Print("Selected mobile state 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:
- UO.Wait(500) — pause in milliseconds. After it, it is separately checked that mobile still exists.
- Two photographs are compared. Intermediate changes may be missed, and this is not a continuous subscription to server events.
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 target = UO.GetSerial("lasttarget");
if (Truth(UO.IsNPC(target)))
{
var before = UO.IsYellowHits(target);
await Delay(500);
if (Truth(UO.IsNPC(target)))
{
var after = UO.IsYellowHits(target);
if (Truth(before != after))
{
UO.Print("Flag changed: " + Convert.ToString(before) + " -> " + Convert.ToString(after));
}
}
else
{
UO.Print("Mobile left the local world");
}
}
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: objID (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetYellowBar:bridge.GetYellowBar(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 "isyellowhits": return new InjectionValue(bridge.GetYellowBar(Arg(0, bridge.Self)));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.LastStatus();Returns the serial of the last object for which the client accepted the status.
There are no parameters.
int is 32 bit serial, not type and not the logical result. 0: no accepted status yet or the world has been cleared. The most significant bit is retained; a negative number can also represent serial. Check != 0, not > 0 and not == true.
- No parameters. Reading does not send packets, open a window, or wait for a response. UO.GetStatus(id), RequestStats and UpdateObject only request data: sending does not change LastStatus.
- The accepted package 0x11 stores serial and client-known X/Y together in World for all scripts. An unknown/destroyed object and an incomplete base package do not replace the entry. Subsequent packages of other objects may replace it.
- X/Y is a snapshot of the Entity at the time of receipt, not the current position. For mobile these are world cells; for an item inside a container, this could be the coordinates of the contents. The status packet itself does not transmit X/Y. Moving/removing an object after reception does not change the image; World.Clear resets it. For the current coordinates of an existing object, use GetX/GetY.
- Individual calls do not form an atomic snapshot; the server can update the record between them. The equality serial does not prove a new answer specifically to your query. laststatus without parentheses is a live built-in value if the script has not overridden it with a variable; UO.LastStatus() is a registered function.
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.LastStatus();
UO.Print("LastStatus: " + Convert.ToString(result));Parameters and execution flow:
- The value is read once. For serial, HEX preserves convenient hexadecimal notation; for the coordinate Convert.ToString prints the number. The call does not select an object.
var value = UO.LastStatus();
UO.Print("Saved value: " + Hex(value));
string Hex(object? value) => Convert.ToInt64(value).ToString("X");Parameters and execution flow:
- subject - serial self. 500 - pause in milliseconds, chosen for example only. It does not guarantee an answer: the current record is shown, which could remain old or belong to another object.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var subject = UO.Self();
if (Truth(subject != 0))
{
UO.GetStatus(subject);
await Delay(500);
var value = UO.LastStatus();
UO.Print("Known value: " + Hex(value));
}
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
string Hex(object? value) => Convert.ToInt64(value).ToString("X");
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- expectedId - serial, saved in Main. The helper is fully defined below; -1 means that the selected entry no longer exists and is not the result of the command itself. Before/after checking reduces the risk of mixing objects, but does not guarantee atomicity when updating the same serial.
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 expectedId = UO.LastStatus();
if (Truth(expectedId != 0))
{
var value = ReadSavedStatus(expectedId);
UO.Print("Checked value: " + Convert.ToString(value));
}
return null;
}
dynamic ReadSavedStatus(dynamic expectedId)
{
if (Truth(expectedId == 0) || Truth(UO.LastStatus() != expectedId))
{
return -1;
}
var value = UO.LastStatus();
if (Truth(UO.LastStatus() != expectedId))
{
return -1;
}
return value;
}
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.LastStatus:bridge.LastStatus.
Internal implementation code; this is not a standalone script.
case "laststatus": return new InjectionValue(bridge.LastStatus);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.LastStatusX();Returns the stored X coordinate of the last accepted status object.
There are no parameters.
int is the saved X coordinate, not a status window pixel and not a bool. Before the first status or after clearing the world - 0; the coordinate 0 itself is also admissible. Check UO.LastStatus() to distinguish between missing entries.
- No parameters. Reading does not send packets, open a window, or wait for a response. UO.GetStatus(id), RequestStats and UpdateObject only request data: sending does not change LastStatus.
- The accepted package 0x11 stores serial and client-known X/Y together in World for all scripts. An unknown/destroyed object and an incomplete base package do not replace the entry. Subsequent packages of other objects may replace it.
- X/Y is a snapshot of the Entity at the time of receipt, not the current position. For mobile these are world cells; for an item inside a container, this could be the coordinates of the contents. The status packet itself does not transmit X/Y. Moving/removing an object after reception does not change the image; World.Clear resets it. For the current coordinates of an existing object, use GetX/GetY.
- Individual calls do not form an atomic snapshot; the server can update the record between them. The equality serial does not prove a new answer specifically to your query. laststatus without parentheses is a live built-in value if the script has not overridden it with a variable; UO.LastStatus() is a registered function.
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.LastStatusX();
UO.Print("LastStatusX: " + Convert.ToString(result));Parameters and execution flow:
- The value is read once. For serial, HEX preserves convenient hexadecimal notation; for the coordinate Convert.ToString prints the number. The call does not select an object.
var value = UO.LastStatusX();
UO.Print("Saved value: " + Convert.ToString(value));Parameters and execution flow:
- subject - serial self. 500 - pause in milliseconds, chosen for example only. It does not guarantee an answer: the current record is shown, which could remain old or belong to another object.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var subject = UO.Self();
if (Truth(subject != 0))
{
UO.GetStatus(subject);
await Delay(500);
var value = UO.LastStatusX();
UO.Print("Known value: " + Convert.ToString(value));
}
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:
- expectedId - serial, saved in Main. The helper is fully defined below; -1 means that the selected entry no longer exists and is not the result of the command itself. Before/after checking reduces the risk of mixing objects, but does not guarantee atomicity when updating the same serial.
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 expectedId = UO.LastStatus();
if (Truth(expectedId != 0))
{
var value = ReadSavedStatus(expectedId);
UO.Print("Checked value: " + Convert.ToString(value));
}
return null;
}
dynamic ReadSavedStatus(dynamic expectedId)
{
if (Truth(expectedId == 0) || Truth(UO.LastStatus() != expectedId))
{
return -1;
}
var value = UO.LastStatusX();
if (Truth(UO.LastStatus() != expectedId))
{
return -1;
}
return value;
}
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.LastStatusX. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetX:bridge.GetX(bridge.LastStatus). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.LastStatus:bridge.LastStatus.
Internal implementation code; this is not a standalone script.
public int LastStatusX() => bridge is IStatusSnapshotBridge snapshot ? snapshot.LastStatusX : bridge.GetX(bridge.LastStatus);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.LastStatusY();Returns the stored Y coordinate of the last accepted status object.
There are no parameters.
int is the saved Y coordinate, not a status window pixel and not a bool. Before the first status or after clearing the world - 0; the coordinate 0 itself is also admissible. Check UO.LastStatus() to distinguish between missing entries.
- No parameters. Reading does not send packets, open a window, or wait for a response. UO.GetStatus(id), RequestStats and UpdateObject only request data: sending does not change LastStatus.
- The accepted package 0x11 stores serial and client-known X/Y together in World for all scripts. An unknown/destroyed object and an incomplete base package do not replace the entry. Subsequent packages of other objects may replace it.
- X/Y is a snapshot of the Entity at the time of receipt, not the current position. For mobile these are world cells; for an item inside a container, this could be the coordinates of the contents. The status packet itself does not transmit X/Y. Moving/removing an object after reception does not change the image; World.Clear resets it. For the current coordinates of an existing object, use GetX/GetY.
- Individual calls do not form an atomic snapshot; the server can update the record between them. The equality serial does not prove a new answer specifically to your query. laststatus without parentheses is a live built-in value if the script has not overridden it with a variable; UO.LastStatus() is a registered function.
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.LastStatusY();
UO.Print("LastStatusY: " + Convert.ToString(result));Parameters and execution flow:
- The value is read once. For serial, HEX preserves convenient hexadecimal notation; for the coordinate Convert.ToString prints the number. The call does not select an object.
var value = UO.LastStatusY();
UO.Print("Saved value: " + Convert.ToString(value));Parameters and execution flow:
- subject - serial self. 500 - pause in milliseconds, chosen for example only. It does not guarantee an answer: the current record is shown, which could remain old or belong to another object.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var subject = UO.Self();
if (Truth(subject != 0))
{
UO.GetStatus(subject);
await Delay(500);
var value = UO.LastStatusY();
UO.Print("Known value: " + Convert.ToString(value));
}
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:
- expectedId - serial, saved in Main. The helper is fully defined below; -1 means that the selected entry no longer exists and is not the result of the command itself. Before/after checking reduces the risk of mixing objects, but does not guarantee atomicity when updating the same serial.
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 expectedId = UO.LastStatus();
if (Truth(expectedId != 0))
{
var value = ReadSavedStatus(expectedId);
UO.Print("Checked value: " + Convert.ToString(value));
}
return null;
}
dynamic ReadSavedStatus(dynamic expectedId)
{
if (Truth(expectedId == 0) || Truth(UO.LastStatus() != expectedId))
{
return -1;
}
var value = UO.LastStatusY();
if (Truth(UO.LastStatus() != expectedId))
{
return -1;
}
return value;
}
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.LastStatusY. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetY:bridge.GetY(bridge.LastStatus). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.LastStatus:bridge.LastStatus.
Internal implementation code; this is not a standalone script.
public int LastStatusY() => bridge is IStatusSnapshotBridge snapshot ? snapshot.LastStatusY : bridge.GetY(bridge.LastStatus);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.Life();Reads the current health from the local model.
There are no parameters.
int is the value of the Hits field, not a percentage or a bool. 0 can be a real value or an indication of missing data. Zero maximum cannot be used as a divisor. Someone else's mobile may have unknown meanings. HP/HitsMax may contain relative server scale instead of exact points. HP=0 does not prove death; That's what Dead/IsDead is for.
- The command does not open status and does not request a server update. The client only reads the already loaded data. Does not change characteristics and does not send packets.
- The result is a separate reading. The world can change between Exists and the next challenge; multiple queries do not form an atomic snapshot.
- When reading an object, World.Get rejects the missing or IsDestroyed and produces 0. HP/HitsMax are read from the Entity, including items with these fields; Mana/Stamina - only for Mobile. Without an argument, self is read. The variant of the same name without parameters does not necessarily have a variant with ID: see signatures.
- Reading without arguments also returns 0 for a missing or destroyed Player. This also applies to direct Mana/Stamina and their maximums, not just World.Get forms. A dead character present can retain values.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.
object? result = UO.Life();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- The call without arguments reads self. value stores one number, Convert.ToString converts it for message only.
var value = UO.Life();
UO.Print("Life: " + Convert.ToString(value));Parameters and execution flow:
- The applied threshold or calculation for this field is shown. The numbers in the condition are example settings, not server limits. Before dividing by the maximum, its positivity is checked.
return RunScenario();
object? RunScenario()
{
var value = UO.Life();
var maximum = UO.GetMaxHP();
if (Truth(maximum > 0) && Truth(value * 100 / maximum < 50))
{
UO.Print("Health below half of the known maximum");
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- This name does not have a form with ID. ReadValue without parameters reads self; the two calls are separated by UO.Wait(1000). Comparing two snapshots may miss intermediate changes.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
async public Task<object?> RunScenarioAsync()
{
var before = ReadValue();
await Delay(1000);
var after = ReadValue();
UO.Print("Before: " + Convert.ToString(before) + "; after: " + Convert.ToString(after));
return null;
}
dynamic ReadValue()
{
return UO.Life();
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetHP:bridge.GetHP(bridge.Self). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
Internal implementation code; this is not a standalone script.
case "life": return new InjectionValue(bridge.GetHP(bridge.Self));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.Luck();Reads your character's status counter: luck points.
There are no parameters.
int — luck points, 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.Luck 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.
- Luck reads server luck points stored as UInt16 from status type >= 4. This is not a percentage, a random number, or a guarantee of the quality of the loot. When reading, the client does not calculate the drop rate and does not add equipment bonuses.
- 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.Luck();
UO.Print("Luck: " + 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.Luck();
UO.Print("Luck: " + 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.Luck();
await Delay(500);
var after = UO.Luck();
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:
- LuckAtLeast(minimum) receives a numeric requirement; 1000 is an example, not a limit or percentage. Rejects the absence of a Player, reads luck once and returns bool: true or false by value >= minimum. Luck itself is not bool. Cached points are compared and loot drops are not predicted.
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(LuckAtLeast(1000)) == true))
{
UO.Print("Local check passed");
}
else
{
UO.Print("Local check failed or data unavailable");
}
return null;
}
dynamic LuckAtLeast(dynamic minimum)
{
if (Truth(UO.Self() == 0))
{
return false;
}
var value = UO.Luck();
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.Luck:bridge.Luck.
Internal implementation code; this is not a standalone script.
case "luck": return new InjectionValue(bridge.Luck);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.Mana();Reads the current mana from the local model.
There are no parameters.
int is the value of the Mana field, not a percentage or a bool. 0 can be a real value or an indication of missing data. Zero maximum cannot be used as a divisor. Someone else's mobile may have unknown meanings. HP/HitsMax may contain relative server scale instead of exact points. HP=0 does not prove death; That's what Dead/IsDead is for.
- The command does not open status and does not request a server update. The client only reads the already loaded data. Does not change characteristics and does not send packets.
- The result is a separate reading. The world can change between Exists and the next challenge; multiple queries do not form an atomic snapshot.
- When reading an object, World.Get rejects the missing or IsDestroyed and produces 0. HP/HitsMax are read from the Entity, including items with these fields; Mana/Stamina - only for Mobile. Without an argument, self is read. The variant of the same name without parameters does not necessarily have a variant with ID: see signatures.
- Reading without arguments also returns 0 for a missing or destroyed Player. This also applies to direct Mana/Stamina and their maximums, not just World.Get forms. A dead character present can retain values.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.
object? result = UO.Mana();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- The call without arguments reads self. value stores one number, Convert.ToString converts it for message only.
var value = UO.Mana();
UO.Print("Mana: " + Convert.ToString(value));Parameters and execution flow:
- The applied threshold or calculation for this field is shown. The numbers in the condition are example settings, not server limits. Before dividing by the maximum, its positivity is checked.
return RunScenario();
object? RunScenario()
{
var value = UO.Mana();
if (Truth(value >= 10))
{
UO.Print("At least ten mana points are known");
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- This name does not have a form with ID. ReadValue without parameters reads self; the two calls are separated by UO.Wait(1000). Comparing two snapshots may miss intermediate changes.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
async public Task<object?> RunScenarioAsync()
{
var before = ReadValue();
await Delay(1000);
var after = ReadValue();
UO.Print("Before: " + Convert.ToString(before) + "; after: " + Convert.ToString(after));
return null;
}
dynamic ReadValue()
{
return UO.Mana();
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Mana:bridge.Mana.
Internal implementation code; this is not a standalone script.
case "mana": return new InjectionValue(bridge.Mana);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.MaxHP();Reads maximum health from the local model.
There are no parameters.
int is the value of the HitsMax field, not a percentage or a bool. 0 can be a true value or an indication of missing data. Zero maximum cannot be used as a divisor. Someone else's mobile may have unknown meanings. HP/HitsMax may contain relative server scale instead of exact points. HP=0 does not prove death; That's what Dead/IsDead is for.
- The command does not open status and does not request a server update. The client only reads the already loaded data. Does not change characteristics and does not send packets.
- The result is a separate reading. The world can change between Exists and the next challenge; multiple queries do not form an atomic snapshot.
- When reading an object, World.Get rejects the missing or IsDestroyed and produces 0. HP/HitsMax are read from the Entity, including items with these fields; Mana/Stamina - only for Mobile. Without an argument, self is read. The variant of the same name without parameters does not necessarily have a variant with ID: see signatures.
- Reading without arguments also returns 0 for a missing or destroyed Player. This also applies to direct Mana/Stamina and their maximums, not just World.Get forms. A dead character present can retain values.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.
var result = UO.MaxHP();
UO.Print("MaxHP: " + Convert.ToString(result));Parameters and execution flow:
- The call without arguments reads self. value stores one number, Convert.ToString converts it for message only.
var value = UO.MaxHP();
UO.Print("MaxHP: " + Convert.ToString(value));Parameters and execution flow:
- The applied threshold or calculation for this field is shown. The numbers in the condition are example settings, not server limits. Before dividing by the maximum, its positivity is checked.
return RunScenario();
object? RunScenario()
{
var value = UO.MaxHP();
if (Truth(value > 0))
{
UO.Print("Known HP percent: " + Convert.ToString(UO.GetHP() * 100 / value));
}
else
{
UO.Print("HP maximum unavailable");
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- This name does not have a form with ID. ReadValue without parameters reads self; the two calls are separated by UO.Wait(1000). Comparing two snapshots may miss intermediate changes.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
async public Task<object?> RunScenarioAsync()
{
var before = ReadValue();
await Delay(1000);
var after = ReadValue();
UO.Print("Before: " + Convert.ToString(before) + "; after: " + Convert.ToString(after));
return null;
}
dynamic ReadValue()
{
return UO.MaxHP();
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.RegisterCharacterGetterAliases [MaxHP]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetMaxHP:bridge.GetMaxHP(bridge.Self). -
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.
() => bridge.GetMaxHP(bridge.Self)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.MaxLife();Reads maximum health from the local model.
There are no parameters.
int is the value of the HitsMax field, not a percentage or a bool. 0 can be a true value or an indication of missing data. Zero maximum cannot be used as a divisor. Someone else's mobile may have unknown meanings. HP/HitsMax may contain relative server scale instead of exact points. HP=0 does not prove death; That's what Dead/IsDead is for.
- The command does not open status and does not request a server update. The client only reads the already loaded data. Does not change characteristics and does not send packets.
- The result is a separate reading. The world can change between Exists and the next challenge; multiple queries do not form an atomic snapshot.
- When reading an object, World.Get rejects the missing or IsDestroyed and produces 0. HP/HitsMax are read from the Entity, including items with these fields; Mana/Stamina - only for Mobile. Without an argument, self is read. The variant of the same name without parameters does not necessarily have a variant with ID: see signatures.
- Reading without arguments also returns 0 for a missing or destroyed Player. This also applies to direct Mana/Stamina and their maximums, not just World.Get forms. A dead character present can retain values.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.
object? result = UO.MaxLife();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- The call without arguments reads self. value stores one number, Convert.ToString converts it for message only.
var value = UO.MaxLife();
UO.Print("MaxLife: " + Convert.ToString(value));Parameters and execution flow:
- The applied threshold or calculation for this field is shown. The numbers in the condition are example settings, not server limits. Before dividing by the maximum, its positivity is checked.
return RunScenario();
object? RunScenario()
{
var value = UO.MaxLife();
if (Truth(value > 0))
{
UO.Print("Known HP percent: " + Convert.ToString(UO.GetHP() * 100 / value));
}
else
{
UO.Print("HP maximum unavailable");
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- This name does not have a form with ID. ReadValue without parameters reads self; the two calls are separated by UO.Wait(1000). Comparing two snapshots may miss intermediate changes.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
async public Task<object?> RunScenarioAsync()
{
var before = ReadValue();
await Delay(1000);
var after = ReadValue();
UO.Print("Before: " + Convert.ToString(before) + "; after: " + Convert.ToString(after));
return null;
}
dynamic ReadValue()
{
return UO.MaxLife();
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetMaxHP:bridge.GetMaxHP(bridge.Self). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Self:bridge.Self.
Internal implementation code; this is not a standalone script.
case "maxlife": return new InjectionValue(bridge.GetMaxHP(bridge.Self));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.MaxMana();Reads maximum mana from the local model.
There are no parameters.
int is the value of the ManaMax field, not a percentage or a bool. 0 can be a true value or an indication of missing data. Zero maximum cannot be used as a divisor. Someone else's mobile may have unknown meanings. HP/HitsMax may contain relative server scale instead of exact points. HP=0 does not prove death; That's what Dead/IsDead is for.
- The command does not open status and does not request a server update. The client only reads the already loaded data. Does not change characteristics and does not send packets.
- The result is a separate reading. The world can change between Exists and the next challenge; multiple queries do not form an atomic snapshot.
- When reading an object, World.Get rejects the missing or IsDestroyed and produces 0. HP/HitsMax are read from the Entity, including items with these fields; Mana/Stamina - only for Mobile. Without an argument, self is read. The variant of the same name without parameters does not necessarily have a variant with ID: see signatures.
- Reading without arguments also returns 0 for a missing or destroyed Player. This also applies to direct Mana/Stamina and their maximums, not just World.Get forms. A dead character present can retain values.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.
object? result = UO.MaxMana();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- The call without arguments reads self. value stores one number, Convert.ToString converts it for message only.
var value = UO.MaxMana();
UO.Print("MaxMana: " + Convert.ToString(value));Parameters and execution flow:
- The applied threshold or calculation for this field is shown. The numbers in the condition are example settings, not server limits. Before dividing by the maximum, its positivity is checked.
return RunScenario();
object? RunScenario()
{
var value = UO.MaxMana();
if (Truth(value > 0))
{
UO.Print("Mana percent: " + Convert.ToString(UO.Mana() * 100 / value));
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- This name does not have a form with ID. ReadValue without parameters reads self; the two calls are separated by UO.Wait(1000). Comparing two snapshots may miss intermediate changes.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
async public Task<object?> RunScenarioAsync()
{
var before = ReadValue();
await Delay(1000);
var after = ReadValue();
UO.Print("Before: " + Convert.ToString(before) + "; after: " + Convert.ToString(after));
return null;
}
dynamic ReadValue()
{
return UO.MaxMana();
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.MaxMana:bridge.MaxMana.
Internal implementation code; this is not a standalone script.
case "maxmana": return new InjectionValue(bridge.MaxMana);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.MaxStam();Reads the maximum endurance from the local model.
There are no parameters.
int is the value of the StaminaMax field, not a percentage or a bool. 0 can be a true value or an indication of missing data. Zero maximum cannot be used as a divisor. Someone else's mobile may have unknown meanings. HP/HitsMax may contain relative server scale instead of exact points. HP=0 does not prove death; That's what Dead/IsDead is for.
- The command does not open status and does not request a server update. The client only reads the already loaded data. Does not change characteristics and does not send packets.
- The result is a separate reading. The world can change between Exists and the next challenge; multiple queries do not form an atomic snapshot.
- When reading an object, World.Get rejects the missing or IsDestroyed and produces 0. HP/HitsMax are read from the Entity, including items with these fields; Mana/Stamina - only for Mobile. Without an argument, self is read. The variant of the same name without parameters does not necessarily have a variant with ID: see signatures.
- Reading without arguments also returns 0 for a missing or destroyed Player. This also applies to direct Mana/Stamina and their maximums, not just World.Get forms. A dead character present can retain values.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.
object? result = UO.MaxStam();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- The call without arguments reads self. value stores one number, Convert.ToString converts it for message only.
var value = UO.MaxStam();
UO.Print("MaxStam: " + Convert.ToString(value));Parameters and execution flow:
- The applied threshold or calculation for this field is shown. The numbers in the condition are example settings, not server limits. Before dividing by the maximum, its positivity is checked.
return RunScenario();
object? RunScenario()
{
var value = UO.MaxStam();
if (Truth(value > 0))
{
UO.Print("Stamina percent: " + Convert.ToString(UO.Stamina() * 100 / value));
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- This name does not have a form with ID. ReadValue without parameters reads self; the two calls are separated by UO.Wait(1000). Comparing two snapshots may miss intermediate changes.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
async public Task<object?> RunScenarioAsync()
{
var before = ReadValue();
await Delay(1000);
var after = ReadValue();
UO.Print("Before: " + Convert.ToString(before) + "; after: " + Convert.ToString(after));
return null;
}
dynamic ReadValue()
{
return UO.MaxStam();
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.MaxStamina:bridge.MaxStamina.
Internal implementation code; this is not a standalone script.
case "maxstam": return new InjectionValue(bridge.MaxStamina);ClassicUO — Bad Newbie & C# Scripts IDE