EN API UO LimitMove - LIHACHTETAN/ClassicUO-Bad-Newbie-CSharp-Scripts-IDE GitHub Wiki
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
UO.LimitMove
int UO.LimitMove();
int UO.LimitMove(object? distance);
UO.LimitMove() returns the maximum tile distance to a destination; UO.LimitMove(distance) changes it and returns the new value. The initial value is 2000. Zero disables the distance bound; negative values raise an error without changing the setting.
Distance is max(abs(targetX-startX), abs(targetY-startY)). This measures the specified destination, not the length of a detour. Explicit maxDistance, maxSteps and timeout arguments still apply.
The bound covers MoveXY, MoveXYZ, Follow, GetPathArray/GetPathArray3D and movement from the Manager map. Map access works with or without a game window; movement requires an active game session. Unlimited distance does not permit crossing walls or changing facets.
The setting belongs to this script execution. A new run copies the independent engine/chat defaults once, not the graphical Profile. A script setter changes neither the GUI nor other runs already executing. Named objects, types, equipment sets, Ignore lists and globals deliberately retain their documented shared scope.
A standalone chat command changes the lasting engine context: later commands read that value and new runs copy it. Existing runs keep their own values. Chat automation has its own controller and keeps operating after the command returns; GUI automation uses separate settings.
See execution state and gameplay settings.
Examples
int previousLimit = UO.LimitMove();
UO.LimitMove(2000);
UO.Print(UO.LimitMove().ToString());
int previousLimit = UO.LimitMove();
try
{
UO.LimitMove(6000);
var route = UO.GetPathArray(5000, 1500, true, 1);
UO.Print(route.Length.ToString());
}
finally
{
UO.LimitMove(previousLimit);
}
Internal routines
InjectionRuntimeState.LimitMove → InjectionApiUO.MoveToCanonical / BuildPortablePath → ClassicUOInjectionApiBridge.MoveTo → Pathfinder.WalkTo. NativeFollowController / WorldMapController → Pathfinder.WalkTo.
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.
int savedLimit = UO.LimitMove();
try
{
int applied = ApplyLimit(6000);
UO.Print(applied.ToString());
}
finally { UO.LimitMove(savedLimit); }
int ApplyLimit(int distance)
{
if (distance < 0) throw new ArgumentOutOfRangeException(nameof(distance));
return UO.LimitMove(distance);
}
UO.Print(new MovementLimits(UO).Current().ToString());
class MovementLimits(ClassicUO.CSharp.CSharpGameApi api)
{
public int Current() => api.LimitMove();
}