Home API Manuals About Forum
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

GetMenuItemsEx

Retrieve all items for menu with Caption - as records (structs).

Returns nothing if no active menu or menu with selected caption not found or char disconnected.

Similar methods: GetLastMenuItems and GetMenuItems.

Pascal:

function GetMenuItemsEx(Caption : String) : TMenuResponses;
TMenuResponse = record
  Model : Word;
  Color : Word;
  Text :  String;
end;

TMenuResponses = TArray<TMenuResponse>;

Pascal Example:

var 
menu : TMenuResponses; 
i : Integer; 
const 	animals = 'Llama|Shelby|Ostard|Mustang|Steed|Desolator|Nightmare|Unicorn';

function Contains(text, pattern : string) : boolean;
var
  stringList : TStringList;
  i : integer;
begin
  stringList := TStringList.Create;
  result := false;

  StrBreakApart(pattern, '|', stringList);

  for i := 0 to stringList.Count - 1 do
  begin
    if (BMSearch(1, UpperCase(text), UpperCase(stringList.Strings[i])) > 0) then
    begin
      result := true;
      break;
    end;
  end;

  stringList.Free;
end;

Begin 
if (MenuPresent()) then
begin
  menu := GetMenuItemsEx('Tracking');

  for i := 0 to Length(menu) - 1 do
  begin
    if Contains(menu[i].Text, animals) then
    begin
      DiscordMessenger.SendMessage('FOUND ' + menu[i].Text + ' , my position: ' + IntToStr(GetX(Self())) + ', ' + IntToStr(GetY(Self())), chatGame);
      break;
    end;
  end;
end;
End.

Python Syntax:

def GetMenuItems(): --> list of string