TRSObjectFinder is the record used in MainScreen.FindObject.
TRSObjectFinder.Zoom
When designing a object finder you must be at default zoom(50) in the fixed client mode.
This allows SRL to convert the finder to work at any zoom and client mode once made.
A finder working at different zoom levels producing similar results.¶
TRSObjectFinder.Colors
An color array which will searched for. Use ACA to acquire color(s).
An array of “color clusters” which will be merged together. Use ACA to acquire color(s).
A “color cluster” consists of a primary and secondary color and a distance value.
When searched for only primary colors within distance of secondary colors are returned.
The distance to pass to ClusterTPA, this is how multiple objects are grouped up. Distance=5 would mean that points that are closer than or equal to 5 pixels away are considered close enough to merge into a singular group.
Finder.ClusterDistance := 5;
Cluster distance 5 produces four individual chairs¶
Any match that exceeds these values will be removed.
The bounding rectangle is used which has a long and a short side measured in pixels.
// Removes matches where the short side isn’t within 10 and 20 pixels
Finder.MinShortSide := 10;
Finder.MaxShortSide := 20;
// Removes matches where the long side isn’t within 20 and 40 pixels
Finder.MinLongSide := 20;
Finder.MaxLongSide := 40;
Example bounding rectangle with a long and short side.¶
Converts a distance acquired from the fixed client* and **default zoom to the
current mainscreen.
Example:
// 20 pixels on the fixed client and default zoom(50) is currently x pixels at the current zoom & client size.WriteLn(MainScreen.NormalizeDistance(20));
Takes a mainscreen point and converts it to a point on the minimap.
Returns a Vector3 which includes input height. Conversion to a TPoint if that’s what you need is simply
done by calling .ToPoint on the result.
Example:
WriteLnMainscreen.PointToMM(Point(250,140),2);// as a vector (more accurate)WriteLnMainscreen.PointToMM(Point(250,140),2).ToPoint();// as a TPoint (lost accuracy)
Returns all matches of an TRSObjectFinder in the desired area.
See the top of this page page for documentation about the TRSObjectFinder record.
Example:
varMyFinder:TRSObjectFinder;// Some chairs in varrock west bankMyFinder.Colors+=CTS2(1328725,6,0.06,0.69);MyFinder.ClusterDistance:=5;MyFinder.Erode:=2;MyFinder.MinLongSide:=10;MyFinder.MaxLongSide:=15;Debug(MainScreen.FindObject(MyFinder,MainScreen.Bounds()));