Services
Find workers, logging, input, web requests, and sound APIs.
The service tables have dedicated pages with signatures, parameters, returns, and examples:
scriptstarts workers and saves module values.logwrites script messages.hotkeysreads key presses.httpqueues web requests.windowopens the module's external desktop window.soundplays audio.packetsreads packet copies, builds and queues outgoing bodies, and installs future byte edits.
See lifecycle for module callbacks.
sdk.community
Available in SDK 1.7.11. This is the same persistent reporter bundled with Gathering Bot. It publishes anonymous aggregate activity to the community dashboard. Importing the SDK does not start reporting or control the game.
sdk.community.new(storage, transport)
Pass the module's script and http tables. The constructor returns a publisher
with Add, Update and OnHttp methods and a readable status string.
An installation registers its own private credential automatically. Keep its
saved state across script updates and never share the credential.
Call publisher:Add(events) only after your controller confirms an event. It
returns true when the cumulative ledger was saved, or false if the event is
invalid or reporting is unavailable. The event fields are optional nonnegative
integer deltas: gathers, mobs, bosses, and resources, a map from string
IDs to quantities. Each delta is limited to 1,000. Resources must be supported
material IDs or one of the 19 Hidden Cube object IDs; the service rejects
unknown IDs. Cube object IDs are distinct from reward item IDs.
Pass elapsed seconds to publisher:Update(dt) once per tick, and forward every
HTTP reply to publisher:OnHttp(request_id, status, body, error). Saved lifetime
totals and publication receipts make HTTP retries and reloads idempotent.
They do not deduplicate two separate calls to Add: the controller must emit
each confirmed event once. A saved event can remain queued during an outage.
This module reports only events explicitly supplied by its controller. It does not observe gameplay. One confirmed cube reward receipt adds one to that cube's object ID, regardless of reward quantity. A key press, consumed key, nearby object, or dropped actor alone is insufficient confirmation. The dashboard groups the IDs into Light and Dark cubes, independently of material quantities.
local sdk = require("sdk")
local publisher
function on_start()
publisher = sdk.community.new(script, http)
end
function on_tick(dt)
publisher:Update(dt)
end
function on_http(request_id, status, body, error)
publisher:OnHttp(request_id, status, body, error)
end
-- Your receipt controller calls this once for a verified cube reward.
-- This is a script function, not an automatic host callback.
function on_confirmed_cube_receipt(cube_object_id)
return publisher:Add({resources = {[tostring(cube_object_id)] = 1}})
endUse one publisher for a given stream of events. Gathering Bot already reports its own activity; do not add a second observer for the same gathers or cubes. Updating the SDK alone does not add reporting to an older script.