OverheadFinder - Prayer/Protection Overhead Detection System¶
A comprehensive system for detecting and locating prayer and protection overhead icons in Old School RuneScape. This module uses template matching to identify various overhead prayer effects on players and NPCs.
ERSOverhead¶
ERSOverhead = (
MAGIC, RANGED, MELEE, RETRIBUTION, REDEMPTION, SMITE,
MAGIC_AND_RANGED, MAGIC_AND_MELEE, RANGED_AND_MELEE, ALL,
DAMPEN_MELEE
);
Enumeration of all detectable overhead prayer and protection types in OSRS. Includes individual protections, combinations, and special prayer effects.
TRSOverhead¶
TRSOverhead = record
Position: TPoint;
Overhead: ERSOverhead;
end;
Record containing information about a detected overhead prayer icon. Stores both the screen position and the type of overhead detected.
TRSOverheadArray¶
TRSOverheadArray = array of TRSOverhead;
Dynamic array of TRSOverhead records for storing multiple detected overhead icons.
TRSOverheadFinder¶
TRSOverheadFinder = record
Images: array[ERSOverhead] of TImage;
Version, CacheDir: String;
Similarity: Single;
end;
Main overhead detection system that manages template images and performs overhead icon recognition using template matching algorithms.
TRSOverheadFinder.Setup¶
procedure TRSOverheadFinder.Setup();
Internal procedure called when library is loaded. Initializes the overhead finder system. Creates cache directories, manages version control, and sets default similarity threshold. Must be called before using detection methods.
Example:
OverheadFinder.Setup();
WriteLn('OverheadFinder initialized successfully');
TRSOverheadFinder.GetImage¶
function TRSOverheadFinder.GetImage(overhead: ERSOverhead): TImage;
Internal function. Retrieves or loads the template image for a specific overhead type. Images are cached after first load.
Parameters:
overhead: The overhead type to get the template image for
Returns TImage object containing the template, or raises exception if image cannot be loaded.
TRSOverheadFinder.Find¶
function TRSOverheadFinder.Find(overheads: set of ERSOverhead; maxToFind: Integer = 5): TRSOverheadArray;
Searches the main screen for specified overhead prayer/protection icons using template matching. Detects overhead icons by first finding the characteristic background color, then performing template matching within those regions.
Parameters:
overheads: Set of overhead types to search for
maxToFind: Maximum number of overhead icons to detect (default: 5)
Returns TRSOverheadArray containing detected overhead positions and types.
Example:
var
foundOverheads: TRSOverheadArray;
i: Integer;
begin
OverheadFinder.Setup();
foundOverheads := OverheadFinder.Find([MAGIC, RANGED, MELEE], 10);
if Length(foundOverheads) > 0 then
begin
WriteLn('Found ' + ToStr(Length(foundOverheads)) + ' overhead icons:');
for i := 0 to High(foundOverheads) do
WriteLn('- ' + ToStr(foundOverheads[i].Overhead) + ' at ' + ToStr(foundOverheads[i].Position));
end else
WriteLn('No overhead icons detected');
end;
{figure} ../../images/overhead_detection_example.png
OverheadFinder variable¶
Global TRSOverheadFinder variable. Use this instance for all overhead detection operations in your scripts.