WaitMenu
Pre-sets a one-time automatic menu response: when a menu with the matching caption appears, the specified element is automatically selected, and the hook is consumed.
MenuCaption — substring to match in the menu title, or (any) to match any title. An empty string is not a wildcard: the call is ignored and a note is written to the system journal. Use (any) when the title is empty or unreadable — for example, a non-ASCII title the client renders as blank.
ElementCaption — substring to match in the desired menu item, or one of the bracketed commands:
| ElementCaption | Selected item |
|---|---|
(N) |
item by zero-based index: (0) is the first one |
(first) |
first item |
(second) |
second item |
(last) |
last item |
(random) |
a random item |
(any) |
a random item (synonym of (random)) |
(cancel) |
cancels the menu instead of picking an item |
The commands and (any) are case-insensitive. Any other bracketed text — and an out-of-range (N) — falls back to a plain substring match.
This installs a single-use hook via the menu manager. When the server sends a menu whose title contains MenuCaption and which has an entry containing ElementCaption, that entry is automatically selected and the hook is removed.
Multiple different hooks can be chained by calling WaitMenu several times with different caption/element pairs before the action that triggers the menus. Each hook fires once for its matching menu.
For a persistent (reusable) hook that fires every time a matching menu appears, use AutoMenu instead.
Does nothing if the character is not connected.
Предустанавливает одноразовый автоматический ответ на меню: при появлении меню с совпадающим заголовком автоматически выбирается указанный пункт, после чего ловушка снимается.
MenuCaption — подстрока для поиска в заголовке меню либо (any) — совпадение с любым заголовком. Пустая строка не является wildcard: вызов игнорируется, в системный журнал пишется соответствующая запись. (any) нужен, когда заголовок пуст или нечитаем — например, не-ASCII текст, который клиент показывает пустым.
ElementCaption — подстрока для поиска в нужном пункте меню либо одна из команд в скобках (см. таблицу выше).
Команды и (any) регистронезависимы. Любой другой текст в скобках — как и (N) вне диапазона — трактуется как обычная подстрока.
Устанавливает одноразовую ловушку через менеджер меню. Когда сервер отправляет меню, заголовок которого содержит MenuCaption и в котором есть пункт, содержащий ElementCaption, этот пункт автоматически выбирается и ловушка удаляется.
Можно установить несколько различных ловушек подряд, вызвав WaitMenu несколько раз с разными парами caption/element перед действием, вызывающим меню. Каждая ловушка срабатывает однократно для своего совпадающего меню.
Для постоянной (многоразовой) ловушки, срабатывающей каждый раз при появлении подходящего меню, используйте AutoMenu.
Не выполняет действий, если персонаж не подключён.
procedure WaitMenu(MenuCaption: String; ElementCaption: String);
def WaitMenu(MenuCaption: str, ElementCaption: str) -> None: ...
begin
// Chain two different menu hooks
WaitMenu('What would you like', 'Ingots');
WaitMenu('Select material', 'Iron');
UseObject(FindItem);
Wait(2000);
end.
# Chain two different menu hooks
WaitMenu('What would you like', 'Ingots')
WaitMenu('Select material', 'Iron')
UseObject(FindItem())
Wait(2000)