EN UO Topic boats - LIHACHTETAN/ClassicUO-Bad-Newbie-CSharp-Scripts-IDE GitHub Wiki
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
Home · C# · IDE · UO API · A–Z · Examples · Languages
Controlling the movement and stopping of the boat; Team availability is determined by the current boat and server.
| Topic | Commands and explanations |
|---|---|
| MoveBoat | UO.MoveBoat |
| StopBoat | UO.StopBoat |
Each command card has several independent scenarios: direct code, functions and classes. Below are selected short scenarios; restrictions and full analysis are in the cards.
Parameters, result and all scenarios
UO.MoveBoat(0, 1);Parameters, result and all scenarios
UO.StopBoat();Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.MoveBoat(object? direction, object? speed);Requests the direction and speed of the boat.
-
direction- int, low 3 bits specify the direction 0..7: N,NE,E,SE,S,SW,W,NW. -
speed- int, limited to 0..255 and reduced to byte; 0—stop request. Protocol code, not speed in cells/second.
void - no value. Call on a separate line; completion does not confirm the server's action.
- Bridge.MoveBoat calls BoatMovingManager.MoveRequest((Direction)(direction&7), clamp(speed,0,255)). The current boat and control rights are determined by the client/server.
- Does not move the character through Pathfinder, does not wait for a step, and does not return boat coordinates. The server may reject 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.MoveBoat");
UO.MoveBoat(0, 1);Parameters and execution flow:
- Requests the direction and speed of the boat.
UO.MoveBoat(0, 1);Parameters and execution flow:
- Bridge.MoveBoat calls BoatMovingManager.MoveRequest((Direction)(direction&7), clamp(speed,0,255)). The current boat and control rights are determined by the client/server.
return RunScenario();
object? RunScenario()
{
UO.MoveBoat(2, 1);
UO.Wait(500);
UO.StopBoat();
return null;
}Parameters and execution flow:
- Does not move the character through Pathfinder, does not wait for a step, and does not return boat coordinates. The server may reject 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.MoveBoat(0, 0);
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: direction (Any), speed (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.MoveBoat:bridge.MoveBoat(Arg(0), Arg(1)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "moveboat": bridge.MoveBoat(Arg(0), Arg(1)); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.StopBoat();Requests the boat to stop moving.
There are no parameters.
void - no value. Call on a separate line; completion does not confirm the server's action.
- StopBoat calls BoatMovingManager.MoveRequest with Player.Direction (or North without Player) and speed=0. The request does not return the server position of the boat.
- 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.StopBoat");
UO.StopBoat();Parameters and execution flow:
- Requests the boat to stop moving.
UO.StopBoat();Parameters and execution flow:
- StopBoat calls BoatMovingManager.MoveRequest with Player.Direction (or North without Player) and speed=0. The request does not return the server position of the boat.
return RunScenario();
object? RunScenario()
{
if (Truth(UO.IsOnline()))
{
UO.StopBoat();
}
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.StopBoat();
UO.Wait(250);
UO.Print(UO.GetX());
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.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.StopBoat:bridge.StopBoat().
Internal implementation code; this is not a standalone script.
case "stopboat": bridge.StopBoat(); return InjectionValue.Unit;