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

WaitForClientGumpResponse

Waits until the client answers the gump with this Serial, shown by SendGumpToClient.

MaxWaitTimeMS — maximum wait time in milliseconds. In Pascal, -1 waits indefinitely.

Returns True if the answer is present (read it with ClientGumpResponse), False if the time ran out or the script was stopped. Returns True at once if the answer came earlier.

In Pascal the check runs every 100 ms, so the wait may overshoot the timeout by up to 100 ms. In Python this is a helper of py_astealth over ClientGumpResponsePresent; it checks every 10 ms and does not treat -1 as “forever”.

Ожидает ответа клиента на гамп с этим Serial, показанный через SendGumpToClient.

MaxWaitTimeMS — максимальное время ожидания в миллисекундах. В Pascal -1 — ждать бесконечно.

Возвращает True, если ответ есть (читается через ClientGumpResponse), False — если время вышло или скрипт остановлен. Если ответ пришёл раньше, сразу возвращает True.

В Pascal проверка идёт каждые 100 мс, поэтому ожидание может превысить таймаут до 100 мс. В Python это хелпер py_astealth поверх ClientGumpResponsePresent: проверка каждые 10 мс, -1 «бесконечностью» не считается.

Pascal

function WaitForClientGumpResponse(Serial: Cardinal; MaxWaitTimeMS: Integer): Boolean;

Python

def WaitForClientGumpResponse(serial: int, max_wait_ms: int) -> bool: ...

Pascal Example

var
  Serial: Cardinal;
  G: TGumpInfo;
begin
  // ... fill G ...
  Serial := SendGumpToClient(G);
  if WaitForClientGumpResponse(Serial, 60000) then
    AddToSystemJournal('Button: ' + IntToStr(ClientGumpResponse(Serial).ButtonID))
  else
    AddToSystemJournal('No answer within a minute');
end.

Python Example

serial = SendGumpToClient(g)
if WaitForClientGumpResponse(serial, 60000):
    AddToSystemJournal(f'Button: {ClientGumpResponse(serial).ButtonID}')
else:
    AddToSystemJournal('No answer within a minute')

See Also

SendGumpToClient, ClientGumpResponse, ClientGumpResponsePresent