A reagent from the apothecary
rsprite
The sprite tome
Find and draw any RS3 sprite in one line. A small library for plugin makers that looks names up safely, searches every sprite in the game you’re running, and draws sprites and item art with the fiddly bits handled.
Speak its name
Whisper a sprite’s true name and learn its number, or the other way round. Any case will do, and it never forgets what it’s heard.
rsprite.Get("SKILL_ATTACK") -- 9318
Conjure it
Offer a chain of names and the first one that answers appears in your window. A missing sprite can’t break the spell.
rsprite.Draw(parent, { "SKILL_NECROMANCY", "BP3_MISSION_ICON_SKILL_NECROMANCY", })
Scry for it
Gaze across every sprite in the game, or narrow your sight by tag.
rsprite.Find("rune", { tags = { "skill" }, })
Bind it to your spell
List rsprite as a dependency, and the client loads it before your plugin and hands you its table as the global rsprite.
{
"requiredDependencies": {
"rsprite": 0
}
}A first incantation
local attackId = rsprite.Get("SKILL_ATTACK") local icon = rsprite.Draw(parent, { "SKILL_NECROMANCY", "BP3_MISSION_ICON_SKILL_NECROMANCY", Plugin.resources.my_icon }, { x = 10, y = 10, size = 24, }) local ring = rsprite.DrawItem(parent, 13562, { x = 40, y = 10, size = 24 })
The incantations
APISmall on purpose. Every function is safe to call with a name that does not exist.
| Function | What it does |
|---|---|
| rsprite.version | The library version, such as "0.1.0". |
| rsprite.Get(name) | The sprite id for a name, or nil. Case insensitive and cached. |
| rsprite.Name(id) | The sprite name for an id, or nil. Cached. |
| rsprite.Resolve(nameOrChain) | The first source in a chain that exists, plus its position, or nil. |
| rsprite.Draw(parent, nameOrChain, options) | A new ui.Sprite showing the first source that exists, plus its position. |
| rsprite.SetSource(sprite, nameOrChain, options) | Points an existing sprite at a new chain and gives back the position used. |
| rsprite.DrawItem(parent, itemId, options) | A new ui.Sprite showing item art. |
| rsprite.SetItem(sprite, itemId, options) | Points an existing item sprite at another item, giving true or false. |
| rsprite.Find(text, options) | Matching entries and the total match count. An empty string lists every sprite. |
| rsprite.Tags() | Every tag you can filter by, sorted alphabetically. |
| rsprite.BuildIndex(onReady) | Gets the search index ready over a few ticks and calls onReady when done. |
| rsprite.IsIndexReady() | Whether the search index is ready yet. |