Main Screen

The main screen file holds functions and procedures that are used in the runescape mainScreen.

The source for this file can be found here.

Consts, Types, Vars

The following constants, types and variables are used throughout the main screen methods.

const Main Screen Angle

Constants that represent the possible angles of the mainScreen:

  • MS_ANGLE_HIGH
  • MS_ANGLE_LOW
  • MS_ANGLE_NONE

type TRSMainScreen

type
  TRSMainScreen = TRSInterface;

A type that stores the main screen properties.

var mainScreen

var
  mainScreen: TRSMainScreen;

A variable through which scripters can access the TRSMainScreen type methods.

TRSMainScreen methods

The following methods should be called through the mainScreen variable.

Example:

if mainScreen.setZoom(true) then
  writeln('We zoomed out the mainScreen');

setAngle

procedure TRSMainScreen.setAngle(angle: integer);

Sets the mainScreen angle. The angle parameter should be one of the angle constants at the top of this page.

Note

  • by Raymond, edit by Naum
  • Last Updated: 10 May 2013 by Coh3n

Example:

if players[currentPlayer].login() then
  mainScreen.setAngle(MS_ANGLE_HIGH);

isPlayerAnimating

function TRSMainScreen.isPlayerAnimating(minShift: integer = 300): boolean;

Returns true if the pixel shift around the player is more than maxShift (default = 300) This is calculated inside the mainScreen.playerBox as the average shift after 250ms, measured in 50ms intervals.

Note

  • by Coh3n
  • Last Updated: 7 July 2014 by Coh3n

Example:

while (mainScreen.isPlayerAnimating()) do
begin
  antiban();
  wait(50 + random(50));
end;

setZoom

procedure TRSMainScreen.setZoom(zoomOut: boolean; scrolls: integer = 40);

Zooms the mainScreen in or out depending on the zoomOut parameter. You can optionally adjust the scrolls amount to zoom in or out partially.

Note

  • by Ashaman88
  • Last Updated: 9 August 2015 by The Mayor

Example:

mainScreen.setZoom(true);

filterPointsPlayer

procedure TRSMainScreen.filterPointsPlayer(var tpa: TPointArray);

Clears all the points in the TPointArray tpa that fall within the mainScreen.playerBox. This is useful if your player’s colors matches the colour of the object you are trying to find.

Example:

var
  tpa: TPointArray;
begin
  if findColors(tpa, 1234567, mainScreen.getBounds()) then
  begin
    mainScreen.filterPointsPlayer(tpa);
    // ATPA code
  end;
end;

findObject

function TRSMainScreen.findObject(var x, y: integer; cols, tols: TIntegerArray; colSettings: TColorSettings; sortFrom: TPoint; objWidth, objHeight, minCount: integer; mouseOverText: TStringArray; searchBox: TBox; mouseAction: integer = MOUSE_NONE): boolean;

Returns true if an object is successfully found and clicked. If multiple matches are found, it will click the one closest to the player. It is recommended to only use this if you’re object has very distinct colours.

  • ix, iy : The coordinates of the object if found.
  • cols : The colors to be found.
  • tols : The tolerances on ‘cols’.
  • colSettings : The color settings (i.e. color tolerance speed and modifiers). See lib/utilities/color.simba.
  • sortFrom : Sorts the TPA, starting with the point closest to this point.
  • objWidth : The width (in pixels) of the object you’re trying to find.
  • objHeight : The height (in pixels) of the object you’re trying to find.
  • minCount : The minimum number of colors to be found on a single object.
  • mouseOverText : The uptext of the object.
  • searchBox : The area to search in.
  • mouseAction : The action of the mouse. Default MOUSE_LEFT.

Note

  • by Wizzup?, Torrent Of Flame & Coh3n
  • Last Updated: 30 May 2013 by Coh3n

Example:

if (mainScreen.findObject(x, y, [123457, 897637], [5, 10], colorSetting(2, 0.02, 0.13), mainScreen.getCenterPoint(), 50, 25, 40, ['Tree'], mainScreen.getBounds(), MOUSE_RIGHT)) then
  writeln('Right-clicked object!');

findObject (overload 1)

function TRSMainScreen.findObject(var ix, iy: integer; col, tol: integer; colSettings: TColorSettings; sortFrom: TPoint; objWidth, objHeight, minCount: integer; mouseOverText: TStringArray; mouseAction: integer = MOUSE_NONE): boolean; overload;

As above, except this overload takes slightly different parameters. It takes a single colour as opposed to multiple:

  • ix, iy : The coordinates of the object if found.
  • col : The color to be found.
  • tol : The tolerance on ‘col’.
  • colSettings : The color settings (i.e. color tolerance speed and modifiers). See lib/utilities/color.simba.
  • sortFrom : Sorts the TPA, starting with the point closest to this point.
  • objWidth : The width (in pixels) of the object you’re trying to find.
  • objHeight : The height (in pixels) of the object you’re trying to find.
  • minCount : The minimum number of colors to be found on a single object.
  • mouseOverText : The uptext of the object.
  • mouseAction : The action of the mouse. Default MOUSE_LEFT.

Note

  • by Wizzup? & Torrent Of Flame
  • Last Updated: 30 May 2013 by Coh3n

Example:

if (mainScreen.findObject(x, y, 123457, 10, colorSetting(2, 0.02, 0.13), mainScreen.getCenterPoint(), 50, 25, 40, ['ake'])) then
  writeln('Clicked object!');

findObject (overload 2)

function TRSMainScreen.findObject(var ix, iy: integer; col, tol: integer; mouseOverText: TStringArray; mouseAction: integer = MOUSE_LEFT): boolean; overload;

As above, except this overload takes a single CTS1 color + tolerance.

  • ix, iy : The coordinates of the object if found.
  • col : The color to be found.
  • tol : The tolerance on ‘col’.
  • mouseOverText : The uptext of the object.
  • mouseAction : The action of the mouse. Default MOUSE_LEFT.

Note

  • by Olly
  • Last Updated: 20 November by Olly

Example:

if (mainScreen.findObject(x, y, 123457, 10, ['ake'])) then
  writeln('Clicked object!');