Sailing API
Control player-owned boats, inspect sailing state, and interact with sailing-specific actions.
Constants
BoatType
sailing.BoatType.RAFT
sailing.BoatType.SKIFF
sailing.BoatType.SLOOP
sailing.BoatType.WILL_ANNE
MoveMode
sailing.MoveMode.STATIONARY
sailing.MoveMode.MOVING_FORWARD
sailing.MoveMode.REVERSING
Heading
sailing.Heading provides the 16-way sailing headings, for example:
sailing.Heading.NORTH
sailing.Heading.NORTH_EAST
sailing.Heading.WEST_SOUTH_WEST
sailing.Heading.SOUTH_SOUTH_EAST
Functions
on_boat
sailing:on_boat() -> boolean
Returns:
boolean- True when the local player is currently on their boat.
at_sails
sailing:at_sails() -> boolean
Returns:
boolean- True when the player is positioned at the sails.
navigating
sailing:navigating() -> boolean
Returns:
boolean- True when the player is actively navigating at the helm.
boat_type
sailing:boat_type() -> string
Returns:
string- One of thesailing.BoatType.*values.
move_mode
sailing:move_mode() -> string | nil
Returns:
string | nil- One of thesailing.MoveMode.*values, or nil if unavailable.
stationary
sailing:stationary() -> boolean
Returns:
boolean- True if the boat is stationary.
moving_forward
sailing:moving_forward() -> boolean
Returns:
boolean- True if the boat is moving forward.
reversing
sailing:reversing() -> boolean
Returns:
boolean- True if the boat is reversing.
current_heading
sailing:current_heading() -> string | nil
Returns:
string | nil- Current heading assailing.Heading.*, or nil if unknown.
direction
sailing:direction(x: number, y: number, floor: number) -> string
Calculates the closest sailing.Heading.* from the current boat position toward a target tile.
Example:
local heading = sailing:direction(3020, 3105, 0)
if heading == sailing.Heading.NORTH_EAST then
logger:info("Need to head northeast")
end
angle
sailing:angle() -> number | nil
Returns:
number | nil- Current boat angle in degrees, or nil.
board_boat
sailing:board_boat() -> boolean
Boards the boat through a nearby gangplank.
Returns:
boolean- True if successful.
disembark_boat
sailing:disembark_boat() -> boolean
Leaves the boat through a nearby gangplank.
Returns:
boolean- True if successful.
navigate
sailing:navigate() -> boolean
Moves the player to the helm and enters navigation mode.
Returns:
boolean- True if successful.
stop_navigating
sailing:stop_navigating() -> boolean
Stops navigating at the helm.
Returns:
boolean- True if successful.
set_sails
sailing:set_sails() -> boolean
Sets the sails and waits for the boat to begin moving forward.
Returns:
boolean- True if successful.
unset_sails
sailing:unset_sails() -> boolean
Unsets the sails and waits for the boat to stop.
Returns:
boolean- True if successful.
reverse
sailing:reverse() -> boolean
Reverses the boat.
Returns:
boolean- True if successful.
trim_sails
sailing:trim_sails() -> boolean
Trims sails for Sailing XP.
Returns:
boolean- True if successful.
open_cargo
sailing:open_cargo() -> boolean
Opens the boat's cargo hold.
Returns:
boolean- True if successful.
get_port_tasks
sailing:get_port_tasks() -> table
Returns:
table- Array of active port task entries. Each entry includesslot,value, andtask_type.
Common Patterns
Start Sailing Forward
if sailing:on_boat() and not sailing:navigating() then
sailing:navigate()
end
if sailing:navigating() and not sailing:moving_forward() then
sailing:set_sails()
end
Reverse Cleanly
if sailing:navigating() and not sailing:reversing() then
if sailing:reverse() then
logger:info("Boat is reversing")
end
end
Inspect Heading and Mode
local move_mode = sailing:move_mode()
local heading = sailing:current_heading()
logger:info("Move mode: " .. tostring(move_mode))
logger:info("Heading: " .. tostring(heading))
Related APIs
- API Overview — Module index (open the sailing tab in the client when needed)
- Skills API — Sailing XP and levels
- Game Objects API — Lower-level world object interaction