EN UO Topic world geometry Part 2 - LIHACHTETAN/ClassicUO-Bad-Newbie-CSharp-Scripts-IDE GitHub Wiki
Українська · Русский · 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.GetZ();
int UO.GetZ(object? id);Reads the Z field of the loaded object or current character.
-
id— Serial/ID of the object, not the graphic/type. A number, a hex string, the standard name self/backpack/lasttarget/lastobject/lastcontainer/laststatus/finditem/lastcorpse, or the name AddObject. The alias must be set; existence is checked by Exists. The registered form without arguments uses self.
int is the height of Z. For an unknown object, 0 is returned. Zero is also a valid coordinate. Height can be negative; This is not an equipment layer or a static index.
- The latest data already known to the client is read; the update request is not sent to the server.
- An unknown object and a property that has not yet been retrieved can have a null/empty value. Check Exists and conditions for a specific action.
- For a character or object on the ground, this is the world coordinate. The item inside the container has an X/Y position inside the gump; the command does not translate them into the owner's world coordinates.
- The current coordinate of the object is read. Pending steps are not converted into route calculations by this command.
int z = UO.GetZ();
UO.Print($"Z = {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.GetZ();
UO.Print("GetZ: " + Convert.ToString(result));Parameters and execution flow:
- The form without an argument selects self, the current character.
- position contains the Z height, not serial.
var position = UO.GetZ();
UO.Print("Z: " + Convert.ToString(position));Parameters and execution flow:
- lasttarget should point to the loaded character or item on the ground.
- delta — difference along one axis. It is not the length of the route; the value may be negative.
return RunScenario();
object? RunScenario()
{
var other = UO.GetSerial("lasttarget");
if (Truth(UO.Exists(other)))
{
var delta = UO.GetZ(other) - UO.GetZ();
UO.Print("Difference: " + Convert.ToString(delta));
}
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:
- id="self" is an explicit form of character selection. UO.Wait=500 milliseconds.
- The comparison shows the change in the Z axis only. Changes in the other axis or rotation are not taken into account here.
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.GetZ("self");
await Delay(500);
var after = UO.GetZ("self");
if (Truth(before != after))
{
UO.Print("Coordinate changed");
}
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.GetZ. -
InjectionScript.Runtime.InjectionApiUO.GetZ:GetZ("self").
Internal implementation code; this is not a standalone script.
public int GetZ() => GetZ("self");Parameters: id (Any/Integer/String)
Result: int / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetZ:bridge.GetZ(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 "getz": return new InjectionValue(bridge.GetZ(Arg(0, bridge.Self)));Parameters: id (Any/Integer/String)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.GetZ. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetZ:bridge.GetZ(id).
Internal implementation code; this is not a standalone script.
public int GetZ(int id) => bridge.GetZ(id);Parameters: id (Any/Integer/String)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.GetZ. -
InjectionScript.Runtime.InjectionApiUO.GetZ:GetZ(GetObject(id)). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(id).
Internal implementation code; this is not a standalone script.
public int GetZ(string id) => GetZ(GetObject(id));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.IsMineTile(object? x, object? y);Checks the characteristics of a cell against local map data.
-
x— int X cells of the current card; world coordinate, not a screen pixel. -
y— int Y cells of the current card; world coordinate, not a screen pixel.
Numeric flag int: 1 — an object matching the condition was found; 0 - there is no such object or the cell/card is inaccessible.
- AnyTileAt bypasses the TNext chain of the loaded cell. Condition IsMineTile: Static/Multi with StaticFilters.IsRock or a name containing cave, mountain or rock, case insensitive.
- The check describes local tiledata/filters. It does not promise the availability of a mined resource, cross-country ability, range or server permission for mining.
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.IsMineTile(UO.GetX(), UO.GetY());
UO.Print("IsMineTile: " + Convert.ToString(result));Parameters and execution flow:
- Checks the characteristics of a cell against local map data.
UO.Print(UO.IsMineTile(UO.GetX(), UO.GetY()));Parameters and execution flow:
- AnyTileAt bypasses the TNext chain of the loaded cell. Condition IsMineTile: Static/Multi with StaticFilters.IsRock or a name containing cave, mountain or rock, case insensitive.
return RunScenario();
object? RunScenario()
{
var x = UO.GetX() + 1;
var y = UO.GetY();
if (Truth(UO.IsMineTile(x, y)))
{
UO.Print("Local tile predicate matched");
}
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:
- The check describes local tiledata/filters. It does not promise the availability of a mined resource, cross-country ability, range or server permission for mining.
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 x = UO.GetX();
var y = UO.GetY();
var before = UO.IsMineTile(x, y);
UO.Wait(500);
UO.Print(before = UO.IsMineTile(x, y));
return null;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: x (Any), y (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.IsMineTile. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.IsMineTile:bridge.IsMineTile(NumberConversions.ToInt(x), NumberConversions.ToInt(y)). -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(x).
Internal implementation code; this is not a standalone script.
public int IsMineTile(InjectionValue x, InjectionValue y) => bridge.IsMineTile(NumberConversions.ToInt(x), NumberConversions.ToInt(y));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.IsTreeTile(object? x, object? y);Checks the characteristics of a cell against local map data.
-
x— int X cells of the current card; world coordinate, not a screen pixel. -
y— int Y cells of the current card; world coordinate, not a screen pixel.
Numeric flag int: 1 — an object matching the condition was found; 0 - there is no such object or the cell/card is inaccessible.
- AnyTileAt bypasses the TNext chain of the loaded cell. Condition IsTreeTile: Static/Multi recognized by StaticFilters.IsTree.
- The check describes local tiledata/filters. It does not promise the availability of a mined resource, cross-country ability, range or server permission for mining.
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.IsTreeTile(UO.GetX(), UO.GetY());
UO.Print("IsTreeTile: " + Convert.ToString(result));Parameters and execution flow:
- Checks the characteristics of a cell against local map data.
UO.Print(UO.IsTreeTile(UO.GetX(), UO.GetY()));Parameters and execution flow:
- AnyTileAt bypasses the TNext chain of the loaded cell. Condition IsTreeTile: Static/Multi recognized by StaticFilters.IsTree.
return RunScenario();
object? RunScenario()
{
var x = UO.GetX() + 1;
var y = UO.GetY();
if (Truth(UO.IsTreeTile(x, y)))
{
UO.Print("Local tile predicate matched");
}
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:
- The check describes local tiledata/filters. It does not promise the availability of a mined resource, cross-country ability, range or server permission for mining.
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 x = UO.GetX();
var y = UO.GetY();
var before = UO.IsTreeTile(x, y);
UO.Wait(500);
UO.Print(before = UO.IsTreeTile(x, y));
return null;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: x (Any), y (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.IsTreeTile. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.IsTreeTile:bridge.IsTreeTile(NumberConversions.ToInt(x), NumberConversions.ToInt(y)). -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(x).
Internal implementation code; this is not a standalone script.
public int IsTreeTile(InjectionValue x, InjectionValue y) => bridge.IsTreeTile(NumberConversions.ToInt(x), NumberConversions.ToInt(y));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.IsWaterTile(object? x, object? y);Checks the characteristics of a cell against local map data.
-
x— int X cells of the current card; world coordinate, not a screen pixel. -
y— int Y cells of the current card; world coordinate, not a screen pixel.
Numeric flag int: 1 — an object matching the condition was found; 0 - there is no such object or the cell/card is inaccessible.
- AnyTileAt bypasses the TNext chain of the loaded cell. Condition IsWaterTile: Land with TileData.IsWet or an object with a valid static graphic and flag IsWet.
- The check describes local tiledata/filters. It does not promise the availability of a mined resource, cross-country ability, range or server permission for mining.
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.IsWaterTile(UO.GetX(), UO.GetY());
UO.Print("IsWaterTile: " + Convert.ToString(result));Parameters and execution flow:
- Checks the characteristics of a cell against local map data.
UO.Print(UO.IsWaterTile(UO.GetX(), UO.GetY()));Parameters and execution flow:
- AnyTileAt bypasses the TNext chain of the loaded cell. Condition IsWaterTile: Land with TileData.IsWet or an object with a valid static graphic and flag IsWet.
return RunScenario();
object? RunScenario()
{
var x = UO.GetX() + 1;
var y = UO.GetY();
if (Truth(UO.IsWaterTile(x, y)))
{
UO.Print("Local tile predicate matched");
}
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:
- The check describes local tiledata/filters. It does not promise the availability of a mined resource, cross-country ability, range or server permission for mining.
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 x = UO.GetX();
var y = UO.GetY();
var before = UO.IsWaterTile(x, y);
UO.Wait(500);
UO.Print(before = UO.IsWaterTile(x, y));
return null;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: x (Any), y (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.IsWaterTile. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.IsWaterTile:bridge.IsWaterTile(NumberConversions.ToInt(x), NumberConversions.ToInt(y)). -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(x).
Internal implementation code; this is not a standalone script.
public int IsWaterTile(InjectionValue x, InjectionValue y) => bridge.IsWaterTile(NumberConversions.ToInt(x), NumberConversions.ToInt(y));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.IsWorldCellPassable(object? currX, object? currY, object? currZ, object? destX, object? destY, object? destZ, object? worldNum);Checks one transition to an adjacent world cell and returns the passable flag along with the height.
-
currX— Mandatory world X coordinate of the source cell. Integer 0..65535 within the loaded map; this is not a gump coordinate. -
currY— Mandatory world Y coordinate of the source cell. Integer 0..65535 within the loaded map; this is not a gump coordinate. -
currZ— Mandatory initial height −128..127. This is the height of the world, not the floor number. Invalid height is rejected and not trimmed. -
destX— Mandatory world X coordinate of the target cell. Integer 0..65535 within the loaded map; this is not a gump coordinate. -
destY— Mandatory world Y coordinate of the target cell. Integer 0..65535 within the loaded map; this is not a gump coordinate. -
destZ— Mandatory input spare Z, usually CurrZ. This is not a var: the variable does not change and does not set the required floor. Read the calculated height from the result [1]. This bridge always returns its height; the argument is needed for compatibility with the Pascal form. -
worldNum— Mandatory map number: UO.WorldNum(). Only the current map with known dimensions is checked; The other map won't load.
Array of two int: [0] - passability, 1 (condition met), 0 (condition not met); [1] - calculated Z. Only the first element is logical. The array itself cannot be compared to true. Height 0/negative is acceptable; for [0]=0 the height does not prove reachability. Rejecting arguments returns [0, CurrZ].
- No movement, doors opening, crosshairs or network packets. The existing local geometry is read; the server may later reject the step. Two requests may see different states.
- The adjacent cell is accepted (the X/Y difference is no more than 1). A more distant target, going beyond the map, absence of a character/card and IsDestroyed give a refusal before calculation. For a complete route, use GetPathArray or NewMoveXY.
- The same valid X/Y gives [1, CurrZ] without collision checking: no step needed. This is not a test of the ability to escape from the cage. The character's condition and current Pathfinder rules affect the adjacent step; without loaded geometry it may be rejected.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The 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.IsWorldCellPassable(UO.GetX(), UO.GetY(), UO.GetZ(), UO.GetX() + 1, UO.GetY(), UO.GetZ(), UO.WorldNum());
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- x/y/z is the starting position, x+1/y is the adjacent cell, the sixth parameter z is the spare Z, the last one is the current card. result[0] is checked before using result[1].
var x = UO.GetX();
var y = UO.GetY();
var z = UO.GetZ();
var result = UO.IsWorldCellPassable(x,y,z,x+1,y,z,UO.WorldNum());
if (Truth(Truth(result[0]) == true))
{
UO.Print("Passable, Z=" + Convert.ToString(result[1]));
}
else
{
UO.Print("Blocked");
}
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:
- proposedZ remains 0 after calling. targetZ is taken from result[1], not from the argument. On failure, the example makes no inferences about height.
return RunScenario();
object? RunScenario()
{
var x = UO.GetX();
var y = UO.GetY();
var z = UO.GetZ();
var proposedZ = 0;
var result = UO.IsWorldCellPassable(x, y, z, x, y + 1, proposedZ, UO.WorldNum());
if (Truth(result[0] == 1))
{
var targetZ = result[1];
UO.Print("Input=" + Convert.ToString(proposedZ) + "; result=" + Convert.ToString(targetZ));
}
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:
- The full helper below Main accepts source X/Y/Z, target X/Y and map. It adds the required sixth argument and returns only the int 1/0, not an array. Therefore, the result IsCellOpen can be compared with true. The code does not move the character.
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 x = UO.GetX();
var y = UO.GetY();
var openCell = IsCellOpen(x, y, UO.GetZ(), x + 1, y + 1, UO.WorldNum());
if (Truth(Truth(openCell) == true))
{
UO.Print("Diagonal cell is locally passable");
}
return null;
}
dynamic IsCellOpen(dynamic x, dynamic y, dynamic z, dynamic toX, dynamic toY, dynamic map)
{
var cellResult = UO.IsWorldCellPassable(x, y, z, toX, toY, z, map);
if (Truth(ArrayLength(cellResult) != 2))
{
return 0;
}
return cellResult[0];
}
int ArrayLength(object? value) => value is System.Array array ? array.Length : 0;
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
UO.IsWorldCellPassable(currX, currY, currZ, destX, destY, destZ, worldNum) — UO.IsWorldCellPassable(Any,Any,Any,Any,Any,Any,Any)
Parameters: currX (Any), currY (Any), currZ (Any), destX (Any), destY (Any), destZ (Any), worldNum (Any)
Result: dynamic / Array.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(5). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.CheckWorldStep:bridge.CheckWorldStep(Arg(0), Arg(1), Arg(2), Arg(3), Arg(4), Arg(6)).
Internal implementation code; this is not a standalone script.
case "isworldcellpassable":
{
int destinationZFallback = Arg(5);
int[] step = bridge.CheckWorldStep(Arg(0), Arg(1), Arg(2), Arg(3), Arg(4), Arg(6));
int passable = step.Length > 0 ? step[0] : 0;
int destinationZ = step.Length > 1 ? step[1] : destinationZFallback;
return new InjectionValue(new[] { new InjectionValue(passable), new InjectionValue(destinationZ) });
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.LOSOptions();
dynamic UO.LOSOptions(object? value);Reads or saves the local parameter mask LOS runtime.
-
value— Optional int; no argument read only. In this thread, the range and individual bits are not checked. Low byte (value & 0xFF) selects algorithm 1..4; other low byte values in CheckLosCell use the 3 algorithm. Algorithms 1/2 block Wall and Impassable, 3 additionally NoShoot, and 4 enables NoShoot only with 0x200 and allows Window obstacles only with 0x400. Bit 0x100 additionally checks both side cells of each diagonal beam step for any selected algorithm. value=0 disables the additional CheckLosCell/diagonal checks, but BadLocations and CheckWorldStep remain. For example 4+0x100+0x200+0x400 selects custom with three flags; setter stores the original int, not the normalized algorithm.
int - state.LosOptions after possible write. This is a parameter code/mask, not a bool and not the result of a visibility check.
- ExecuteClientApiCompatibility assigns state. LosOptions given an argument and returns the same field. The call does not execute CheckLOS and does not check walls.
- The setting belongs to runtime. It does not guarantee server visibility and is not a way to navigate through obstacles.
- In a regular client host, this state data is taken from the GetPersistentState manager and is common to scripts/chat/macros of the same world/profile, and does not belong to one script. Another process or an apparently separate InjectionRuntimeState has a different state. Loading/clearing a profile can replace it; saved serial are still checked against the loaded world.
- Low byte (value & 0xFF) selects algorithm 1..4; other low byte values in CheckLosCell use the 3 algorithm. Algorithms 1/2 block Wall and Impassable, 3 additionally NoShoot, and 4 enables NoShoot only with 0x200 and allows Window obstacles only with 0x400. Bit 0x100 additionally checks both side cells of each diagonal beam step for any selected algorithm. value=0 disables the additional CheckLosCell/diagonal checks, but BadLocations and CheckWorldStep remain. For example 4+0x100+0x200+0x400 selects custom with three flags; setter stores the original int, not the normalized algorithm.
- A beam of non-zero length reads only the currently loaded _world.Map/World.Map: via CheckWorldStep you need WorldNum == _world.MapIndex and a live Player.Pathfinder. Another facet is not loaded or requested; there is no map/character/pathfinder or the step is unavailable - 0. Excluding identical X/Y skips the entire cycle of cells: with X/Y in 0..65535, WorldNum in 0..255 and abs(Zfrom-Zto)<=20 returns 1 even without a loaded card or with a different card number. This is not a proof of geometry or reachability. The result is local, not a LOS server solution.
- CheckLosCell bypasses the loaded Land/Static/Multi/Item of one cell. Impassable Land blocks with abs(rayZ-land.Z)<=20. The Static/Multi/Item flags are only valid in the range tile.Z-2 .. tile.Z+max(1,Height)+2; allowed custom Window is skipped until Wall/Impassable/NoShoot is checked. X/Y beam uses Bresenham, maximum 4096 steps; Z is taken from surfaces CheckWorldStep, not interpolated to Zto, final height tolerance is 20.
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.LOSOptions();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- Reads or saves the local parameter mask LOS runtime.
UO.Print(UO.LOSOptions());Parameters and execution flow:
- ExecuteClientApiCompatibility assigns state. LosOptions given an argument and returns the same field. The call does not execute CheckLOS and does not check walls.
return RunScenario();
object? RunScenario()
{
var before = UO.LOSOptions();
UO.Print(UO.LOSOptions(0));
UO.LOSOptions(before);
return null;
}Parameters and execution flow:
- The setting belongs to runtime. It does not guarantee server visibility and is not a way to navigate through obstacles.
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 original = UO.LOSOptions();
UO.LOSOptions(original);
UO.Print(Convert.ToString(UO.LOSOptions() == original));
return null;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "losoptions": if (arguments.Length > 0) state.LosOptions = Arg(0); return new InjectionValue(state.LosOptions);Parameters: value (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "losoptions": if (arguments.Length > 0) state.LosOptions = Arg(0); return new InjectionValue(state.LosOptions);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
string UO.PrivateGetTile(object? x, object? y, object? unknown, object? minTile, object? maxTile);Searches for the first graphic in the given range in the local cell.
-
x— int world coordinates of the current map. -
y— int world coordinates of the current map. -
unknown— The legacy parameter int is preserved in the syntax, but the bridge does not use it. -
minTile— int inclusive boundaries graphic. The order does not change automatically; minTile>maxTile does not match. -
maxTile— int inclusive boundaries graphic. The order does not change automatically; minTile>maxTile does not match.
string "0xXXXX" of the first matching graphic; "0x0000" - no match or map not loaded. The present graphic=0 also has this representation.
- PrivateGetTile traverses the TNext chain of all cell objects in map order and compares graphic>=minTile && graphic<=maxTile. Only Static does not filter and does not take hue/height into account.
- No Pathfinder/server request. For precise structured geometry, use GetWorldCell/ReadStaticsXY. Guard of a missing card returns the previous no-match sentinel.
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.PrivateGetTile(UO.GetX(), UO.GetY(), 0, 0, 65535);
UO.Print("PrivateGetTile: " + Convert.ToString(result));Parameters and execution flow:
- Searches for the first graphic in the given range in the local cell.
UO.Print(UO.PrivateGetTile(UO.GetX(), UO.GetY(), 0, 0, 65535));Parameters and execution flow:
- PrivateGetTile traverses the TNext chain of all cell objects in map order and compares graphic>=minTile && graphic<=maxTile. Only Static does not filter and does not take hue/height into account.
return RunScenario();
object? RunScenario()
{
UO.Print(UO.PrivateGetTile(UO.GetX(), UO.GetY(), 0, 0x0E21, 0x0E21));
return null;
}Parameters and execution flow:
- No Pathfinder/server request. For precise structured geometry, use GetWorldCell/ReadStaticsXY. Guard of a missing card returns the previous no-match sentinel.
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 tile = UO.PrivateGetTile(UO.GetX(), UO.GetY(), 0, 0, 65535);
if (Truth(tile != "0x0000"))
{
UO.Print(tile);
}
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.
UO.PrivateGetTile(x, y, unknown, minTile, maxTile) — UO.PrivateGetTile(Integer,Integer,Integer,Integer,Integer)
Parameters: x (Integer), y (Integer), unknown (Integer), minTile (Integer), maxTile (Integer)
Result: string / String.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.PrivateGetTile. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.PrivateGetTile:bridge.PrivateGetTile(x, y, unknown, minTile, maxTile).
Internal implementation code; this is not a standalone script.
public string PrivateGetTile(int x, int y, int unknown, int minTile, int maxTile)
=> bridge.PrivateGetTile(x, y, unknown, minTile, maxTile);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.ReadStaticsXY(object? x, object? y, object? worldNum);Reads flat static records of the current card in the cell.
-
x— int world coordinates of the cell. -
y— int world coordinates of the cell. -
worldNum— int number of the current card. Another map does not load and gives an empty array.
Array int, triples [graphic, Z, hue, graphic, Z, hue, ...]. No map/mismatch WorldNum is an empty array.
- Bridge.GetStaticTiles includes Static, Multi and Item from the cell's TNext chain; Land is excluded. This is not a Pascal record or an array of nested three-element records.
- Number of records = ArrayLength(result)/3. Only downloaded data is read; there are no requests for unknown geometry to the server.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The 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.ReadStaticsXY(UO.GetX(), UO.GetY(), UO.WorldNum());
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- Reads flat static records of the current card in the cell.
var records = UO.ReadStaticsXY(UO.GetX(), UO.GetY(), UO.WorldNum());
UO.Print(UO.GetArrayLength(records) / 3);Parameters and execution flow:
- Bridge.GetStaticTiles includes Static, Multi and Item from the cell's TNext chain; Land is excluded. This is not a Pascal record or an array of nested three-element records.
return RunScenario();
object? RunScenario()
{
var records = UO.ReadStaticsXY(UO.GetX(), UO.GetY(), UO.WorldNum());
if (Truth(UO.GetArrayLength(records) >= 3))
{
UO.Print(records[0]);
UO.Print(records[1]);
UO.Print(records[2]);
}
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:
- Number of records = ArrayLength(result)/3. Only downloaded data is read; there are no requests for unknown geometry to the server.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var map = UO.WorldNum();
var records = UO.ReadStaticsXY(UO.GetX(), UO.GetY(), map);
var i = 0;
while (Truth(i + 2 < UO.GetArrayLength(records)))
{
UO.Print(Convert.ToString(records[i]) + " " + Convert.ToString(records[i + 1]) + " " + Convert.ToString(records[i + 2]));
i = i + 3;
}
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: x (Any), y (Any), worldNum (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetStaticTiles:bridge.GetStaticTiles(Arg(0), Arg(1), Arg(2)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "readstaticsxy":
return new InjectionValue(bridge.GetStaticTiles(Arg(0), Arg(1), Arg(2)).Select(value => new InjectionValue(value)).ToArray());Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.RemoveUserStatic(object? id);Deletes the user static record at ID.
-
id— int ID, returned AddUserStatic; not graphic/type.
Numeric flag int: 1 - the record was deleted, 0 - ID was missing.
- First state.UserStatics.Remove; only if the deletion is successful, bridge.RemoveUserStatic(id) is called. Deletion does not apply to standard static map files.
- The local custom geometry is removed from the current state. Server items and other ID items do not change.
- In a regular client host, this state data is taken from the GetPersistentState manager and is common to scripts/chat/macros of the same world/profile, and does not belong to one script. Another process or an apparently separate InjectionRuntimeState has a different state. Loading/clearing a profile can replace it; saved serial are still checked against the loaded world.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The 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.RemoveUserStatic(1);
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- Deletes the user static record at ID.
UO.Print(UO.RemoveUserStatic(1));Parameters and execution flow:
- First state.UserStatics.Remove; only if the deletion is successful, bridge.RemoveUserStatic(id) is called. Deletion does not apply to standard static map files.
return RunScenario();
object? RunScenario()
{
if (Truth(UO.UserStaticExists(1)))
{
UO.Print(UO.RemoveUserStatic(1));
}
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:
- The local custom geometry is removed from the current state. Server items and other ID items do not change.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var records = UO.GetUserStatics();
if (Truth(UO.GetArrayLength(records) > 0))
{
var id = records[0][0];
UO.Print(UO.RemoveUserStatic(id));
UO.Print(UO.UserStaticExists(id));
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: id (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.RemoveUserStatic:bridge.RemoveUserStatic(id).
Internal implementation code; this is not a standalone script.
case "removeuserstatic":
{
int id = Arg(0);
bool removed = state.UserStatics.Remove(id);
if (removed) bridge.RemoveUserStatic(id);
return new InjectionValue(removed ? 1 : 0);
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.UserStaticExists(object? id);Checks for the presence of ID in user static records.
-
id- int ID AddUserStatic; not graphic/type and not serial.
Numerical flag int: 1 - the key is in the state. UserStatics, 0 - absent.
- Only ContainsKey is checked in the runtime dictionary. The visibility of an object on the map, the successful creation of a bridge object, and the server world are not checked.
- Reads the current local state. There is no package, target or automatic update; individual reads may see different states.
- In a regular client host, this state data is taken from the GetPersistentState manager and is common to scripts/chat/macros of the same world/profile, and does not belong to one script. Another process or an apparently separate InjectionRuntimeState has a different state. Loading/clearing a profile can replace it; saved serial are still checked against the loaded world.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The 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.UserStaticExists(1);
UO.Print("UserStaticExists: " + Convert.ToString(result));Parameters and execution flow:
- Checks for the presence of ID in user static records.
UO.Print(UO.UserStaticExists(1));Parameters and execution flow:
- Only ContainsKey is checked in the runtime dictionary. The visibility of an object on the map, the successful creation of a bridge object, and the server world are not checked.
return RunScenario();
object? RunScenario()
{
if (Truth(UO.UserStaticExists(1)))
{
UO.Print(UO.GetUserStatic(1));
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- Reads the current local state. There is no package, target or automatic update; individual reads may see different states.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var records = UO.GetUserStatics();
if (Truth(UO.GetArrayLength(records) > 0))
{
UO.Print(UO.UserStaticExists(records[0][0]));
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}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.UserStaticExists. -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(id).
Internal implementation code; this is not a standalone script.
public int UserStaticExists(InjectionValue id)
=> state.UserStatics.ContainsKey(NumberConversions.ToInt(id)) ? 1 : 0;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.WorldNum();Reads the current card number from the client model.
There are no parameters.
int — index of the client's current card, usually 0=Felucca, 1=Trammel, 2=Ilshenar, 3=Malas, 4=Tokuno, 5=Ter Mur. The user server may use a different set of cards. 0 is a full-fledged map, not a sign of an error.
- Already received local data is read. The request does not open status and does not force the server to send an update. After death, map transition, or object deletion, the values may change between two calls.
- C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.
object? result = UO.WorldNum();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- A call without arguments refers to self. The current card number is stored in value.
- Convert.ToString converts the number to be output and does not change the meaning of the result.
var value = UO.WorldNum();
UO.Print("WorldNum: " + Convert.ToString(value));Parameters and execution flow:
- The value is read once without any arguments. The current card number 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.WorldNum();
var land = UO.GetLandscapeTile(UO.GetX(), UO.GetY(), value);
UO.Print("Land record length: " + Convert.ToString(ArrayLength(land)));
return null;
}
int ArrayLength(object? value) => value is System.Array array ? array.Length : 0;Parameters and execution flow:
- Both calls without an argument read their current value. UO.Wait(1000) gives a pause in milliseconds between shots.
- The change compared is the number of the current card. 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.WorldNum();
await Delay(1000);
var after = UO.WorldNum();
if (Truth(before != after))
{
UO.Print("Before: " + Convert.ToString(before) + "; after: " + Convert.ToString(after));
}
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.WorldNumber:bridge.WorldNumber.
Internal implementation code; this is not a standalone script.
case "worldnum": return new InjectionValue(bridge.WorldNumber);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.X();Reads the X coordinate from the client model.
There are no parameters.
int is the X coordinate of the loaded object. For a character/world item, this is the world cell; for an item in the bag, this is the coordinate inside the container. An unknown object gives 0, but X=0 is also valid.
- 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.X();
UO.Print("X: " + Convert.ToString(result));Parameters and execution flow:
- A call without arguments refers to self. The x coordinate is stored in value.
- Convert.ToString converts the number to be output and does not change the meaning of the result.
var value = UO.X();
UO.Print("X: " + Convert.ToString(value));Parameters and execution flow:
- The value is read once without any arguments. The x coordinate 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.X();
UO.Print("Two tiles east would be X=" + Convert.ToString(value + 2));
return null;
}Parameters and execution flow:
- Both calls without an argument read their current value. UO.Wait(1000) gives a pause in milliseconds between shots.
- The change is compared: the X coordinate. The example does not change anything in the world and does not wait indefinitely. 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.X();
await Delay(1000);
var after = UO.X();
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 [X]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetX:bridge.GetX(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.GetX(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.Y();Reads the Y coordinate from the client model.
There are no parameters.
int — Y coordinate of the loaded object. For a character/world item this is the world cell, for an item in the bag this is the position inside the container. An unknown object gives 0.
- 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.Y();
UO.Print("Y: " + Convert.ToString(result));Parameters and execution flow:
- A call without arguments refers to self. The y coordinate is stored in value.
- Convert.ToString converts the number to be output and does not change the meaning of the result.
var value = UO.Y();
UO.Print("Y: " + Convert.ToString(value));Parameters and execution flow:
- The value is read once without any arguments. The y coordinate 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.Y();
UO.Print("Two tiles south would be Y=" + Convert.ToString(value + 2));
return null;
}Parameters and execution flow:
- Both calls without an argument read their current value. UO.Wait(1000) gives a pause in milliseconds between shots.
- The change is compared: the Y coordinate. The example does not change anything in the world and does not wait indefinitely. 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.Y();
await Delay(1000);
var after = UO.Y();
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 [Y]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetY:bridge.GetY(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.GetY(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.Z();Reads the Z height from the client model.
There are no parameters.
int is the height of the object in world units, usually -128..127. This is not a floor number or a layer of equipment. 0 may be the actual height or the result of the absence of an object.
- 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.Z();
UO.Print("Z: " + Convert.ToString(result));Parameters and execution flow:
- A call without arguments refers to self. The z height is stored in value.
- Convert.ToString converts the number to be output and does not change the meaning of the result.
var value = UO.Z();
UO.Print("Z: " + Convert.ToString(value));Parameters and execution flow:
- The value is read once without any arguments. The z height 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.Z();
var land = UO.GetLandscapeTile(UO.GetX(), UO.GetY(), UO.WorldNum());
if (Truth(ArrayLength(land) >= 3))
{
UO.Print("Height above land: " + Convert.ToString(value - land[1]));
}
return null;
}
int ArrayLength(object? value) => value is System.Array array ? array.Length : 0;
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- Both calls without an argument read their current value. UO.Wait(1000) gives a pause in milliseconds between shots.
- The change compared is the height Z. The example does not change anything in the world and does not wait indefinitely. 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.Z();
await Delay(1000);
var after = UO.Z();
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 [Z]. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetZ:bridge.GetZ(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.GetZ(bridge.Self)API creation: These functions register the API. They do not run again for every command call.