RSInterface Controls

This page is about controls on runescape interfaces. These can be buttons, scrollbars, dropdowns, checkboxes, etc.


TRSButton

RuneScape has several types of buttons, TRSButton can be used for several of them but it’s made specifically for buttons that have an “enabled” and “disabled” state:

_images/trsbuttons.png

You can also use them very effectively for this type of buttons that are “linked” together:

_images/linked_trsbuttons.png

With “linked”, it means that enabling one, disabled the linked one(s).

You can also use them for other types of buttons and imagination is the limit but in a lot of cases you won’t be able to make use of the TRSButton methods.


TRSButton.Enabled

function TRSButton.Enabled(): Boolean;

Returns True/False if the button is enabled.

Example:

WriteLn Button.Enabled();

TRSButton.WaitEnabled

function TRSButton.WaitEnabled(time: Integer = 600; interval: Integer = -1): Boolean;

Returns True if the button is enabled within time milliseconds.

Example:

WriteLn Button.WaitEnabled();

TRSButton.Click

procedure TRSButton.Click(button: EMouseButton = EMouseButton.LEFT);

Clicks a {ref]TRSButton with the specified mouse button which by default is the left one.

Example:

Button.Click();

TRSButton.Enable

function TRSButton.Enable(): Boolean;

Attempts to enable a {ref]TRSButton. This is done with the left mouse click and the function returns true if TRSButton.Enabled returns true.

Example:

WriteLn Button.Enable();

TRSButton.Disable

function TRSButton.Disable(): Boolean;

Attempts to disable a {ref]TRSButton. This is done with the left mouse click and the function returns true if TRSButton.Enabled returns false.

Example:

WriteLn Button.Disable();

TRSSlider

A record meant to handle sliders in the game interfaces:

_images/sliders.png

TRSSlider.GetLevel

function TRSSlider.GetLevel(): Integer;

Returns the slider level from 0 to 100. It’s important to keep in mind that while we use a scale from 0 to 100, don’t have that many “levels”.

For example, the brightness slider only have 5 or 6 possible positions.

Example:

WriteLn slider.GetLevel();

TRSSlider.SetLevel

function TRSSlider.SetLevel(level: Integer): Boolean;

Attempts to set the slider to the specified level.

Example:

WriteLn slider.SetLevel(60);

TRSScrollBar

Record to handle the game interface’s scrollbars:

_images/scrollbar.png

TRSScrollBar.Setup

procedure TRSScrollBar.Setup();

Method used to setup several TRSScrollBar internal variables. When creating a TRSScrollBar you should first setup it’s Area variable and then call this.

Example:

scroll.Area.X1 := Bank.Bounds.X1 + 5;
scroll.Area.Y1 := Bank.Bounds.Y1 + 78;
scroll.Area.X2 := Bank.Bounds.X2 - 22;
scroll.Area.Y2 := Bank.Bounds.Y2 - 44;
scroll.Setup();

TRSScrollBar.IsVisible

function TRSScrollBar.IsVisible(): Boolean;

Returns True/False if the scrollbar is visible.

Example:

WriteLn Bank.Scroll.IsVisible();

TRSScrollBar.Slider

property TRSScrollBar.Slider: TBox;

Returns a TBox of the scrollbar slider.

Example:

ShowOnTarget(Bank.Scroll.GetSlider());
_images/scrollbar_slider.png

TRSScrollBar.CanScroll

function TRSScrollBar.CanScroll(): Boolean;

Returns True/False if the scrollbar is “scrollable”.

A scrollbar is not scrollable if it’s not visible or if the slider occupies the whole space available.

Example:

WriteLn Chat.Scroll.CanScroll();

TRSScrollBar.GetLevel

function TRSScrollBar.GetLevel(): Integer;

Returns the level of the scrollbar. This is a percentage between the available space and the slider size.

Example:

WriteLn Chat.Scroll.GetLevel();

TRSScrollBar.ScrollArea

property TRSScrollBar.ScrollArea: TBox;

Returns a area where you can scroll the mouse, using TBiometrics between TRSScrollBar.Area and TRSScrollBar.Bounds.

Example:

ShowOnTarget(Chat.Scroll.GetScrollArea());

TRSScrollBar.SetLevel

function TRSScrollBar.SetLevel(value: Integer): Integer;

Attempts to set a scroll level on a scrollbar.

Example:

WriteLn Chat.Scroll.SetLevel(50);

TRSScrollBar.Scroll

function TRSScrollBar.Scroll(amount: Integer; down: Boolean): Boolean;

Scroll amount amount of times in a direction decided by down.

Example:

WriteLn Chat.Scroll.Scroll(3, True);

TRSDropDownOption

Helper record to handle TRSDropDown options.


TRSDropDown

Record to handle drop downs in the game interfaces:

_images/dropdowns.png

TRSDropDown.Setup

procedure TRSDropDown.Setup(options: TStringArray);

Sets up a TRSDropDown internal variables.

This has to be used after the TRSDropDown.Bounds variable is already set.

Example:

DropDown.Setup(['Fixed - Classic layout', 'Resizable - Classic layout', 'Resizable - Modern layout']);

TRSDropDown.IsVisible

function TRSDropDown.IsVisible(): Boolean;

Returns true if a TRSDropDown is visible.

Example:

WriteLn Options.DropDowns[ERSOptionsDropDown.CLIENT_MODE].IsVisible();

TRSDropDown.IsOpen

function TRSDropDown.IsOpen(): Boolean;

Returns true if a TRSDropDown is open.

Example:

WriteLn Options.DropDowns[ERSOptionsDropDown.CLIENT_MODE].IsOpen();

TRSDropDown.WaitOpen

function TRSDropDown.WaitOpen(time: Integer = 600; interval: Integer = -1): Boolean;

Returns true if TRSDropDown.IsOpen returns true within time milliseconds.

Example:

WriteLn Options.DropDowns[ERSOptionsDropDown.CLIENT_MODE].WaitOpen();

TRSDropDown.Open

function TRSDropDown.Open(): Boolean;

Attempts to open a TRSDropDown.

Example:

WriteLn Options.DropDowns[ERSOptionsDropDown.CLIENT_MODE].Open();

TRSDropDown.Close

function TRSDropDown.Close(): Boolean;

Attempts to close a TRSDropDown.

Example:

WriteLn Options.DropDowns[ERSOptionsDropDown.CLIENT_MODE].Close();

TRSDropDown.GetSelected

function TRSDropDown.GetSelected(): Integer;

Returns the index of the currently selected option on a TRSDropDown.

Example:

WriteLn Options.DropDowns[ERSOptionsDropDown.CLIENT_MODE].GetSelected();

TRSDropDown.Select

function TRSDropDown.Select(index: Integer): Boolean;
function TRSDropDown.Select(option: String): Boolean; overload;

Attempts to select an option on a TRSDropDown.

You can either use an option index or substring of an option. If you use a substring, the first match will be used.

Example:

WriteLn Options.DropDowns[ERSOptionsDropDown.CLIENT_MODE].Select('Fixed');