Choose Option

The text file holds functions and procedures that are used in the runescape choose option manu.

The source for this file can be found here.

Consts, Types, Vars

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

const Tesseract Filter

const
  TESS_FILTER_CHOOSE_OPTION: TTesseractFilter = [4, 4, [False, 15, TM_Mean]];

type TOption

type
  TOption = record
    bounds: TBox;
    str: string;
  end;

A type that stores the bounds and string of an option in the chooseOption menu.

type TOptionArray

type
  TOptionArray = array of TOption;

An array of the TOption type.

type TRSChooseOption

type
  TRSChooseOption = type TRSInterface;

A type that stores the chooseOption interface properties.

var chooseOption

var
  chooseOption: TRSChooseOption;

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

TRSChooseOption methods

The following methods should be called through the chooseOption variable.

Example:

if chooseOption.isOpen() then
  writeln('Choose option menu is open!');

isOpen

function TRSChooseOption.isOpen(waitTime: integer = 0): boolean;

Returns true if the chooseOption menu is open. The optional waitTime parameter (default = 0) is the maximum time (in milliseconds) it will keep looking.

Note

  • by Olly
  • Last Modified: 16 February 2014 by Olly

Example:

if chooseOption.isOpen(2000) then
  chooseOption.close();

close

function TRSChooseOption.close(): boolean;

Returns true if the lodestone screen is successfully closed.

Note

  • by Olly
  • Last Modified: 16 February 2014 by Olly

Example:

if chooseOption.isOpen() then
  chooseOption.close();

getOptions

function TRSChooseOption.getOptions(useTesseract: boolean = false; Filter: TTesseractFilter = TESS_FILTER_CHOOSE_OPTION): TOptionArray;

Returns a TOptionArray of all the options present in the chooseOption menu. The useTesseract parameter can be set to true (default = false) to use the tesseract ocr to read the text. The scripter has the option of using a custom TTesseractFilter Filter .

Note

  • by Olly
  • Last Modified: 4 July 2015 by Thomas

Example:

var
  opts: TOptionArray;
begin
  opts := chooseOption.getOptions();

  if opts[0].str = 'Walk here' then
    mouseBox(opts[0].bounds, MOUSE_LEFT);
end;

optionsExist

function TRSChooseOption.optionsExist(options: TStringArray): boolean;

Returns true if any of the options in options exist in the chooseOption menu.

Note

  • by Olly
  • Last Modified: 16 February 2014 by Olly

Example:

if chooseOption.optionsExist(['alk here']) then
  writeln('the option walk here exists!');

select

function TRSChooseOption.select(txt: TStringArray; waitTime: integer = 250; useTesseract: boolean = false; filter: TTesseractFilter = TESS_FILTER_CHOOSE_OPTION): boolean; overload;

Returns true if an option in txt is interacted with successfully.

  • txt : An array of text you want to find in any of the options
  • waitTime : Max time to wait for the chooseOption menu to appear (default = 250)
  • useTesseract : Use the tesseract ocr to find the text? (default = false)
  • filter : Tesseract filter (default = TESS_FILTER_CHOOSE_OPTION)

Note

  • by Olly
  • Last Modified: 12 September 2013 by Olly

Example:

chooseOption.select(['Walk here']);
chooseOption.select(['Walk here'], 250, True); // To use tesseract

select (overload) 1

function TRSChooseOption.select(txt: TStringArray; matchPercent: extended; waitTime: integer = 250): boolean; overload;

Returns true if an option in txt is interacted with successfully. This overload uses the ‘stringmatch’ method.

  • txt : An array of text you want to find in any of the options
  • matchPercent : Minimum percent which counts as a match
  • waitTime : Max time to wait for the chooseOption menu to appear (default = 250)

Note

  • by Olly
  • Last Modified: 12 September 2013 by Olly

Example:

chooseOption.select(['Walk here'], 0.80); // If 80% of 'Walk here' matches

select (overload) 2

function TRSChooseOption.select(txt: TStringArray; mouseAction: Integer; waitTime: Integer; useTesseract: Boolean;  filter: TTesseractFilter = TESS_FILTER_CHOOSE_OPTION): boolean; overload;

Returns true if an option in txt is interacted with successfully. In this overload method you can adjust the mouseAction, which is useful if ‘hovering’ an option in the menu.

  • txt : An array of text you want to find in any of the options
  • mouseAction : The mouse action to perform on the option (MOUSE_MOVE, MOUSE_LEFT, MOUSE_RIGHT, MOUSE_NONE)
  • waitTime : Time to wait for chooseOption menu to appear
  • useTesseract : Use the tesseract ocr to find the text?
  • filter : Tesseract filter (default = TESS_FILTER_CHOOSE_OPTION)

Note

  • by The Mayor
  • Last Modified: 4 July 2015 by The Mayor

Example:

chooseOption.select(['Bank'], MOUSE_MOVE, 300, false); // Will move the mouse to the option but not click

debugOptions

procedure TRSChooseOption.debugOptions(useTesseract: boolean = false; filter: TTesseractFilter = TESS_FILTER_CHOOSE_OPTION);

Debugs all the found options.

  • useTesseract : Use the tesseract ocr to find the text? (default = false)
  • filter : Tesseract filter (default = TESS_FILTER_CHOOSE_OPTION)

Note

  • by Olly
  • Last Modified: 11 Novemeber 2013 by Olly

Example:

chooseOption.debugOptions(); // To use the traditional getTextAt method

var
  myFilter: TTesseractFilter;
begin
  myFilter := [3, 3, [True, 30, TM_Mean]];
  chooseOption.debugOptions(true, myFilter); // To use a custom tesseract filter
end;