RSInterface Controls

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


TButton type

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

../../images/Tbuttons.png

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

../../images/linked_Tbuttons.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 TButton methods.


TButton.Click

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

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

Example:

Button.Click();

TButton.Enabled

property TButton.Enabled: Boolean;
property TButton.Enabled(value: Boolean);

Property to get/set a TButton Enabled state.

Example:

WriteLn Button.Enabled;
Button.Enabled := True; //or Button.Enabled[True];
WriteLn Button.Enabled;

TButton.WaitEnabled

function TButton.WaitEnabled(time: Integer = TICK; interval: Integer = -1): Boolean;

Returns True if the button is enabled within time milliseconds.

Example:

WriteLn Button.WaitEnabled();

TSlider type

A record meant to handle sliders in the game interfaces:

../../images/sliders.png

TSlider.GetLevel

function TSlider.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();

TSlider.SetLevel

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

Attempts to set the slider to the specified level.

Example:

WriteLn slider.SetLevel(60);

TScrollBar type

Record to handle the game interface’s scrollbars:

../../images/scrollbar.png

TScrollBar.Setup

procedure TScrollBar.Setup(rightSide: Boolean = True);

Method used to setup several TScrollBar type internal variables. When creating a TScrollBar type 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();

TScrollBar.IsVisible

function TScrollBar.IsVisible(): Boolean;

Returns True/False if the scrollbar is visible.

Example:

WriteLn Bank.Scroll.IsVisible();

TScrollBar.Slider

property TScrollBar.Slider: TBox;

Returns a TBox of the scrollbar slider.

Example:

ShowOnTarget(Bank.Scroll.Slider);
../../images/scrollbar_slider.png

TScrollBar.CanScroll

function TScrollBar.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();

TScrollBar.GetLevel

function TScrollBar.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();

TScrollBar.ScrollArea

property TScrollBar.ScrollArea: TBox;

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

Example:

ShowOnTarget(Chat.Scroll.ScrollArea);

TScrollBar.SetLevel

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

Attempts to set a scroll level on a scrollbar.

Example:

WriteLn Chat.Scroll.SetLevel(50);

TScrollBar.Scroll

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

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

Example:

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

TDropDownOption type

Helper record to handle TDropDown type options.


TDropDown type

Record to handle drop downs in the game interfaces:

../../images/dropdowns.png

TDropDown.Setup

procedure TDropDown.Setup(
  options: TStringArray; constref font: TPixelFont;
  colors: TColorArray = [$1F98FF, $3FB8FF]
);

Sets up a TDropDown type internal variables.

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

Example:

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

TDropDown.IsVisible

function TDropDown.IsVisible(): Boolean;

Returns true if a TDropDown type is visible.

Example:

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

TDropDown.IsOpen

function TDropDown.IsOpen(): Boolean;

Returns true if a TDropDown type is open.

Example:

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

TDropDown.WaitOpen

function TDropDown.WaitOpen(time: Integer = TICK; interval: Integer = -1): Boolean;

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

Example:

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

TDropDown.Open

function TDropDown.Open(): Boolean;

Attempts to open a TDropDown type.

Example:

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

TDropDown.Close

function TDropDown.Close(): Boolean;

Attempts to close a TDropDown type.

Example:

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

TDropDown.GetSelected

function TDropDown.GetSelected(): Integer;

Returns the index of the currently selected option on a TDropDown type.

Example:

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

TDropDown.Select

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

Attempts to select an option on a TDropDown type.

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[EOptionsDropDown.CLIENT_MODE].Select('Fixed');