Gerakan
client:setPoint(point, teleport?)
| Field | Type |
|---|---|
| Signature | (self: Client, point: Vec2i, teleport: boolean?) → string? |
| Returns | string? — nil kalau gerakan kelar; kode Errors.* kalau gagal |
| Common errors | Errors.NOT_IN_WORLD, Errors.CANCELLED, Errors.DISCONNECTED |
| Async | yes |
teleport=true ngirim mP{tp:true} langsung (server bisa nolak + snap balik). Default-nya jalan A* + walk interpolasi dan blok sampai gerakan kelar.
client:setPosition(pos, teleport?)
| Field | Type |
|---|---|
| Signature | (self: Client, pos: Vec2, teleport: boolean?) → string? |
| Returns | string? — nil kalau sukses |
| Common errors | Errors.NOT_IN_WORLD, Errors.CANCELLED, Errors.DISCONNECTED |
| Async | yes |
Sama kayak setPoint tapi terima koordinat dunia (sub-tile precision) bukan koordinat tile.
client:movePoint(delta)
| Field | Type |
|---|---|
| Signature | (self: Client, delta: Vec2i) → string? |
| Returns | string? — nil kalau sukses |
| Async | yes |
client:movePosition(delta)
| Field | Type |
|---|---|
| Signature | (self: Client, delta: Vec2) → string? |
| Returns | string? — nil kalau sukses |
| Async | yes |
local point = Vector2i.new(40, 30)
local size = Vector2.new(0.16, 0.32)
-- Teleport / set absolut
client:setPosition(point:position(size), true) -- arg ke-2 = flag teleport
client:setPoint(point, false)
-- Relatif
client:movePoint(Vector2i.new(0, 1)) -- naik satu tile
client:movePoint(Vector2i.new(1, 0)) -- kanan satu tile
client:movePosition(Vector2.new(0.16, 0)) -- kanan setengah tile
client:movePosition(Vector2.new(0, -0.01)) -- turun 1/32 tile
Pathfinding
client:getPath(point)
| Field | Type |
|---|---|
| Signature | (self: Client, point: Vec2i) → {Vec2i}? |
| Returns | Tabel 1-indexed berisi titik {x, y} di sepanjang rute. Kosong kalau path nggak ketemu |
| Async | yes |
Hitung path tanpa jalan beneran.
client:findPath(point)
| Field | Type |
|---|---|
| Signature | (self: Client, point: Vec2i) → string? |
| Returns | boolean — true kalau task walk udah jalan, false kalau tile awal bot belum diketahui |
| Async | yes |
Tendang walk A*; balik instan. Polling pathfinding() sampai false.
client:pathfinding()
| Field | Type |
|---|---|
| Signature | (self: Client) → boolean |
| Returns | boolean — true selama task walk lagi jalan |
| Async | no |
client:clearPath()
| Field | Type |
|---|---|
| Signature | (self: Client) → () |
| Returns | nothing — abort walk yang lagi jalan |
| Async | no |
local ok = client:findPath(Vector2i.new(5, 3))
while ok and client:pathfinding() do
sleep(100)
end
Lokasi
client:point()
| Field | Type |
|---|---|
| Signature | (self: Client) → Vec2i |
| Returns | Vec2i — tile peta sekarang |
| Async | yes |
client:position()
| Field | Type |
|---|---|
| Signature | (self: Client) → Vec2 |
| Returns | Vec2 — posisi dunia sekarang (sub-tile precision) |
| Async | yes |
client:navigation()
| Field | Type |
|---|---|
| Signature | (self: Client) → string? |
| Returns | string? — "EXIT" di menu, nama dunia kalau in-world, nil buat state transisi / terminal |
| Async | yes |