Warp & Lookup Dunia
client:warp(name, special?)
| Field | Type |
|---|---|
| Signature | (self: Client, name: string, special: boolean?) → string? |
| Returns | string? — nil saat sampai Status.IN_WORLD, kode Errors.* kalau gagal |
| Common errors | Errors.WORLD_FULL, Errors.INVALID_WORLD, Errors.WORLD_NOT_FOUND, Errors.TIMEOUT, Errors.DISCONNECTED, Errors.TUTORIAL_BUSY |
| Async | yes |
special=true buat dunia instanced (keluarga NETHER/MINES/MINEWORLD). Format "NAME:entryId" join lewat portal entry tertentu.
client:warp("MYWORLD")
client:warp("MYWORLD:portal-id")
client:warpRandom()
| Field | Type |
|---|---|
| Signature | (self: Client) → string? |
| Returns | string? — nama dunia tujuan kalau sukses, nil kalau timeout (12 d) |
| Async | yes |
client:leave()
| Field | Type |
|---|---|
| Signature | (self: Client) → string? |
| Returns | string? — nil kalau sukses |
| Async | yes |
client:nether(level)
| Field | Type |
|---|---|
| Signature | (self: Client, level: number) → string? |
| Returns | string? — nil kalau sukses |
| Async | yes |
Join dunia instanced NETHER di level yang diminta (0..4).
client:mines(level)
| Field | Type |
|---|---|
| Signature | (self: Client, level: number) → string? |
| Returns | string? — nil kalau sukses |
| Async | yes |
Join dunia instanced MINES di level yang diminta (0..4).
client:enterPortal(point)
| Field | Type |
|---|---|
| Signature | (self: Client, point: Vec2i) → string? |
| Returns | string? — nil kalau sukses |
| Common errors | Errors.NOT_IN_WORLD, Errors.DISCONNECTED |
| Async | yes |
Masuk lewat portal di point. Portal cross-world dirutekan via warp_to_entry; portal same-world ngirim GoFromPortal.
client:enterTutorial()
| Field | Type |
|---|---|
| Signature | (self: Client) → string? |
| Returns | string? — nil kalau sukses |
| Common errors | Errors.WORLD_NOT_FOUND, Errors.TIMEOUT, Errors.DISCONNECTED |
| Async | yes |
Drive bootstrap join buat akun guest baru yang belum nyelesaiin tutorial.
client:recentWorlds(timeoutMs?)
| Field | Type |
|---|---|
| Signature | (self: Client, timeoutMs: number?) → {string} |
| Returns | Tabel 1-indexed berisi row {name, id, count}. count bisa berupa sentinel — lihat WorldCount |
| Async | yes |
client:activeWorlds(timeoutMs?)
| Field | Type |
|---|---|
| Signature | (self: Client, timeoutMs: number?) → {string} |
| Returns | Tabel 1-indexed berisi row {name, id, count} |
| Async | yes |
client:worldInfo(name, timeoutMs?)
| Field | Type |
|---|---|
| Signature | (self: Client, name: string, timeoutMs: number?) → { name: string, count: number } |
| Returns | Lookup sekali jalan. count bisa salah satu sentinel WorldCount.* ATAU jumlah online beneran (>= 0). nil kalau timeout |
| Async | yes |
Timeout default ketiganya 3000ms.
local recent = client:recentWorlds() -- terakhir dikunjungi
local active = client:activeWorlds(5000) -- populer, custom timeout
local info = client:worldInfo("MYWORLD") -- lookup sekali jalan
for i, w in ipairs(recent) do
print("{} (id={}) — {} online", w.name, w.id, w.count)
end
if info.count >= 0 and info.count < 50 then
client:warp(info.name)
elseif info.count == WorldCount.doesNotExist then
print("dunia belum ada")
end
WorldCount.doesNotExist -- -3
WorldCount.instanced -- -1
Query world
client:isWalkable(point)
| Field | Type |
|---|---|
| Signature | (self: Client, point: Vec2i) → boolean |
| Returns | boolean — true kalau tile foreground di point itu udara. false buat OOB atau pas world belum di-load |
| Async | yes |
client:growingTileAt(point)
| Field | Type |
|---|---|
| Signature | (self: Client, point: Vec2i) → Tree? |
| Returns | Tree? — metadata tile growing, atau nil kalau nggak ada yang tumbuh |
| Async | yes |
client:worldItems()
| Field | Type |
|---|---|
| Signature | (self: Client) → {WorldItemRow} |
| Returns | Tabel 1-indexed berisi row {x, y, blockType, class, isOpen}. Kosong kalau world belum di-load |
| Async | yes |
client:findWorldItems(opts?)
| Field | Type |
|---|---|
| Signature | (self: Client, opts: { class: string?, open: boolean? }?) → {WorldItemRow} |
| Returns | Versi worldItems() yang difilter. class itu match substring case-insensitive (misal "Door" dapet WoodenDoorData). open filter berdasarkan state buka/tutup. Filter mana pun bisa dilewatin |
| Async | yes |
client:portals()
| Field | Type |
|---|---|
| Signature | (self: Client) → {PortalRow} |
| Returns | Tabel 1-indexed berisi row {x, y, blockType, class, targetWorld, targetEntry, ownEntry, isOpen} |
| Async | yes |
client:dumpWorldTiles()
| Field | Type |
|---|---|
| Signature | (self: Client) → string? |
| Returns | string? — dump CSV dari grid tile foreground; string kosong kalau world belum di-load |
| Async | yes |
Berguna buat ngecek pathfinding yang nyangkut dari skrip.
client:hasItem(blockId, min?)
| Field | Type |
|---|---|
| Signature | (self: Client, blockId: number, min: number?) → boolean |
| Returns | boolean — true kalau bot punya minimal min (default 1) dari blockId |
| Async | yes |
client:isWalkable(Vector2i.new(5, 3))
client:growingTileAt(Vector2i.new(5, 3))
client:worldItems()
client:findWorldItems({ class = "Lock" })
client:portals()
client:dumpWorldTiles()
client:hasItem(blockId)
client:hasItem(blockId, 5)