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

SetContextMenuHook

Installs a hook that automatically selects a specific entry from the next context menu received for the specified object.

MenuID — serial (ID) of the object whose context menu should be hooked.

EntryNumber — zero-based index of the context menu entry to automatically select.

When a context menu for the matching object arrives from the server, the specified entry is automatically chosen and sent back to the server, as if the player had clicked it. The hook is consumed after one use.

Use RequestContextMenu to trigger the context menu after setting the hook.

Устанавливает перехватчик, который автоматически выбирает указанный пункт из следующего полученного контекстного меню для заданного объекта.

MenuID — serial (ID) объекта, контекстное меню которого перехватывается.

EntryNumber — индекс пункта контекстного меню (с нуля), который будет автоматически выбран.

При получении контекстного меню для совпадающего объекта указанный пункт автоматически выбирается и отправляется серверу, как если бы игрок по нему кликнул. Перехватчик срабатывает один раз.

Используйте RequestContextMenu для вызова контекстного меню после установки перехватчика.

Pascal

procedure SetContextMenuHook(MenuID: Cardinal; EntryNumber: Byte);

Python

def SetContextMenuHook(MenuID: int, EntryNumber: int) -> None: ...

Pascal Example

begin
  // Hook to auto-select "Open Paperdoll" (entry 0) on self
  SetContextMenuHook(Self, 0);
  RequestContextMenu(Self);
  Wait(1000);
  AddToSystemJournal('Context menu hook triggered');
end.

Python Example

# Hook to auto-select "Open Paperdoll" (entry 0) on self
SetContextMenuHook(Self(), 0)
RequestContextMenu(Self())
Wait(1000)
AddToSystemJournal('Context menu hook triggered')

See Also

RequestContextMenu, GetContextMenu, ClearContextMenu