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

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.

Не выполняет действий, если персонаж не подключён.

Pascal

procedure RequestContextMenu(ObjID: Cardinal);

Python

def RequestContextMenu(ObjID: int) -> None: ...

Pascal Example

begin
  ClearContextMenu;
  RequestContextMenu(Self);
  Wait(1000);
  AddToSystemJournal('Context menu items: ' + IntToStr(Length(GetContextMenu)));
end.

Python Example

ClearContextMenu()
RequestContextMenu(Self())
Wait(1000)
menu = GetContextMenu()
AddToSystemJournal(f'Context menu items: {len(menu)}')
for line in menu:
    AddToSystemJournal(line)

See Also

GetContextMenu, SetContextMenuHook, ClearContextMenu