/rs3-developer-tools:add-event-handlerfrom rs3-developer-tools
Subscribe an RS3 plugin to a client event with a typed callback, a namespaced reference name, and cleanup in PluginShutdown.
Ships in rs3-developer-tools. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Wire Event.<Name>.Subscribe(ref, callback) for one of the client events, with the payload fields taken from the stubs, and release it on shutdown.
Event.Logic, Event.ServerLogic, Event.Draw).add-ui-window).api_lookup (MCP) or hover Event. in the editor; every event is listed at https://developer.runescape.com/rs/core/events.html#supported-events. Check the payload fields in the stub (<Name>Event class).Event.ChatMessage needs chatAccess in plugin.json and should be gated with Plugin.HasPermission.local REFS = {
npcAdded = "lootTally.npcAdded",
}
---@param event NPCEntityAddedEvent
local function onNpcAdded(event)
if not event.npcEntity.isValid then
return
end
log("spawned: " .. event.npcEntity.displayName)
end
Event.EntityDraw callbacks must return a boolean; events without payload (ServerLogic, WorldUpdated, RegionUpdated) take no parameter.
5. Subscribe after the callback is defined:
Event.NPCEntityAdded.Subscribe(REFS.npcAdded, onNpcAdded)
Event.Logic or Event.Draw; throttle with a counter and cache results.PluginShutdown:function PluginShutdown()
Event.NPCEntityAdded.Unsubscribe(REFS.npcAdded)
end
prl <name> and confirm the handler fires once per event; duplicate log lines mean an earlier subscription was never released.Request: "log every private chat message"
Result: chatAccess added to optionalPermissions, a hasChatAccess() helper, Event.ChatMessage.Subscribe("lootTally.chat", onChat) where onChat checks event.chatType == ChatType.PRIVATE_INCOMING and the permission before logging, plus the matching Unsubscribe.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub tmhsdigital/rs3-developer-tools --plugin rs3-developer-tools5 skills in this plugin
/add-testsWrite Lua tests for an RS3 plugin that run outside the client with rs3dev test, against the API fakes generated from the stubs, covering load, clicks, events, persistence and PluginShutdown./add-ui-windowAdd a GroupBox window with labels, buttons and other components to an RS3 plugin, wired to the plugin layer and destroyed on shutdown./new-pluginCreate a new RS3 plugin folder with a valid manifest, a commented main.lua, LuaLS stubs wiring, and the first sync into dev_plugins.