PrayerFinder¶
Methods to find and compare prayer images
EPrayer¶
EPrayer = enum(THICK_SKIN..AUGURY, DEADEYE, MYSTIC_VIGOUR);
An enumeration representing different prayers in game.
DEADEYE and MYSTIC_VIGOUR replace EAGLE_EYE and MYSTIC_MIGHT in the prayer tab once unlocked.
They are last so the values of the other prayers stay the same for scripts that saved them.
TPrayerFinder¶
A record for finding and managing prayer images.
Fields:¶
PrayerImages: Stores images for each prayer typeSpriteIDs: The cache sprite of each prayer,-1if the cache has noneSimilarity: Threshold for image comparisonImageCompare: Utility for comparing imagesEnums,Items: The cache archives the prayers are read from
PrayerFinder constants¶
The prayer icons come straight from the game cache, from the same data the client uses to draw the prayer tab. A prayer book is an enum listing one item per prayer, keyed by its slot in the tab, and each of those items carries the prayer’s name and icons as params:
PRAYER_BOOK_ENUMSare the standard prayer book and the same book with both Deadeye and Mystic Vigour unlocked, which replace Eagle Eye and Mystic Might in the tab.PRAYER_NAME_PARAMis the param holding the prayer’s name.PRAYER_SPRITE_PARAMis the param holding the icon of a prayer that can be used.
PrayerFinder.Setup¶
procedure TPrayerFinder.Setup();
Sets up the PrayerFinder, loading the cache configs and setting the similarity.
Example:
PrayerFinder.Setup();
PrayerFinder.Resolve¶
procedure TPrayerFinder.Resolve();
Internal method that reads the prayer book enums out of the cache and fills SpriteIDs with the
icon of each EPrayer, matched by name.
A prayer the cache doesn’t have is left at -1.
It runs once, the first time a prayer image is needed.
PrayerFinder.GetImage¶
function TPrayerFinder.GetImage(prayer: EPrayer): TImage;
The icon of prayer, as the prayer tab draws it when the prayer can be used.
It is read from the game cache the first time it is asked for and kept in memory after that.
A prayer the cache has no icon for gives a nil image, which PrayerFinder.Find skips.
Example:
img := PrayerFinder.GetImage(EPrayer.PIETY);
img.Show();
PrayerFinder.FindAll¶
function TPrayerFinder.FindAll(prayers: array of EPrayer; boxes: TBoxArray; maxToFind: Integer = 0): TImageMatchArray;
function TPrayerFinder.FindAll(prayers: array of EPrayer; boxes: TBoxArray; out matches: TImageMatchArray): Boolean; overload;
Finds matches for specified prayers within given boxes.
Each match Index is the index of the box it was found in.
The second overload only returns True if all of the prayers are found.
Example:
if PrayerFinder.FindAll(prayers, boxes, matches) then
for match in matches do
ShowOnTarget(match.Box);
PrayerFinder.Find¶
function TPrayerFinder.Find(prayers: array of EPrayer; boxes: TBoxArray; out match: TImageMatch): Boolean;
Finds the first match for specified prayers within given boxes.
Example:
if PrayerFinder.Find([EPrayer.PIETY], boxes, match) then
ShowOnTarget(match.Box);
PrayerFinder variable¶
Global TPrayerFinder variable.