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 «бесконечностью» не считается.
function WaitForClientGumpResponse(Serial: Cardinal; MaxWaitTimeMS: Integer): Boolean;
def WaitForClientGumpResponse(serial: int, max_wait_ms: int) -> bool: ...
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.
serial = SendGumpToClient(g)
if WaitForClientGumpResponse(serial, 60000):
AddToSystemJournal(f'Button: {ClientGumpResponse(serial).ButtonID}')
else:
AddToSystemJournal('No answer within a minute')
SendGumpToClient, ClientGumpResponse, ClientGumpResponsePresent