Paket mentah & Instance child
Paket mentah
client:send(name, params?)
| Field | Type |
|---|---|
| Signature | (self: Client, name: string, params: {[string]: any}?) → string? |
| Returns | string? — nil kalau sukses |
| Common errors | Errors.DISCONNECTED |
| Async | yes |
Ngirim paket BSON sembarang berdasarkan id. params jadi body envelope.
client:on(event, callback)
| Field | Type |
|---|---|
| Signature | (self: Client, event: string, callback: (any) → ()) → () |
| Returns | nothing |
| Async | no |
Subscribe ke event lifecycle / paket:
"connect"— fired sekali saat status nyampeMENU_READYatauIN_WORLD"disconnect"— fired sekali saat status keluar dari set connected"p"— setiap paket inbound"p:<ID>"— cuma paket dengan fieldIDyang cocok
client:send("WCM", { msg = "hi" })
client:on("p:WCM", function(params) -- cuma ID itu
print(params)
end)
client:on("p", function(params) -- setiap paket inbound
print(params)
end)
-- One-shot yang berguna
client:send("GAW", {}) -- Get Active Worlds
client:send("GRW", {}) -- Get Recent Worlds
client:on("p:GRW", function(params)
-- jalan terus sampai skrip stop
end)
Instance child
Tiap-tiap bisa diakses lewat client atau global getX() terkait:
client:inventory() -- atau getInventory()
client:world() -- atau getWorld()
client:console() -- atau getConsole()
client:logger() -- atau getLogs()
client:scripting() -- atau getScripting()
client:world()
| Field | Type |
|---|---|
| Signature | (self: Client) → World |
| Returns | World — handle dunia sekarang, atau nil kalau snapshot belum di-load |
| Async | yes |
client:inventory()
| Field | Type |
|---|---|
| Signature | (self: Client) → Inventory |
| Returns | Inventory — snapshot inventory bot di waktu capture |
| Async | yes |
client:console()
| Field | Type |
|---|---|
| Signature | (self: Client) → Console |
| Returns | Console — buffer console per-runtime (entri ada timestamp-nya) |
| Async | no |
client:logger()
| Field | Type |
|---|---|
| Signature | (self: Client) → Logger |
| Returns | Logger — view array string flat dari buffer yang sama |
| Async | no |
client:scripting()
| Field | Type |
|---|---|
| Signature | (self: Client) → Scripting |
| Returns | Scripting — handle script engine per-bot |
| Async | no |