RequestContextMenu
Sends a request to the server for the context menu of the specified object.
ObjID — serial (ID) of the object whose context menu is requested.
The request is only sent if the server’s feature flags include context menu support. If context menus are not enabled on the shard, the call does nothing.
The response arrives asynchronously. Use GetContextMenu to retrieve the menu items after a short delay. It is recommended to call ClearContextMenu before requesting to ensure you receive fresh data.
To automatically select a context menu entry when it arrives, use SetContextMenuHook.
Does nothing if the character is not connected.
Отправляет серверу запрос контекстного меню для указанного объекта.
ObjID — serial (ID) объекта, для которого запрашивается контекстное меню.
Запрос отправляется только если флаги возможностей сервера включают поддержку контекстных меню. Если контекстные меню на шарде не включены, вызов ничего не делает.
Ответ приходит асинхронно. Используйте GetContextMenu для получения пунктов меню после небольшой задержки. Рекомендуется вызывать ClearContextMenu перед запросом, чтобы получить свежие данные.
Для автоматического выбора пункта контекстного меню при его получении используйте SetContextMenuHook.
Не выполняет действий, если персонаж не подключён.
procedure RequestContextMenu(ObjID: Cardinal);
def RequestContextMenu(ObjID: int) -> None: ...
begin
ClearContextMenu;
RequestContextMenu(Self);
Wait(1000);
AddToSystemJournal('Context menu items: ' + IntToStr(Length(GetContextMenu)));
end.
ClearContextMenu()
RequestContextMenu(Self())
Wait(1000)
menu = GetContextMenu()
AddToSystemJournal(f'Context menu items: {len(menu)}')
for line in menu:
AddToSystemJournal(line)