MainScreen¶
This file holds functions and procedures that are used for the mainscreen.
- Ouputs a global variable ‘MainScreen’ that should be used to call these methods.
srl.Writeln(MainScreen.GetUpText());
MainScreen.GetUpText¶
function TRSMainScreen.GetUpText(): String;
Returns the current uptext (Text in top left of the screen).
Example:
srl.Writeln(MainScreen.GetUpText());
MainScreen.IsUpText¶
function TRSMainScreen.IsUpText(Strings: TStringArray; Timeout: Int32 = -1; Confirm: Int32 = 50): Boolean;
Returns True if any of the strings are in the uptext, will search until Timeout is reached.
- Confirm by default will wait 50 milliseconds after uptext has been found and check if the uptext is still correct,
- this is because RS uptext is delayed at least a frame.
- Timeout by default is -1 which will search for between 85 to 200 milliseconds.
Example:
if MainScreen.IsUpText(['Attack', 'Chicken']) then
Mouse.Click(mouse_Left);
MainScreen.IsUpText; overload¶
function TRSMainScreen.IsUpText(Str: String; WaitTime: UInt32 = 350): Boolean; overload;
Returns True if any of the string ‘Str’ is in the uptext. Will search up to ‘WaitTime’ which by default is 270.
Example:
if (MainScreen.IsUpText('Attack Chicken')) then
Mouse.Click(mouse_Left);
MainScreen.GetPlayerBox¶
function TRSMainScreen.GetPlayerBox(): TBox;
Returns of a rough Area (TBox) on where your player is.
Example:
Writeln(MainScreen.GetPlayerBox());
MainScreen.FilterPlayerBox¶
procedure TRSMainScreen.FilterPlayerBox(var TPA: TPointArray);
Removes all points in the TPointArray ‘TPA’ that are in the player box.
Example:
MainScreen.FilterPlayerBox(TPA);
MainScreen.FindHPBars¶
function TRSMainScreen.FindHPBars(Area: TBox): THPBarArray;
- Returns a THPBarArray of all hitpoint bars found in the area ‘Area’.
- THPBar.Bounds is the bounds of the found hitpoint bar
- THPBar.Percent is the percent of health in the hitpoint bar.
Example:
Bars := MainScreen.FindHPBars(MainScreen.GetBounds());