EN UO Topic boats - LIHACHTETAN/ClassicUO-Bad-Newbie-CSharp-Scripts-IDE GitHub Wiki

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

Boats

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.

Sections

Topic Commands and explanations
MoveBoat UO.MoveBoat
StopBoat UO.StopBoat

All theme commands

Boat Control

UO.MoveBoat · UO.StopBoat

Examples on the topic

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.

UO.MoveBoat

Parameters, result and all scenarios

UO.MoveBoat(0, 1);

UO.StopBoat

Parameters, result and all scenarios

UO.StopBoat();

Complete command reference


UO.MoveBoat

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

void UO.MoveBoat(object? direction, object? speed);

Requests the direction and speed of the boat.

Parameters

  • 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.

Return value

void - no value. Call on a separate line; completion does not confirm the server's action.

Behavior

  • 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.

Standalone C# scripts

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.

Simple example

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);

1. Direct call - direct script

Parameters and execution flow:

  • Requests the direction and speed of the boat.
UO.MoveBoat(0, 1);

2. Explicit option - script function

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;
}

3. Full Helper Function - Script Class

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;
    }
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.MoveBoat(direction, speed) — UO.MoveBoat(Any,Any)

Parameters: direction (Any), speed (Any)

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "moveboat": bridge.MoveBoat(Arg(0), Arg(1)); return InjectionValue.Unit;

UO.StopBoat

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C# signatures

void UO.StopBoat();

Requests the boat to stop moving.

Parameters

There are no parameters.

Return value

void - no value. Call on a separate line; completion does not confirm the server's action.

Behavior

  • 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.

Standalone C# scripts

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.

Simple example

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();

1. Direct call - direct script

Parameters and execution flow:

  • Requests the boat to stop moving.
UO.StopBoat();

2. Explicit option - script function

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;

3. Full Helper Function - Script Class

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;
    }
}

Command implementation

C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.

UO.StopBoat() — UO.StopBoat()

Parameters: No parameters.

Result: void / Unit.

During a call:

Internal implementation code; this is not a standalone script.

case "stopboat": bridge.StopBoat(); return InjectionValue.Unit;
⚠️ **GitHub.com Fallback** ⚠️