Repository navigation
EN UO Topic movement Part 2
Українська · Русский · 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.NewMoveXY(object? xdst, object? ydst, object? optimized, object? accuracy, object? running);
int UO.NewMoveXY(object? xdst, object? ydst, object? optimized, object? accuracy, object? running, object? stepCallback);
int UO.NewMoveXY(object? xdst, object? ydst, object? optimized, object? accuracy, object? running, object? stepCallback, object? timeout);
int UO.NewMoveXY(object? xdst, object? ydst, object? optimized, object? accuracy, object? running, object? stepCallback, object? timeout, object? maxSteps);
int UO.NewMoveXY(object? xdst, object? ydst, object? optimized, object? accuracy, object? running, object? stepCallback, object? timeout, object? maxSteps, object? maxDistance);
int UO.NewMoveXY(object? xdst, object? ydst, object? optimized, object? accuracy, object? running, object? stepCallback, object? timeout, object? maxSteps, object? maxDistance, object? accuracyZ);
int UO.NewMoveXY(object? xdst, object? ydst, object? optimized, object? accuracy, object? running, object? stepCallback, object? timeout, object? maxSteps, object? maxDistance, object? accuracyZ, object? avoidMobiles);
int UO.NewMoveXY(object? xdst, object? ydst, object? optimized, object? accuracy, object? running, object? stepCallback, object? timeout, object? maxSteps, object? maxDistance, object? accuracyZ, object? avoidMobiles, object? openDoors);
int UO.NewMoveXY(object? xdst, object? ydst, object? optimized, object? accuracy, object? running, object? stepCallback, object? timeout, object? maxSteps, object? maxDistance, object? accuracyZ, object? avoidMobiles, object? openDoors, object? stopOnStuck);Moves the character to X/Y, waits for the end and checks the achievement of the goal; supports additional restrictions and callbacks.
-
xdst— World X coordinate of destination, 0..65535. This is not serial and not a position inside the gump. -
ydst— World Y coordinate of destination, 0..65535. -
optimized- true - normal mode of searching and checking the path forward; false - reduced heuristics and closest step checking. false does not disable obstacle avoidance. -
accuracy— Tolerance for X and Y in cells: both deviations must fit within it. The value is limited to the range 0..20; 0 requires precise X/Y. -
running- true/1 - run request, false/0 - step. Server motion delays persist; It's not a speed multiplier. -
timeout— Optional wait limit in milliseconds; a missing argument, 0 and a negative value indicate the absence of this additional limit. -
maxSteps— Optional limit of observed position changes, not network packets. 0/negative/absent - without this limit. There may be several steps between polls, so this is not an accurate cell counter. -
maxDistance— Optional limit on the initial distance max(abs(dx),abs(dy)) to the target. 0/absence disables it. This is not the allowed deviation during the traversal and not the length of the found path. -
accuracyZ— Height tolerance: abs(actual Z - required Z), limited by 0..255. Zero requires a precise altitude; 255 essentially disables the Z limit. For NewMoveXY the target Z is equal to the character's Z when summoned; default tolerance is 255. -
avoidMobiles— Optional flag: true prohibits passing through the characters being taken into account; false allows the attempt. Without an argument, moveThroughNPC is used. The server may still deny access. -
openDoors— Optional flag for opening doors along the way. Without an argument, moveOpenDoor is used; true does not provide access to locked doors. -
stopOnStuck- true completes the movement with 0, if after planning approximately 1000 ms X/Y/Z have not changed. Active search and recalculation portions reset this timer; the separate timeout continues to operate. Default is false.
int 1 - at the end of the check the character is in the given X/Y/Z tolerance, including when he was already there before the challenge. int 0 - invalid coordinates, trigger failure, unreached point, or triggered stop condition. This is not a number of steps or serial; In case of emergency cancellation, the procedure is aborted instead of returning normally 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.
- The complete A* route is built before the first step, in short portions between client updates. When Optimized=true the next 4 cells of the path are checked; when false is the nearest step. This is a check of the already calculated path, and not the distance of the entire route and not the detour sliders when moving the mouse.
- Server failure DenyWalk or a new obstacle requests a recalculation from the current position after completing the queue of steps. The number of repetitions and recalculation frequency are limited; no path may end the movement with 0.
- The route belongs to the procedure that started it: its emergency stop cancels the remaining automatic path. If another run or user has already replaced the route, canceling the previous owner does not affect the new route. Steps already sent are not recalled.
- SetBadLocation and SetBadObject are used as a snapshot of the current runtime's prohibitions when the route is started. They are saved during its internal recalculation. Changing or clearing lists affects the next route, rather than overwriting one already in progress.
- UO.LimitMove controls destination distance: default 2000, zero unlimited. There are no hidden 4096-step/node or 10000-node caps. Work is sliced and can be stopped. GetPathArray respects the numeric moveThroughNPC stamina threshold and moveOpenDoor.
- timeout is counted after the request is accepted and includes subsequent portions of search and recalculation. stopOnStuck does not consider a running search to be a character stuck; After planning is completed, no position changes are taken into account again. The final 1/0 checks the actual coordinates, not just the readiness of the path.
- The result takes into account the local position of the client; subsequent server correction is still possible. Running competing movement commands from different routines changes the character's overall route.
- The settings moveCheckStamina, moveExitOnDisconnect, moveOpenDoor, moveThroughCorner, moveThroughNPC, moveHeuristicMult, moveTurnCost and moveBetweenTwoCorners affect the performance. Explicit avoidMobiles/openDoors override the corresponding values for this call.
- Result 0 does not indicate the exact cause. Check coordinates, connection, stamina and log; do not repeat the movement endlessly without UO.Wait and a limit of attempts.
- The main bridge records the request number, player/Pathfinder/map instances, and map index. A new request, context change, or final refusal gives 0; the check is repeated after reading the coordinates and the last callback. Timeout, maxSteps and callback=0 only stop the saved request, not a new foreign route. Temporary Blocked, while recovery is still active, does not lose possession: the wait continues. For external legacy-bridge without IApiMovementOwnershipBridge, the previous compatible mechanism is retained.
- The general Pathfinder stores up to 8 temporary X/Y/Z directional prohibitions for 2000 ms, only on rejected movement of the corresponding active request. Rotation, unknown sequence, resynchronization and old/foreign request do not create such a prohibition. A new external request and loss of map/player context clears them. Loaded geometry search attempts to bypass the transition; it's not knowing all the server obstacles. Without changing the player's X/Y/Z, up to 8 internal recalculations are allowed with a pause of at least 40 ms. There is no complete path or this budget has been exhausted - the route ends. The coordinate task then completes after processing the submitted steps; mobile-Follow may try again due to its delay.
The step callback in C# is explicitly registered via RegisterStepCallback(name, Func<int,int,int,bool>) or Func<int,int,int,int>. The x/y/z coordinates are transmitted as int; false/0 stops the route, true/non-zero number continues. The registration is valid in the current execution and is released with it.
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.NewMoveXY((UO.GetX() + 3), UO.GetY(), true, 0, false);
UO.Print("NewMoveXY: " + Convert.ToString(result));Parameters and execution flow:
- x/y — world target; Optimized=true, Accuracy=0 require precise X/Y, Running=false specifies walking.
- ok — int 1 or 0, not the number of cells passed. The target must be available on the current map.
var x = UO.GetX() + 3;
var y = UO.GetY();
var ok = UO.NewMoveXY(x, y, true, 0, false);
if (Truth(ok))
{
UO.Print("Destination reached");
}
else
{
UO.Print("Destination not reached");
}
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:
- 1445/1690 - example of a goal; Accuracy=1 allows nearby parking. Running=true. StepCallback=0 disables callback.
- timeout=5000 ms; maxSteps=100 observed movements; maxDistance=30 is checked from the origin.
- AccuracyZ=255 does not require a floor; avoidMobiles=true, openDoors=true, stopOnStuck=true include these conditions.
return RunScenario();
object? RunScenario()
{
var ok = UO.NewMoveXY(1445, 1690, true, 1, true, 0, 5000, 100, 30, 255, true, true, true);
UO.Print("Move result: " + Convert.ToString(ok));
return null;
}Parameters and execution flow:
- StepCallback="AfterStep" receives three coordinates. The RegisterStepCallback registration associates the name with the bool delegate. When Stamina <= 10 it returns false and stops moving; true continues the route.
- timeout=5000 ms limits the wait. Callback is called after a change is noticed, and is not guaranteed for every network step; Do not do a long wait or a new route in it.
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 stepRegistration = RegisterStepCallback("AfterStep", AfterStep);
var ok = UO.NewMoveXY(UO.GetX() + 5, UO.GetY(), true, 0, false, "AfterStep", 5000);
UO.Print("Move result: " + Convert.ToString(ok));
return null;
}
bool AfterStep(int x, int y, int z)
{
UO.Print("Position: " + Convert.ToString(x) + "," + Convert.ToString(y) + "," + Convert.ToString(z));
return UO.Stamina() > 10;
}
private IDisposable RegisterStepCallback(string name, Func<int, int, int, bool> handler) => global::ClassicUO.CSharp.CSharpScriptContext.Current.RegisterStepCallback(name, handler);
private IDisposable RegisterStepCallback(string name, Func<int, int, int, int> handler) => global::ClassicUO.CSharp.CSharpScriptContext.Current.RegisterStepCallback(name, handler);
}Parameters and execution flow:
- GoToPoint is a helper function for this example only. Its four parameters x/y/accuracy/running are described above the function declaration; the complete body of the function is in the same copied block.
- Main evaluates the target and calls GoToPoint. It adds optimized=true, callback=0, timeout=8000 and maxSteps=100, calls NewMoveXY once and passes the returned int back to Main.
- NewMoveXY is a built-in client command. Its A* search, patency check and processing of server steps are implemented in the client, and not in additional hidden procedures of this script.
- In this example, callback is disabled. If another example specifies a callback name or calls an additional script function, its definition must also be given in its entirety.
- In C# check if (reached != 0); a numerical result of 0 indicates failure. A direct comparison of int with bool is not acceptable. An emergency cancellation interrupts execution and is not required to return false.
var x = UO.GetX() + 3;
var y = UO.GetY();
var reached = GoToPoint(x, y, 0, true);
if (Truth(Truth(reached) == true))
{
UO.Print("Destination reached");
}
else
{
UO.Print("Destination not reached");
}
dynamic GoToPoint(dynamic x, dynamic y, dynamic accuracy, dynamic running)
{
dynamic optimized = true;
var callback = 0;
var timeout = 8000;
var maxSteps = 100;
var reached = UO.NewMoveXY(x, y, optimized, accuracy, running, callback, timeout, maxSteps);
return reached;
}
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: xdst (Any), ydst (Any), optimized (Any), accuracy (Any), running (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [NewMoveXY]. -
InjectionScript.Runtime.InjectionApiUO.CompactNewMoveXY:CompactNewMoveXY(values).
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.
values => new InjectionValue(CompactNewMoveXY(values))
UO.NewMoveXY(xdst, ydst, optimized, accuracy, running, stepCallback) — UO.NewMoveXY(Any,Any,Any,Any,Any,Any)
Parameters: xdst (Any), ydst (Any), optimized (Any), accuracy (Any), running (Any), stepCallback (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [NewMoveXY]. -
InjectionScript.Runtime.InjectionApiUO.CompactNewMoveXY:CompactNewMoveXY(values).
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.
values => new InjectionValue(CompactNewMoveXY(values))
UO.NewMoveXY(xdst, ydst, optimized, accuracy, running, stepCallback, timeout) — UO.NewMoveXY(Any,Any,Any,Any,Any,Any,Any)
Parameters: xdst (Any), ydst (Any), optimized (Any), accuracy (Any), running (Any), stepCallback (Any), timeout (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [NewMoveXY]. -
InjectionScript.Runtime.InjectionApiUO.CompactNewMoveXY:CompactNewMoveXY(values).
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.
values => new InjectionValue(CompactNewMoveXY(values))
UO.NewMoveXY(xdst, ydst, optimized, accuracy, running, stepCallback, timeout, maxSteps) — UO.NewMoveXY(Any,Any,Any,Any,Any,Any,Any,Any)
Parameters: xdst (Any), ydst (Any), optimized (Any), accuracy (Any), running (Any), stepCallback (Any), timeout (Any), maxSteps (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [NewMoveXY]. -
InjectionScript.Runtime.InjectionApiUO.CompactNewMoveXY:CompactNewMoveXY(values).
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.
values => new InjectionValue(CompactNewMoveXY(values))
UO.NewMoveXY(xdst, ydst, optimized, accuracy, running, stepCallback, timeout, maxSteps, maxDistance) — UO.NewMoveXY(Any,Any,Any,Any,Any,Any,Any,Any,Any)
Parameters: xdst (Any), ydst (Any), optimized (Any), accuracy (Any), running (Any), stepCallback (Any), timeout (Any), maxSteps (Any), maxDistance (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [NewMoveXY]. -
InjectionScript.Runtime.InjectionApiUO.CompactNewMoveXY:CompactNewMoveXY(values).
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.
values => new InjectionValue(CompactNewMoveXY(values))
UO.NewMoveXY(xdst, ydst, optimized, accuracy, running, stepCallback, timeout, maxSteps, maxDistance, accuracyZ) — UO.NewMoveXY(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)
Parameters: xdst (Any), ydst (Any), optimized (Any), accuracy (Any), running (Any), stepCallback (Any), timeout (Any), maxSteps (Any), maxDistance (Any), accuracyZ (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [NewMoveXY]. -
InjectionScript.Runtime.InjectionApiUO.CompactNewMoveXY:CompactNewMoveXY(values).
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.
values => new InjectionValue(CompactNewMoveXY(values))
UO.NewMoveXY(xdst, ydst, optimized, accuracy, running, stepCallback, timeout, maxSteps, maxDistance, accuracyZ, avoidMobiles) — UO.NewMoveXY(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)
Parameters: xdst (Any), ydst (Any), optimized (Any), accuracy (Any), running (Any), stepCallback (Any), timeout (Any), maxSteps (Any), maxDistance (Any), accuracyZ (Any), avoidMobiles (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [NewMoveXY]. -
InjectionScript.Runtime.InjectionApiUO.CompactNewMoveXY:CompactNewMoveXY(values).
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.
values => new InjectionValue(CompactNewMoveXY(values))
UO.NewMoveXY(xdst, ydst, optimized, accuracy, running, stepCallback, timeout, maxSteps, maxDistance, accuracyZ, avoidMobiles, openDoors) — UO.NewMoveXY(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)
Parameters: xdst (Any), ydst (Any), optimized (Any), accuracy (Any), running (Any), stepCallback (Any), timeout (Any), maxSteps (Any), maxDistance (Any), accuracyZ (Any), avoidMobiles (Any), openDoors (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [NewMoveXY]. -
InjectionScript.Runtime.InjectionApiUO.CompactNewMoveXY:CompactNewMoveXY(values).
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.
values => new InjectionValue(CompactNewMoveXY(values))
UO.NewMoveXY(xdst, ydst, optimized, accuracy, running, stepCallback, timeout, maxSteps, maxDistance, accuracyZ, avoidMobiles, openDoors, stopOnStuck) — UO.NewMoveXY(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)
Parameters: xdst (Any), ydst (Any), optimized (Any), accuracy (Any), running (Any), stepCallback (Any), timeout (Any), maxSteps (Any), maxDistance (Any), accuracyZ (Any), avoidMobiles (Any), openDoors (Any), stopOnStuck (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [NewMoveXY]. -
InjectionScript.Runtime.InjectionApiUO.CompactNewMoveXY:CompactNewMoveXY(values).
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.
values => new InjectionValue(CompactNewMoveXY(values))Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.OpenDoor();Requests the door to be opened for the character.
There are no parameters.
void - no value. Call on a separate line; completion does not confirm the server's action.
- OpenDoor calls GameActions.OpenDoor via Invoke. Serial door is not accepted; the search and discovery rules belong to GameActions/server.
- In the examples, UO.Wait specifies only a script pause; the end of the pause does not prove that the server has completed the request.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The command is a separate statement. The message before it marks the start of the call; it does not confirm a server action.
UO.Print("Calling UO.OpenDoor");
UO.OpenDoor();Parameters and execution flow:
- Requests the door to be opened for the character.
UO.OpenDoor();Parameters and execution flow:
- OpenDoor calls GameActions.OpenDoor via Invoke. Serial door is not accepted; the search and discovery rules belong to GameActions/server.
return RunScenario();
object? RunScenario()
{
if (Truth(UO.IsOnline()))
{
UO.OpenDoor();
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- In the examples, UO.Wait specifies only a script pause; the end of the pause does not prove that the server has completed the request.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
UO.OpenDoor();
UO.Wait(250);
UO.Print("Door request sent");
return null;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.OpenDoor:bridge.OpenDoor().
Internal implementation code; this is not a standalone script.
case "opendoor": bridge.OpenDoor(); break;PMove waits for normal pathfinding and movement to finish. The XY form requires exact XY; XYZ also requires the specified height. It returns void: compare actual coordinates to check success. Use NewMoveXY or MoveXYZ for a numeric result. There is no implicit 30-second deadline.
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.PredictedDirection();Reads the predicted direction side after the character's already queued steps.
There are no parameters.
int direction 0..7, without run bit. 0 - north or absence of character.
- Only the function shown in the syntax is UO without arguments. There are no target, serial, type, target, distance or timeout parameters. A non-bool number, ID, or a tile notation: 1 does not mean achieving the goal.
- GetEndPosition reads the X/Y/Z/direction of the last already added Mobile.Step. When the queue is empty, reads the character's current position/direction. This is an O(1) read: the step is not retrieved, the motion and packet are not sent, the route is not calculated, the command does not wait for an achievement.
- World directions: 0 north, 1 northeast, 2 east, 3 southeast, 4 south, 5 southwest, 6 west, 7 northwest. The screen is isometric. Direction.Mask removes the running flag; speed does not return.
- This is a local forecast, not a confirmed arrival. New/completed steps, server failure, queue clearing or teleport can change it. Individual component calls are not atomic; an X match does not prove a Y/Z match or server confirmation.
- Invoke performs a read on the game thread; The worker thread is waiting for the manager to process the request. Canceling the script interrupts the wait. Pauses and additional network requests are not added.
- External implementations of IApiBridge without IPredictedMovementBridge retain a fallback reading of the current coordinates/direction. Classic UO implements a queue-aware interface.
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.PredictedDirection();
UO.Print("PredictedDirection: " + Convert.ToString(result));Parameters and execution flow:
- predicted saves one call without arguments; Convert.ToString formats the number for the log.
var predicted = UO.PredictedDirection();
UO.Print("Predicted: " + Convert.ToString(predicted));Parameters and execution flow:
- UO.Wait(100) pauses the example for 100 ms. before and after can coincide even with an intermediate movement; these readings do not start a movement.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.PredictedDirection();
await Delay(100);
var after = UO.PredictedDirection();
if (Truth(before != after))
{
UO.Print("Prediction 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;Parameters and execution flow:
- expected - an example of coordinates/height/direction, not an argument to the native command. PredictionEquals checks UO.Self(), reads the value once and returns 1 (condition met) if equal, otherwise 0 (condition not met). The entire function code is shown below Main. The coincidence of one component does not mean arrival.
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(PredictionEquals(4)) == true))
{
UO.Print("Queued endpoint matches this component");
}
else
{
UO.Print("Different component or no player");
}
return null;
}
dynamic PredictionEquals(dynamic expected)
{
if (Truth(UO.Self() == 0))
{
return false;
}
var predicted = UO.PredictedDirection();
return Truth(predicted == expected);
}
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. -
InjectionScript.Runtime.InjectionApiUO.ReadPredictedCoordinate:ReadPredictedCoordinate(3).
Internal implementation code; this is not a standalone script.
case "predicteddirection": return new InjectionValue(ReadPredictedCoordinate(3));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.PredictedX();Reads the predicted X coordinate after the character's already queued steps.
There are no parameters.
int X in map cells. 0 - valid coordinate or absence of character.
- Only the function shown in the syntax is UO without arguments. There are no target, serial, type, target, distance or timeout parameters. A non-bool number, ID, or a tile notation: 1 does not mean achieving the goal.
- GetEndPosition reads the X/Y/Z/direction of the last already added Mobile.Step. When the queue is empty, reads the character's current position/direction. This is an O(1) read: the step is not retrieved, the motion and packet are not sent, the route is not calculated, the command does not wait for an achievement.
- X and Y are world/map coordinates, not container gump pixels. Z is the height, not the floor number. A single component is returned, not an array or the final destination of the entire route.
- This is a local forecast, not a confirmed arrival. New/completed steps, server failure, queue clearing or teleport can change it. Individual component calls are not atomic; an X match does not prove a Y/Z match or server confirmation.
- Invoke performs a read on the game thread; The worker thread is waiting for the manager to process the request. Canceling the script interrupts the wait. Pauses and additional network requests are not added.
- External implementations of IApiBridge without IPredictedMovementBridge retain a fallback reading of the current coordinates/direction. Classic UO implements a queue-aware interface.
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.PredictedX();
UO.Print("PredictedX: " + Convert.ToString(result));Parameters and execution flow:
- predicted saves one call without arguments; Convert.ToString formats the number for the log.
var predicted = UO.PredictedX();
UO.Print("Predicted: " + Convert.ToString(predicted));Parameters and execution flow:
- UO.Wait(100) pauses the example for 100 ms. before and after can coincide even with an intermediate movement; these readings do not start a movement.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.PredictedX();
await Delay(100);
var after = UO.PredictedX();
if (Truth(before != after))
{
UO.Print("Prediction 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;Parameters and execution flow:
- expected - an example of coordinates/height/direction, not an argument to the native command. PredictionEquals checks UO.Self(), reads the value once and returns 1 (condition met) if equal, otherwise 0 (condition not met). The entire function code is shown below Main. The coincidence of one component does not mean arrival.
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(PredictionEquals(1445)) == true))
{
UO.Print("Queued endpoint matches this component");
}
else
{
UO.Print("Different component or no player");
}
return null;
}
dynamic PredictionEquals(dynamic expected)
{
if (Truth(UO.Self() == 0))
{
return false;
}
var predicted = UO.PredictedX();
return Truth(predicted == expected);
}
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. -
InjectionScript.Runtime.InjectionApiUO.ReadPredictedCoordinate:ReadPredictedCoordinate(0).
Internal implementation code; this is not a standalone script.
case "predictedx": return new InjectionValue(ReadPredictedCoordinate(0));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.PredictedY();Reads the predicted Y coordinate after the character's already queued steps.
There are no parameters.
int Y in map cells. 0 - valid coordinate or absence of character.
- Only the function shown in the syntax is UO without arguments. There are no target, serial, type, target, distance or timeout parameters. A non-bool number, ID, or a tile notation: 1 does not mean achieving the goal.
- GetEndPosition reads the X/Y/Z/direction of the last already added Mobile.Step. When the queue is empty, reads the character's current position/direction. This is an O(1) read: the step is not retrieved, the motion and packet are not sent, the route is not calculated, the command does not wait for an achievement.
- X and Y are world/map coordinates, not container gump pixels. Z is the height, not the floor number. A single component is returned, not an array or the final destination of the entire route.
- This is a local forecast, not a confirmed arrival. New/completed steps, server failure, queue clearing or teleport can change it. Individual component calls are not atomic; an X match does not prove a Y/Z match or server confirmation.
- Invoke performs a read on the game thread; The worker thread is waiting for the manager to process the request. Canceling the script interrupts the wait. Pauses and additional network requests are not added.
- External implementations of IApiBridge without IPredictedMovementBridge retain a fallback reading of the current coordinates/direction. Classic UO implements a queue-aware interface.
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.PredictedY();
UO.Print("PredictedY: " + Convert.ToString(result));Parameters and execution flow:
- predicted saves one call without arguments; Convert.ToString formats the number for the log.
var predicted = UO.PredictedY();
UO.Print("Predicted: " + Convert.ToString(predicted));Parameters and execution flow:
- UO.Wait(100) pauses the example for 100 ms. before and after can coincide even with an intermediate movement; these readings do not start a movement.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.PredictedY();
await Delay(100);
var after = UO.PredictedY();
if (Truth(before != after))
{
UO.Print("Prediction 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;Parameters and execution flow:
- expected - an example of coordinates/height/direction, not an argument to the native command. PredictionEquals checks UO.Self(), reads the value once and returns 1 (condition met) if equal, otherwise 0 (condition not met). The entire function code is shown below Main. The coincidence of one component does not mean arrival.
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(PredictionEquals(1690)) == true))
{
UO.Print("Queued endpoint matches this component");
}
else
{
UO.Print("Different component or no player");
}
return null;
}
dynamic PredictionEquals(dynamic expected)
{
if (Truth(UO.Self() == 0))
{
return false;
}
var predicted = UO.PredictedY();
return Truth(predicted == expected);
}
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. -
InjectionScript.Runtime.InjectionApiUO.ReadPredictedCoordinate:ReadPredictedCoordinate(1).
Internal implementation code; this is not a standalone script.
case "predictedy": return new InjectionValue(ReadPredictedCoordinate(1));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.PredictedZ();Reads the predicted Z height after the character's already queued steps.
There are no parameters.
int Z, signed height -128..127; a negative value is retained. 0 - acceptable height or absence of the character.
- Only the function shown in the syntax is UO without arguments. There are no target, serial, type, target, distance or timeout parameters. A non-bool number, ID, or a tile notation: 1 does not mean achieving the goal.
- GetEndPosition reads the X/Y/Z/direction of the last already added Mobile.Step. When the queue is empty, reads the character's current position/direction. This is an O(1) read: the step is not retrieved, the motion and packet are not sent, the route is not calculated, the command does not wait for an achievement.
- X and Y are world/map coordinates, not container gump pixels. Z is the height, not the floor number. A single component is returned, not an array or the final destination of the entire route.
- This is a local forecast, not a confirmed arrival. New/completed steps, server failure, queue clearing or teleport can change it. Individual component calls are not atomic; an X match does not prove a Y/Z match or server confirmation.
- Invoke performs a read on the game thread; The worker thread is waiting for the manager to process the request. Canceling the script interrupts the wait. Pauses and additional network requests are not added.
- External implementations of IApiBridge without IPredictedMovementBridge retain a fallback reading of the current coordinates/direction. Classic UO implements a queue-aware interface.
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.PredictedZ();
UO.Print("PredictedZ: " + Convert.ToString(result));Parameters and execution flow:
- predicted saves one call without arguments; Convert.ToString formats the number for the log.
var predicted = UO.PredictedZ();
UO.Print("Predicted: " + Convert.ToString(predicted));Parameters and execution flow:
- UO.Wait(100) pauses the example for 100 ms. before and after can coincide even with an intermediate movement; these readings do not start a movement.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.PredictedZ();
await Delay(100);
var after = UO.PredictedZ();
if (Truth(before != after))
{
UO.Print("Prediction 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;Parameters and execution flow:
- expected - an example of coordinates/height/direction, not an argument to the native command. PredictionEquals checks UO.Self(), reads the value once and returns 1 (condition met) if equal, otherwise 0 (condition not met). The entire function code is shown below Main. The coincidence of one component does not mean arrival.
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(PredictionEquals(-4)) == true))
{
UO.Print("Queued endpoint matches this component");
}
else
{
UO.Print("Different component or no player");
}
return null;
}
dynamic PredictionEquals(dynamic expected)
{
if (Truth(UO.Self() == 0))
{
return false;
}
var predicted = UO.PredictedZ();
return Truth(predicted == expected);
}
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. -
InjectionScript.Runtime.InjectionApiUO.ReadPredictedCoordinate:ReadPredictedCoordinate(2).
Internal implementation code; this is not a standalone script.
case "predictedz": return new InjectionValue(ReadPredictedCoordinate(2));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.SetRunMountTimer(object? value);Sets the step interval for running on horseback. Use to intentionally slow down or return to standard speed. You cannot speed up movement beyond the standard tempo with this command.
-
value— Required integer number of milliseconds. Range 100..2000; smaller values, including 0 and negative ones, rise to 100, larger values decrease to 2000.
void - no value. Call on a separate line. To read the applied spacing, use UO.GetRunMountTimer(). This is not confirmation of the step by the server.
- The setting applies to the riding mode. The standard and minimum allowed value is 100 ms; the upper limit is 2000 ms. The other three modes have separate settings.
- This is the character's local movement interval, not ping, FPS, pathfinding timeout, or measured server step duration. Increasing the number slows down the movement; decreasing below the standard interval does not speed up the sending of packets.
- The team itself does not start moving, does not mount the mount and does not change the walking/running mode. The mode is selected while driving; the speed mode and flight specified by the server are also taken into account by the client.
- The setting is general for the movement of this client: it can be used by manual control, map route and other scripts. Temporarily changing it, keep the previous value and restore it after the operation; do not change one mode at the same time from several procedures.
- Turning and deviating steps are different from normal moves. Server confirmation, communication delays and obstacles may increase the actual time. The client does not send a series of accelerated steps to catch up on missing frames.
- In a regular client host, this state data is taken from the GetPersistentState manager and is common to scripts/chat/macros of the same world/profile, and does not belong to one script. Another process or an apparently separate InjectionRuntimeState has a different state. Loading/clearing a profile can replace it; saved serial are still checked against the loaded world.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The command is a separate statement. The message before it marks the start of the call; it does not confirm a server action.
UO.Print("Calling UO.SetRunMountTimer");
UO.SetRunMountTimer(100);Parameters and execution flow:
- Value=100 — milliseconds. The call sets up subsequent movement, but does not start a route.
UO.SetRunMountTimer(100);Parameters and execution flow:
- Value=200 adds 100 ms to the standard interval. The change only applies to horseback runs. For example, select a free direction.
- UO.Step gets Direction=2 and Running=true. The code 7 can only mean turn; other codes are not true/false.
finallyrestores the previous setting on normal shutdown or error handling.
return RunScenario();
object? RunScenario()
{
var previous = UO.GetRunMountTimer();
try
{
UO.SetRunMountTimer(200);
var stepResult = UO.Step(2, true);
if (Truth(stepResult != 7))
{
UO.Print("Step was not confirmed: " + Convert.ToString(stepResult));
}
}
finally
{
UO.SetRunMountTimer(previous);
}
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:
- After Value=1 applied is equal to 100. The example does not move the character and restores the original spacing.
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 previous = UO.GetRunMountTimer();
try
{
UO.SetRunMountTimer(1);
var applied = UO.GetRunMountTimer();
UO.Print("Applied delay, ms: " + Convert.ToString(applied));
}
finally
{
UO.SetRunMountTimer(previous);
}
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: value (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ClampMoveTimer:ClampMoveTimer(Arg(0), 100). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetMovementTimers:bridge.SetMovementTimers(state.RunMountTimer, state.RunUnmountTimer, state.WalkMountTimer, state.WalkUnmountTimer).
Internal implementation code; this is not a standalone script.
case "setrunmounttimer":
state.RunMountTimer = ClampMoveTimer(Arg(0), 100);
bridge.SetMovementTimers(state.RunMountTimer, state.RunUnmountTimer, state.WalkMountTimer, state.WalkUnmountTimer);
return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.SetRunUnmountTimer(object? value);Sets the walking stride interval. Use to intentionally slow down or return to standard speed. You cannot speed up movement beyond the standard tempo with this command.
-
value— Required integer number of milliseconds. Range 200..2000; smaller values, including 0 and negative ones, rise to 200, larger values decrease to 2000.
void - no value. Call on a separate line. To read the applied spacing, use UO.GetRunUnmountTimer(). This is not confirmation of the step by the server.
- The setting applies to walking mode. The standard and minimum allowed value is 200 ms; the upper limit is 2000 ms. The other three modes have separate settings.
- This is the character's local movement interval, not ping, FPS, pathfinding timeout, or measured server step duration. Increasing the number slows down the movement; decreasing below the standard interval does not speed up the sending of packets.
- The team itself does not start moving, does not mount the mount and does not change the walking/running mode. The mode is selected while driving; the speed mode and flight specified by the server are also taken into account by the client.
- The setting is general for the movement of this client: it can be used by manual control, map route and other scripts. Temporarily changing it, keep the previous value and restore it after the operation; do not change one mode at the same time from several procedures.
- Turning and deviating steps are different from normal moves. Server confirmation, communication delays and obstacles may increase the actual time. The client does not send a series of accelerated steps to catch up on missing frames.
- In a regular client host, this state data is taken from the GetPersistentState manager and is common to scripts/chat/macros of the same world/profile, and does not belong to one script. Another process or an apparently separate InjectionRuntimeState has a different state. Loading/clearing a profile can replace it; saved serial are still checked against the loaded world.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The command is a separate statement. The message before it marks the start of the call; it does not confirm a server action.
UO.Print("Calling UO.SetRunUnmountTimer");
UO.SetRunUnmountTimer(200);Parameters and execution flow:
- Value=200 — milliseconds. The call sets up subsequent movement, but does not start a route.
UO.SetRunUnmountTimer(200);Parameters and execution flow:
- Value=300 adds 100 ms to the standard interval. The change only applies to running on foot. For example, select a free direction.
- UO.Step gets Direction=2 and Running=true. The code 7 can only mean turn; other codes are not true/false.
finallyrestores the previous setting on normal shutdown or error handling.
return RunScenario();
object? RunScenario()
{
var previous = UO.GetRunUnMountTimer();
try
{
UO.SetRunUnmountTimer(300);
var stepResult = UO.Step(2, true);
if (Truth(stepResult != 7))
{
UO.Print("Step was not confirmed: " + Convert.ToString(stepResult));
}
}
finally
{
UO.SetRunUnmountTimer(previous);
}
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:
- After Value=1 applied is equal to 200. The example does not move the character and restores the original spacing.
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 previous = UO.GetRunUnMountTimer();
try
{
UO.SetRunUnmountTimer(1);
var applied = UO.GetRunUnMountTimer();
UO.Print("Applied delay, ms: " + Convert.ToString(applied));
}
finally
{
UO.SetRunUnmountTimer(previous);
}
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: value (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ClampMoveTimer:ClampMoveTimer(Arg(0), 200). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetMovementTimers:bridge.SetMovementTimers(state.RunMountTimer, state.RunUnmountTimer, state.WalkMountTimer, state.WalkUnmountTimer).
Internal implementation code; this is not a standalone script.
case "setrununmounttimer":
state.RunUnmountTimer = ClampMoveTimer(Arg(0), 200);
bridge.SetMovementTimers(state.RunMountTimer, state.RunUnmountTimer, state.WalkMountTimer, state.WalkUnmountTimer);
return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.SetWalkMountTimer(object? value);Sets the step interval for walking on horseback. Use to intentionally slow down or return to standard speed. You cannot speed up movement beyond the standard tempo with this command.
-
value— Required integer number of milliseconds. Range 200..2000; smaller values, including 0 and negative ones, rise to 200, larger values decrease to 2000.
void - no value. Call on a separate line. To read the applied spacing, use UO.GetWalkMountTimer(). This is not confirmation of the step by the server.
- The setting applies to the riding mode. The standard and minimum allowed value is 200 ms; the upper limit is 2000 ms. The other three modes have separate settings.
- This is the character's local movement interval, not ping, FPS, pathfinding timeout, or measured server step duration. Increasing the number slows down the movement; decreasing below the standard interval does not speed up the sending of packets.
- The team itself does not start moving, does not mount the mount and does not change the walking/running mode. The mode is selected while driving; the speed mode and flight specified by the server are also taken into account by the client.
- The setting is general for the movement of this client: it can be used by manual control, map route and other scripts. Temporarily changing it, keep the previous value and restore it after the operation; do not change one mode at the same time from several procedures.
- Turning and deviating steps are different from normal moves. Server confirmation, communication delays and obstacles may increase the actual time. The client does not send a series of accelerated steps to catch up on missing frames.
- In a regular client host, this state data is taken from the GetPersistentState manager and is common to scripts/chat/macros of the same world/profile, and does not belong to one script. Another process or an apparently separate InjectionRuntimeState has a different state. Loading/clearing a profile can replace it; saved serial are still checked against the loaded world.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The command is a separate statement. The message before it marks the start of the call; it does not confirm a server action.
UO.Print("Calling UO.SetWalkMountTimer");
UO.SetWalkMountTimer(200);Parameters and execution flow:
- Value=200 — milliseconds. The call sets up subsequent movement, but does not start a route.
UO.SetWalkMountTimer(200);Parameters and execution flow:
- Value=300 adds 100 ms to the standard interval. The change only applies to horseback riding. For example, select a free direction.
- UO.Step gets Direction=2 and Running=false. The code 7 can only mean turn; other codes are not true/false.
finallyrestores the previous setting on normal shutdown or error handling.
return RunScenario();
object? RunScenario()
{
var previous = UO.GetWalkMountTimer();
try
{
UO.SetWalkMountTimer(300);
var stepResult = UO.Step(2, false);
if (Truth(stepResult != 7))
{
UO.Print("Step was not confirmed: " + Convert.ToString(stepResult));
}
}
finally
{
UO.SetWalkMountTimer(previous);
}
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:
- After Value=1 applied is equal to 200. The example does not move the character and restores the original spacing.
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 previous = UO.GetWalkMountTimer();
try
{
UO.SetWalkMountTimer(1);
var applied = UO.GetWalkMountTimer();
UO.Print("Applied delay, ms: " + Convert.ToString(applied));
}
finally
{
UO.SetWalkMountTimer(previous);
}
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: value (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ClampMoveTimer:ClampMoveTimer(Arg(0), 200). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetMovementTimers:bridge.SetMovementTimers(state.RunMountTimer, state.RunUnmountTimer, state.WalkMountTimer, state.WalkUnmountTimer).
Internal implementation code; this is not a standalone script.
case "setwalkmounttimer":
state.WalkMountTimer = ClampMoveTimer(Arg(0), 200);
bridge.SetMovementTimers(state.RunMountTimer, state.RunUnmountTimer, state.WalkMountTimer, state.WalkUnmountTimer);
return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.SetWalkUnmountTimer(object? value);Sets the walking step interval. Use to intentionally slow down or return to standard speed. You cannot speed up movement beyond the standard tempo with this command.
-
value— Required integer number of milliseconds. Range 400..2000; smaller values, including 0 and negative ones, rise to 400, larger values decrease to 2000.
void - no value. Call on a separate line. To read the applied spacing, use UO.GetWalkUnmountTimer(). This is not confirmation of the step by the server.
- The setting applies to walking mode. The standard and minimum allowed value is 400 ms; the upper limit is 2000 ms. The other three modes have separate settings.
- This is the character's local movement interval, not ping, FPS, pathfinding timeout, or measured server step duration. Increasing the number slows down the movement; decreasing below the standard interval does not speed up the sending of packets.
- The team itself does not start moving, does not mount the mount and does not change the walking/running mode. The mode is selected while driving; the speed mode and flight specified by the server are also taken into account by the client.
- The setting is general for the movement of this client: it can be used by manual control, map route and other scripts. Temporarily changing it, keep the previous value and restore it after the operation; do not change one mode at the same time from several procedures.
- Turning and deviating steps are different from normal moves. Server confirmation, communication delays and obstacles may increase the actual time. The client does not send a series of accelerated steps to catch up on missing frames.
- In a regular client host, this state data is taken from the GetPersistentState manager and is common to scripts/chat/macros of the same world/profile, and does not belong to one script. Another process or an apparently separate InjectionRuntimeState has a different state. Loading/clearing a profile can replace it; saved serial are still checked against the loaded world.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The command is a separate statement. The message before it marks the start of the call; it does not confirm a server action.
UO.Print("Calling UO.SetWalkUnmountTimer");
UO.SetWalkUnmountTimer(400);Parameters and execution flow:
- Value=400 — milliseconds. The call sets up subsequent movement, but does not start a route.
UO.SetWalkUnmountTimer(400);Parameters and execution flow:
- Value=500 adds 100 ms to the standard interval. The change only applies to walking. For example, select a free direction.
- UO.Step gets Direction=2 and Running=false. The code 7 can only mean turn; other codes are not true/false.
finallyrestores the previous setting on normal shutdown or error handling.
return RunScenario();
object? RunScenario()
{
var previous = UO.GetWalkUnmountTimer();
try
{
UO.SetWalkUnmountTimer(500);
var stepResult = UO.Step(2, false);
if (Truth(stepResult != 7))
{
UO.Print("Step was not confirmed: " + Convert.ToString(stepResult));
}
}
finally
{
UO.SetWalkUnmountTimer(previous);
}
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:
- After Value=1 applied is equal to 400. The example does not move the character and restores the original spacing.
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 previous = UO.GetWalkUnmountTimer();
try
{
UO.SetWalkUnmountTimer(1);
var applied = UO.GetWalkUnmountTimer();
UO.Print("Applied delay, ms: " + Convert.ToString(applied));
}
finally
{
UO.SetWalkUnmountTimer(previous);
}
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: value (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ClampMoveTimer:ClampMoveTimer(Arg(0), 400). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetMovementTimers:bridge.SetMovementTimers(state.RunMountTimer, state.RunUnmountTimer, state.WalkMountTimer, state.WalkUnmountTimer).
Internal implementation code; this is not a standalone script.
case "setwalkunmounttimer":
state.WalkUnmountTimer = ClampMoveTimer(Arg(0), 400);
bridge.SetMovementTimers(state.RunMountTimer, state.RunUnmountTimer, state.WalkMountTimer, state.WalkUnmountTimer);
return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.Step(object? direction, object? running);Requests a single step/rotation and, if a step was sent, waits for server confirmation.
-
direction— Direction 0=N, 1=NE, 2=E, 3=SE, 4=S, 5=SW, 6=W, 7=NW. The implementation applies a bitwise &7; use 0..7 for clarity. -
running- true/1 - run request, false/0 - step. Server motion delays persist; It's not a speed multiplier.
int: 7 — step is confirmed or only a turn is performed; 5 — the server rejected the step; 4 — confirmation timed out (up to 10000 ms); 3 — step blocked by the client; 2 — queue is full; 0 - general failure, shutdown or insufficient endurance. This is not true/false: for example, a non-zero code 5 means failure.
- One team can rotate the character first; this does not necessarily mean moving to the next square.
- moveCheckStamina, moveExitOnDisconnect and moveOpenDoor are taken into account. Server ban and local ban are different.
- Do not repeat the command in a loop without analyzing the result and UO.Wait: The motion queue and server speed are limited.
- QueueStep on the game thread checks the player, connection, direction, queue, tempo and local traffic. Before Player.Walk, each call separately records the Confirm/Deny generations of its sequence and Walker; then returns Result along with this snapshot. Step and pending StepControlled check only this stored pair, not the general fields of the next request; the replacement player/Walker ends the wait with a general refusal. Confirmation of another regular command does not confirm this step. Rotation without movement remains a separate case.
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.Step(2, false);
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- Direction=2 — E, Running=false — step.
- The exact code 7 is checked; To confirm the movement, compare X/Y before and after.
var result = UO.Step(2, false);
if (Truth(result == 7))
{
UO.Print("Step accepted or turn completed");
}
else
{
UO.Print("Movement status: " + Convert.ToString(result));
}
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:
- Direction=0 — N. Coordinates are read before and after the call.
- An unchanged position is possible upon rotation or failure, so result is needed separately.
return RunScenario();
object? RunScenario()
{
var x = UO.GetX();
var y = UO.GetY();
var result = UO.Step(0, false);
if (Truth(UO.GetX() == x) && Truth(UO.GetY() == y))
{
UO.Print("Position unchanged; status=" + Convert.ToString(result));
}
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:
- Direction=4 — S, Running=true.
- Code 5—server failure. UO.Wait=250 ms specifies a pause for the script and does not guarantee that the next attempt will be successful.
Minimum step interval: walking - walking 400 ms, running 200 ms; riding - walking 200 ms, running 100 ms.
These are standard client limits, not automatically defined settings for your shard. Server speed and flight modes are counted separately. Script timers can slow down movement, but do not reduce these limits.
Steps, Routes, Follow, Mouse/Key Controls, and Map all use the character's shared queue. Replacing the route, turning, or adjusting the position by the server does not cancel the remaining pause after the step request. After the delay, there is no fast burst to compensate for the dropped frames. Waiting for confirmation, obstacles and poor communication can slow down the movement.
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 result = UO.Step(4, true);
if (Truth(result == 5))
{
UO.Print("Server denied the step");
await Delay(250);
}
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: direction (Any), running (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.IsOnline:bridge.IsOnline(). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.OpenDoor:bridge.OpenDoor(). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Step:bridge.Step(Arg(0) & 7, Arg(1) != 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 "step":
if (state.MoveExitOnDisconnect != 0 && bridge.IsOnline() == 0)
return new InjectionValue(0);
if (state.MoveCheckStamina > 0 && bridge.Stamina < state.MoveCheckStamina)
return new InjectionValue(0);
if (state.MoveOpenDoor != 0)
bridge.OpenDoor();
return new InjectionValue(bridge.Step(Arg(0) & 7, Arg(1) != 0));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.StepQ(object? direction, object? run);
int UO.StepQ(object? direction, object? run, object? timeout);
int UO.StepQ(object? direction, object? run, object? timeout, object? queue);
int UO.StepQ(object? direction, object? run, object? timeout, object? queue, object? waitForAck);Requests one step through the queue; the additional form may wait for the queue to become free and to be confirmed.
-
direction— Direction 0=N, 1=NE, 2=E, 3=SE, 4=S, 5=SW, 6=W, 7=NW. The implementation applies a bitwise &7; use 0..7 for clarity. -
run- true/1 - run request, false/0 - step. Server motion delays persist; It's not a speed multiplier. -
timeout— Optional queue waiting time in ms. 0/negative does not wait for release; with waitForAck=true and timeout=0 confirmation is expected before 10000 ms. If the value is positive, waiting for confirmation receives a separate period of the same duration. -
queue— Optional flag, default true. false transmits forcePacket when requesting a step; does not override server restrictions or clear the accumulated queue. -
waitForAck- false/absent - return the result of the statement immediately. true — for the sent step, wait for confirmation/refusal.
int without waitForAck: 0..255 — sequence of the sent request, including valid 0; 256 - turn only; -2 — obstacle on the client; -1 - general failure/full queue/shutdown/endurance. With waitForAck=true: 7 - confirmation, 5 - server failure, 4 - timeout; -1/-2/256 retain the previous meaning. The number 7 in the form without waiting is a sequence, not a confirmation. Check specific numeric codes; if (result) for int in C# is not valid.
- One team can rotate the character first; this does not necessarily mean moving to the next square.
- moveCheckStamina, moveExitOnDisconnect and moveOpenDoor are taken into account. Server ban and local ban are different.
- Do not repeat the command in a loop without analyzing the result and UO.Wait: The motion queue and server speed are limited.
- Without waiting, the command does not confirm the position change. LastStepQUsedDoor indicates an attempt to open the door, not the result of the step.
- QueueStep on the game thread checks the player, connection, direction, queue, tempo and local traffic. Before Player.Walk, each call separately records the Confirm/Deny generations of its sequence and Walker; then returns Result along with this snapshot. Step and pending StepControlled check only this stored pair, not the general fields of the next request; the replacement player/Walker ends the wait with a general refusal. Confirmation of another regular command does not confirm this step. Rotation without movement remains a separate case.
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.StepQ(2, false);
UO.Print("StepQ: " + Convert.ToString(result));Parameters and execution flow:
- direction=2 — E, run=false. Two arguments means normal setting without waiting for confirmation.
- sequence=0 is a valid staging success; sequence=256 means rotation.
var sequence = UO.StepQ(2, false);
if (Truth(sequence >= 0) && Truth(sequence <= 255))
{
UO.Print("Queued sequence: " + Convert.ToString(sequence));
}
else
{
UO.Print("Queue status: " + Convert.ToString(sequence));
}
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:
- direction=4 — S, run=true, timeout=1500 ms. queue=true waitForAck=true.
- It may take up to two 1500 ms intervals to wait for a seat and then acknowledge. 256 requires separate consideration of rotation.
return RunScenario();
object? RunScenario()
{
var status = UO.StepQ(4, true, 1500, true, true);
if (Truth(status == 7))
{
UO.Print("Server confirmed");
}
else
{
UO.Print("Step status: " + Convert.ToString(status));
}
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:
- direction=6 — W, run=false; timeout=0 does not wait in line; queue=false requests forcePacket, waitForAck=false.
- ForcePacket does not give the right to go through the wall. For -2, calculate a different route instead of sending to the same cell again.
Minimum step interval: walking - walking 400 ms, running 200 ms; riding - walking 200 ms, running 100 ms.
These are standard client limits, not automatically defined settings for your shard. Server speed and flight modes are counted separately. Script timers can slow down movement, but do not reduce these limits.
Steps, Routes, Follow, Mouse/Key Controls, and Map all use the character's shared queue. Replacing the route, turning, or adjusting the position by the server does not cancel the remaining pause after the step request. After the delay, there is no fast burst to compensate for the dropped frames. Waiting for confirmation, obstacles and poor communication can slow down the movement.
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 status = UO.StepQ(6, false, 0, false, false);
if (Truth(status == -2))
{
UO.Print("Local obstacle; calculate another route");
}
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: direction (Any), run (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [StepQ]. -
InjectionScript.Runtime.InjectionApiUO.CompactStepQ:CompactStepQ(values).
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.
values => new InjectionValue(CompactStepQ(values))Parameters: direction (Any), run (Any), timeout (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [StepQ]. -
InjectionScript.Runtime.InjectionApiUO.CompactStepQ:CompactStepQ(values).
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.
values => new InjectionValue(CompactStepQ(values))Parameters: direction (Any), run (Any), timeout (Any), queue (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [StepQ]. -
InjectionScript.Runtime.InjectionApiUO.CompactStepQ:CompactStepQ(values).
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.
values => new InjectionValue(CompactStepQ(values))Parameters: direction (Any), run (Any), timeout (Any), queue (Any), waitForAck (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [StepQ]. -
InjectionScript.Runtime.InjectionApiUO.CompactStepQ:CompactStepQ(values).
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.
values => new InjectionValue(CompactStepQ(values))Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.moveBetweenTwoCorners();
dynamic UO.moveBetweenTwoCorners(object? value);Diagonal resolution with two side squares blocked.
-
value— Optional new value. 0 prohibits, non-zero becomes 1. The server may reject such a pass regardless of the client's configuration.
int is the current stored value. Without argument only reads; with an argument returns the value after applying the rules above. This is a setting, not a result of movement.
- The setting is stored in the runtime state and is used by the corresponding commands at startup; the change does not automatically overwrite the already built path.
- Returning the original value is shown for normal completion. After a crash, the following recovery lines are not executed.
- 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.moveBetweenTwoCorners();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- There are no arguments, the state does not change.
- value is the numeric value of this setting.
var value = UO.moveBetweenTwoCorners();
UO.Print(Convert.ToString(value));Parameters and execution flow:
- value=0. 0 prohibits, non-zero becomes 1. The server may reject such a pass regardless of the client's configuration.
- applied shows the saved value, not the successful achievement of the goal.
return RunScenario();
object? RunScenario()
{
var applied = UO.moveBetweenTwoCorners(0);
UO.Print("Applied: " + Convert.ToString(applied));
return null;
}Parameters and execution flow:
- previous stores the initial setting; NewMoveXY is limited to 3000 ms.
- The last command restores the setting after normal motion return.
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 previous = UO.moveBetweenTwoCorners();
UO.moveBetweenTwoCorners(0);
var ok = UO.NewMoveXY(UO.GetX() + 2, UO.GetY(), true, 0, false, 0, 3000);
UO.moveBetweenTwoCorners(previous);
UO.Print(Convert.ToString(ok));
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 "movebetweentwocorners":
if (arguments.Length > 0) state.MoveBetweenTwoCorners = Arg(0) != 0 ? 1 : 0;
return new InjectionValue(state.MoveBetweenTwoCorners);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 "movebetweentwocorners":
if (arguments.Length > 0) state.MoveBetweenTwoCorners = Arg(0) != 0 ? 1 : 0;
return new InjectionValue(state.MoveBetweenTwoCorners);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.moveCheckStamina();
dynamic UO.moveCheckStamina(object? value);Minimum stamina for movement commands.
-
value— Optional new value. Integer >=0; the negative becomes 0. Zero turns off the threshold check.
int is the current stored value. Without argument only reads; with an argument returns the value after applying the rules above. This is a setting, not a result of movement.
- The setting is stored in the runtime state and is used by the corresponding commands at startup; the change does not automatically overwrite the already built path.
- Returning the original value is shown for normal completion. After a crash, the following recovery lines are not executed.
- Default is 1. The value 0 disables this local check; positive sets the minimum endurance. Below the threshold, the launch is rejected or movement is stopped rather than waiting for stamina to be restored.
- 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.moveCheckStamina();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- There are no arguments, the state does not change.
- value is the numeric value of this setting.
var value = UO.moveCheckStamina();
UO.Print(Convert.ToString(value));Parameters and execution flow:
- value=15. Integer >=0; the negative becomes 0. Zero turns off the threshold check.
- applied shows the saved value, not the successful achievement of the goal.
return RunScenario();
object? RunScenario()
{
var applied = UO.moveCheckStamina(15);
UO.Print("Applied: " + Convert.ToString(applied));
return null;
}Parameters and execution flow:
- previous stores the initial setting; NewMoveXY is limited to 3000 ms.
- The last command restores the setting after normal motion return.
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 previous = UO.moveCheckStamina();
UO.moveCheckStamina(15);
var ok = UO.NewMoveXY(UO.GetX() + 2, UO.GetY(), true, 0, false, 0, 3000);
UO.moveCheckStamina(previous);
UO.Print(Convert.ToString(ok));
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 "movecheckstamina": if (arguments.Length > 0) state.MoveCheckStamina = Math.Max(0, Arg(0)); return new InjectionValue(state.MoveCheckStamina);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 "movecheckstamina": if (arguments.Length > 0) state.MoveCheckStamina = Math.Max(0, Arg(0)); return new InjectionValue(state.MoveCheckStamina);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.moveExitOnDisconnect();
dynamic UO.moveExitOnDisconnect(object? value);Stop/refuse movement when the connection is disconnected.
-
value— Optional new value. 0 turns off, non-zero becomes 1. Disabling verification prevents you from moving on the server without a connection.
int is the current stored value. Without argument only reads; with an argument returns the value after applying the rules above. This is a setting, not a result of movement.
- The setting is stored in the runtime state and is used by the corresponding commands at startup; the change does not automatically overwrite the already built path.
- Returning the original value is shown for normal completion. After a crash, the following recovery lines are not executed.
- 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.moveExitOnDisconnect();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- There are no arguments, the state does not change.
- value is the numeric value of this setting.
var value = UO.moveExitOnDisconnect();
UO.Print(Convert.ToString(value));Parameters and execution flow:
- value=1. 0 turns off, non-zero becomes 1. Disabling verification prevents you from moving on the server without a connection.
- applied shows the saved value, not the successful achievement of the goal.
return RunScenario();
object? RunScenario()
{
var applied = UO.moveExitOnDisconnect(1);
UO.Print("Applied: " + Convert.ToString(applied));
return null;
}Parameters and execution flow:
- previous stores the initial setting; NewMoveXY is limited to 3000 ms.
- The last command restores the setting after normal motion return.
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 previous = UO.moveExitOnDisconnect();
UO.moveExitOnDisconnect(1);
var ok = UO.NewMoveXY(UO.GetX() + 2, UO.GetY(), true, 0, false, 0, 3000);
UO.moveExitOnDisconnect(previous);
UO.Print(Convert.ToString(ok));
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 "moveexitondisconnect": if (arguments.Length > 0) state.MoveExitOnDisconnect = Arg(0) != 0 ? 1 : 0; return new InjectionValue(state.MoveExitOnDisconnect);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 "moveexitondisconnect": if (arguments.Length > 0) state.MoveExitOnDisconnect = Arg(0) != 0 ? 1 : 0; return new InjectionValue(state.MoveExitOnDisconnect);In a new script context, UO.moveHeuristicMult() is 120 and UO.moveTurnCost() is 14. An explicit value set by the script is retained for its following movement commands. Multiplier 100 uses the ordinary diagonal-aware distance estimate; a higher multiplier usually speeds up searching but does not guarantee the shortest route. A lower value can substantially increase calculation time. Turn cost 0 disables the extra penalty for changing direction. These settings affect route search, rather than character speed or the UO.LimitMove bound.
int previousHeuristic = (int)UO.moveHeuristicMult();
int previousTurnCost = (int)UO.moveTurnCost();
try
{
UO.moveHeuristicMult(120);
UO.moveTurnCost(14);
UO.Print($"Heuristic: {UO.moveHeuristicMult()}, turn cost: {UO.moveTurnCost()}");
}
finally
{
UO.moveHeuristicMult(previousHeuristic);
UO.moveTurnCost(previousTurnCost);
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.moveHeuristicMult();
dynamic UO.moveHeuristicMult(object? value);Pathfinder heuristic multiplier as a percentage.
-
value— Optional new value. Integer >=0 is preserved; before searching at least 1. The 100 value corresponds to the usual estimate; >100 may prefer a faster search without a minimum cost guarantee. When Optimized=false, 1 is used.
int is the current stored value. Without argument only reads; with an argument returns the value after applying the rules above. This is a setting, not a result of movement.
- The setting is stored in the runtime state and is used by the corresponding commands at startup; the change does not automatically overwrite the already built path.
- Returning the original value is shown for normal completion. After a crash, the following recovery lines are not executed.
- 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.moveHeuristicMult();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- There are no arguments, the state does not change.
- value is the numeric value of this setting.
var value = UO.moveHeuristicMult();
UO.Print(Convert.ToString(value));Parameters and execution flow:
- value=100. Integer >=0 is preserved; before searching at least 1. The 100 value corresponds to the usual estimate; >100 may prefer a faster search without a minimum cost guarantee. When Optimized=false, 1 is used.
- applied shows the saved value, not the successful achievement of the goal.
return RunScenario();
object? RunScenario()
{
var applied = UO.moveHeuristicMult(100);
UO.Print("Applied: " + Convert.ToString(applied));
return null;
}Parameters and execution flow:
- previous stores the initial setting; NewMoveXY is limited to 3000 ms.
- The last command restores the setting after normal motion return.
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 previous = UO.moveHeuristicMult();
UO.moveHeuristicMult(100);
var ok = UO.NewMoveXY(UO.GetX() + 2, UO.GetY(), true, 0, false, 0, 3000);
UO.moveHeuristicMult(previous);
UO.Print(Convert.ToString(ok));
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 "moveheuristicmult": if (arguments.Length > 0) state.MoveHeuristicMultiplier = Math.Max(0, Arg(0)); return new InjectionValue(state.MoveHeuristicMultiplier);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 "moveheuristicmult": if (arguments.Length > 0) state.MoveHeuristicMultiplier = Math.Max(0, Arg(0)); return new InjectionValue(state.MoveHeuristicMultiplier);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.moveOpenDoor();
dynamic UO.moveOpenDoor(object? value);Attempts to open doors in the direction of travel.
-
value— Optional new value. 0 turns off, non-zero becomes 1. An explicit openDoors in NewMoveXY/MoveXYZ replaces this flag for the duration of the call.
int is the current stored value. Without argument only reads; with an argument returns the value after applying the rules above. This is a setting, not a result of movement.
- The setting is stored in the runtime state and is used by the corresponding commands at startup; the change does not automatically overwrite the already built path.
- Returning the original value is shown for normal completion. After a crash, the following recovery lines are not executed.
- Default is 0. At 1 the door cells are considered passable during A*; an attempt to open a specific adjacent door is made before the step. If there is no known door object, the OpenDoor query is used.
- This flag does not close the door itself. Closing a door opened by a character is a separate client setting; a locked door or server ban can disrupt the route.
- 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.moveOpenDoor();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- There are no arguments, the state does not change.
- value is the numeric value of this setting.
var value = UO.moveOpenDoor();
UO.Print(Convert.ToString(value));Parameters and execution flow:
- value=1. 0 turns off, non-zero becomes 1. An explicit openDoors in NewMoveXY/MoveXYZ replaces this flag for the duration of the call.
- applied shows the saved value, not the successful achievement of the goal.
return RunScenario();
object? RunScenario()
{
var applied = UO.moveOpenDoor(1);
UO.Print("Applied: " + Convert.ToString(applied));
return null;
}Parameters and execution flow:
- previous stores the initial setting; NewMoveXY is limited to 3000 ms.
- The last command restores the setting after normal motion return.
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 previous = UO.moveOpenDoor();
UO.moveOpenDoor(1);
var ok = UO.NewMoveXY(UO.GetX() + 2, UO.GetY(), true, 0, false, 0, 3000);
UO.moveOpenDoor(previous);
UO.Print(Convert.ToString(ok));
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 "moveopendoor": if (arguments.Length > 0) state.MoveOpenDoor = Arg(0) != 0 ? 1 : 0; return new InjectionValue(state.MoveOpenDoor);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 "moveopendoor": if (arguments.Length > 0) state.MoveOpenDoor = Arg(0) != 0 ? 1 : 0; return new InjectionValue(state.MoveOpenDoor);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.moveThroughCorner();
dynamic UO.moveThroughCorner(object? value);Resolution of the diagonal between cells with one side cell blocked.
-
value— Optional new value. 0 prohibits, non-zero becomes 1. If both side squares are blocked, moveBetweenTwoCorners is applied.
int is the current stored value. Without argument only reads; with an argument returns the value after applying the rules above. This is a setting, not a result of movement.
- The setting is stored in the runtime state and is used by the corresponding commands at startup; the change does not automatically overwrite the already built path.
- Returning the original value is shown for normal completion. After a crash, the following recovery lines are not executed.
- 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.moveThroughCorner();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- There are no arguments, the state does not change.
- value is the numeric value of this setting.
var value = UO.moveThroughCorner();
UO.Print(Convert.ToString(value));Parameters and execution flow:
- value=0. 0 prohibits, non-zero becomes 1. If both side squares are blocked, moveBetweenTwoCorners is applied.
- applied shows the saved value, not the successful achievement of the goal.
return RunScenario();
object? RunScenario()
{
var applied = UO.moveThroughCorner(0);
UO.Print("Applied: " + Convert.ToString(applied));
return null;
}Parameters and execution flow:
- previous stores the initial setting; NewMoveXY is limited to 3000 ms.
- The last command restores the setting after normal motion return.
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 previous = UO.moveThroughCorner();
UO.moveThroughCorner(0);
var ok = UO.NewMoveXY(UO.GetX() + 2, UO.GetY(), true, 0, false, 0, 3000);
UO.moveThroughCorner(previous);
UO.Print(Convert.ToString(ok));
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 "movethroughcorner": if (arguments.Length > 0) state.MoveThroughCorner = Arg(0) != 0 ? 1 : 0; return new InjectionValue(state.MoveThroughCorner);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 "movethroughcorner": if (arguments.Length > 0) state.MoveThroughCorner = Arg(0) != 0 ? 1 : 0; return new InjectionValue(state.MoveThroughCorner);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.moveThroughNPC();
dynamic UO.moveThroughNPC(object? value);Allowing attempts to pass through characters.
- Numeric stamina threshold: attempting to push through a character is allowed when current Stamina >= threshold. Default 1000; 0 permits the attempt regardless of stamina. The server may still reject the move.
int is the current stored value. Without argument only reads; with an argument returns the value after applying the rules above. This is a setting, not a result of movement.
- The setting is stored in the runtime state and is used by the corresponding commands at startup; the change does not automatically overwrite the already built path.
- Returning the original value is shown for normal completion. After a crash, the following recovery lines are not executed.
- Numeric stamina threshold: attempting to push through a character is allowed when current Stamina >= threshold. Default 1000; 0 permits the attempt regardless of stamina. The server may still reject the move.
- 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.moveThroughNPC();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- There are no arguments, the state does not change.
- value is the numeric value of this setting.
var value = UO.moveThroughNPC();
UO.Print(Convert.ToString(value));Parameters and execution flow:
- value=0. Integer >=0, negative becomes 0; positive permits the attempt. An explicit avoidMobiles specifies the reverse constraint for a single call.
- applied shows the saved value, not the successful achievement of the goal.
return RunScenario();
object? RunScenario()
{
var applied = UO.moveThroughNPC(0);
UO.Print("Applied: " + Convert.ToString(applied));
return null;
}Parameters and execution flow:
- previous stores the initial setting; NewMoveXY is limited to 3000 ms.
- The last command restores the setting after normal motion return.
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 previous = UO.moveThroughNPC();
UO.moveThroughNPC(0);
var ok = UO.NewMoveXY(UO.GetX() + 2, UO.GetY(), true, 0, false, 0, 3000);
UO.moveThroughNPC(previous);
UO.Print(Convert.ToString(ok));
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 "movethroughnpc": if (arguments.Length > 0) state.MoveThroughNpc = Math.Max(0, Arg(0)); return new InjectionValue(state.MoveThroughNpc);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 "movethroughnpc": if (arguments.Length > 0) state.MoveThroughNpc = Math.Max(0, Arg(0)); return new InjectionValue(state.MoveThroughNpc);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.moveTurnCost();
dynamic UO.moveTurnCost(object? value);Additional cost of changing direction when finding a path.
-
value— Optional new value. Integer >=0, negative becomes 0. This is the weight of the route, not milliseconds: a straight step costs 10, a diagonal one 14, and this is an addition per turn.
int is the current stored value. Without argument only reads; with an argument returns the value after applying the rules above. This is a setting, not a result of movement.
- The setting is stored in the runtime state and is used by the corresponding commands at startup; the change does not automatically overwrite the already built path.
- Returning the original value is shown for normal completion. After a crash, the following recovery lines are not executed.
- 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.moveTurnCost();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- There are no arguments, the state does not change.
- value is the numeric value of this setting.
var value = UO.moveTurnCost();
UO.Print(Convert.ToString(value));Parameters and execution flow:
- value=14. Integer >=0, negative becomes 0. This is the weight of the route, not milliseconds: a straight step costs 10, a diagonal one 14, and this is an addition per turn.
- applied shows the saved value, not the successful achievement of the goal.
return RunScenario();
object? RunScenario()
{
var applied = UO.moveTurnCost(14);
UO.Print("Applied: " + Convert.ToString(applied));
return null;
}Parameters and execution flow:
- previous stores the initial setting; NewMoveXY is limited to 3000 ms.
- The last command restores the setting after normal motion return.
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 previous = UO.moveTurnCost();
UO.moveTurnCost(14);
var ok = UO.NewMoveXY(UO.GetX() + 2, UO.GetY(), true, 0, false, 0, 3000);
UO.moveTurnCost(previous);
UO.Print(Convert.ToString(ok));
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 "moveturncost": if (arguments.Length > 0) state.MoveTurnCost = Math.Max(0, Arg(0)); return new InjectionValue(state.MoveTurnCost);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 "moveturncost": if (arguments.Length > 0) state.MoveTurnCost = Math.Max(0, Arg(0)); return new InjectionValue(state.MoveTurnCost);UO.LimitMove — Movement distance limit. UO.LimitMove controls destination distance: default 2000, zero unlimited. There are no hidden 4096-step/node or 10000-node caps. Work is sliced and can be stopped. GetPathArray respects the numeric moveThroughNPC stamina threshold and moveOpenDoor.
ClassicUO — Bad Newbie & C# Scripts IDE