# ChooseOption This file contains types and methods meant to handle the OldSchool RuneScape context menu that opens on right clicking. - - - (TRSChooseOption_Option)= ## type TRSChooseOption_Option ```pascal 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. - - - (TRSChooseOption)= ## type TRSChooseOption ```pascal TRSChooseOption = record Bitmap: Int32; BitmapWidth: Int32; BitmapHeight: Int32; Bounds: TBox; end; ``` Main record responsible for handling the ChooseOption menu. - - - ## ChooseOption.IsOpen ```pascal 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: ```pascal WriteLn ChooseOption.IsOpen(); ``` - - - ## ChooseOption.IsOpen ```pascal function TRSChooseOption.Open(): Boolean; ``` Opens the choose option context menu if it's not currently open. Example: ```pascal WriteLn ChooseOption.Open(); ``` - - - ## ChooseOption.Free ```pascal 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 ```pascal 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 ```pascal 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 ```pascal function TRSChooseOption.Close(): Boolean; ``` Closes the Choose option context menu if it's open. Returns True on success. Example: ```pascal WriteLn ChooseOption.Close(); ``` - - - ## ChooseOption.HasOption ```pascal 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: ```pascal WriteLn ChooseOption.HasOption('Take'); ``` - - - ## ChooseOption.CountOption ```pascal 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: ```pascal WriteLn ChooseOption.CountOption('Take Bones'); ``` - - - ## ChooseOption.Select ```pascal 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: ```pascal WriteLn ChooseOption.Select('Take Bones'); ``` - - - ## ChooseOption.Hover ```pascal 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: ```pascal WriteLn ChooseOption.Hover('Take Bones'); ``` - - - (ChooseOption)= ## var ChooseOption Global variable for the TRSChooseOption record. You should use this variable when you want to interact with TRSChooseOption.