Repository navigation
EN API UO Move
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.Move();Reads the character’s current movement on the client map.
There are no parameters.
Returns an integer. 1 indicates a step to another tile. 0 indicates standing still, turning in place, or waiting for route calculation.
The script editor supports UO.Move() == 1 and UO.Move() == true for movement, and UO.Move() == 0 and UO.Move() == false for standing still.
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 command only reads the state. If the result is non-zero, the compatible timer TicksAnim is updated. Steps requested by mouse/keys are also counted while they remain in the queue.
- To stop the automatic route, use MoverStop. MoveOff controls other, keyboard steps.
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.Move();
UO.Print("Move: " + Convert.ToString(result));Parameters and execution flow:
- There are no arguments.
- 0 does not prove that the goal was achieved: the route could have been cancelled.
UO.Print("Movement active or queued: " + Convert.ToString(UO.Move()));Parameters and execution flow:
- 100 waits over 50 ms set the approximate limit of 5 seconds.
- Performing this check does not itself start or stop movement.
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var attempts = 0;
while (Truth(UO.Move()) && Truth(attempts < 100))
{
await Delay(50);
attempts = attempts + 1;
}
UO.Print("Still moving: " + Convert.ToString(UO.Move()));
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:
- Move() checks for activity, MoverStop() removes the route.
- Already sent packets can still be confirmed by the server.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
if (Truth(UO.Move()))
{
UO.MoverStop();
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Move. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Move:bridge.Move(). -
InjectionScript.Runtime.InjectionApiUO.Timer:Timer().
Internal implementation code; this is not a standalone script.
public int Move()
{
int result = bridge.Move();
if (result != 0)
ticksAnim = Timer();
return result;
}ClassicUO — Bad Newbie & C# Scripts IDE