ChooseOption

This file contains types and methods meant to handle the OldSchool RuneScape context menu that opens on right clicking.


type TRSChooseOption_Option

TRSChooseOption_Option = record
  Text: String;
  Bounds: TBox;
  StringIndex, OptionIndex: Int32;
end;

TRSChooseOption_OptionArray = array of TRSChooseOption_Option;

Helper type to handle the context menu options. You probably won’t have to use this directly.


type TRSChooseOption

TRSChooseOption = record
  Bitmap: Int32;
  BitmapWidth: Int32;
  BitmapHeight: Int32;

  Bounds: TBox;
end;

Main record responsible for handling the ChooseOption menu.


ChooseOption.IsOpen

function TRSChooseOption.IsOpen(): Boolean;
function TRSChooseOption.IsOpen(WaitTime: Int32; Interval: Int32 = -1): Boolean; overload;

Returns True/False if the choose option menu is currently visible/open.

Example:

WriteLn ChooseOption.IsOpen();

ChooseOption.IsOpen

function TRSChooseOption.Open(): Boolean;

Opens the choose option context menu if it’s not currently open.

Example:

WriteLn ChooseOption.Open();

ChooseOption.Free

function TRSChooseOption.Free(): Boolean;

Releases loaded bitmaps that the TRSChooseOption loads to work. This is automatically called for you on script termination, you don’t have to call it.


ChooseOption.Setup

procedure TRSChooseOption.Setup();

TRSChooseOption setup method. This is responsible for loading the needed bitmaps into memory and is automatically called for you when a script is ran so you don’t have to call it.


ChooseOption.GetOptions

function TRSChooseOption.GetOptions(): TRSChooseOption_OptionArray;

Returns a TRSChooseOption_OptionArray of all available options in the Choose Option context menu. This is a internal method, you probably don’t need to call it.


ChooseOption.Close

function TRSChooseOption.Close(): Boolean;

Closes the Choose option context menu if it’s open. Returns True on success.

Example:

WriteLn ChooseOption.Close();

ChooseOption.HasOption

function TRSChooseOption.HasOption(text: TStringArray; out option: TRSChooseOption_Option; caseSensitive: Boolean = True; closeIfNotFound: Boolean = True): Boolean;
function TRSChooseOption.HasOption(text: TStringArray; out index: Int32; caseSensitive: Boolean = True; closeIfNotFound: Boolean = True): Boolean; overload;
function TRSChooseOption.HasOption(text: TStringArray; caseSensitive: Boolean = True; closeIfNotFound: Boolean = True): Boolean; overload;
function TRSChooseOption.HasOption(text: String; caseSensitive: Boolean = True; closeIfNotFound: Boolean = True): Boolean; overload;

Methods to check if an option is available in the choose option context menu. Returns true if the option specified is available.

Example:

WriteLn ChooseOption.HasOption('Take');

ChooseOption.CountOption

function TRSChooseOption.CountOption(text: TStringArray; caseSensitive: Boolean = True; closeIfNotFound: Boolean = True): Int32;
function TRSChooseOption.CountOption(text: String; caseSensitive: Boolean = True; closeIfNotFound: Boolean = True): Int32; overload;

Count how many times the specified option occurs in the choose option context menu.

Example:

WriteLn ChooseOption.CountOption('Take Bones');

ChooseOption.Select

procedure TRSChooseOption.Select(option: TRSChooseOption_Option; mouseAction: Int32 = MOUSE_LEFT);
function TRSChooseOption.Select(text: TStringArray; mouseAction: Int32 = MOUSE_LEFT; caseSensitive: Boolean = True; closeIfNotFound: Boolean = True): Boolean; overload;
function TRSChooseOption.Select(text: String; mouseAction: Int32 = MOUSE_LEFT; caseSensitive: Boolean = True; closeIfNotFound: Boolean = True): Boolean; overload;

Selects the specified option if it exists on the Choose option context menu.

Example:

WriteLn ChooseOption.Select('Take Bones');

ChooseOption.Hover

function TRSChooseOption.Hover(text: TStringArray; caseSensitive: Boolean = True; closeIfNotFound: Boolean = True): Boolean;
function TRSChooseOption.Hover(text: String; caseSensitive: Boolean = True; closeIfNotFound: Boolean = True): Boolean; overload;

Hovers the specified option if it exists on the Choose option context menu.

Example:

WriteLn ChooseOption.Hover('Take Bones');

var ChooseOption

Global variable for the TRSChooseOption record. You should use this variable when you want to interact with TRSChooseOption.