Skip to content

function getNearestWaypoint

This function is used to retrieve the information about nearest waypoint from the specified position.
Original: getNearestWaypoint

Declaration

async def getNearestWaypoint(world : str, x : int, y : int, z : int) -> Optional[tuple]

Parameters

str world: the world name in which the waypoint exists.
int x: the position in the world on the x axis.
int y: the position in the world on the y axis.
int z: the position in the world on the z axis.

Returns

tuple (name, x, y, z): Waypoint information.

Source code in src/pyg2o/functions/waypoint.py
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
async def getNearestWaypoint(world : str, x : int, y : int, z : int, distance: int = -1) -> Optional[tuple]:
    """
    This function is used to retrieve the information about nearest waypoint from the specified position.
    Original: [getNearestWaypoint](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/waypoint/getNearestWaypoint/)

    ## Declaration
    ```python
    async def getNearestWaypoint(world : str, x : int, y : int, z : int) -> Optional[tuple]
    ```
    ## Parameters
    `str` **world**: the world name in which the waypoint exists.
    `int` **x**: the position in the world on the x axis.
    `int` **y**: the position in the world on the y axis.
    `int` **z**: the position in the world on the z axis.
    ## Returns
    `tuple (name, x, y, z)`: Waypoint information.
    """
    data = f'return {get_call_repr()}'

    server = await PythonWebsocketServer.get_server()
    result = await server.make_request(data)
    return (result['name'], result['x'], result['y'], result['z']) if result is not None else (None, None, None)