ClientGumpResponse
Returns the client’s answer to a gump the script showed with SendGumpToClient. Serial is the value SendGumpToClient returned.
The answer is stored as soon as the client sends it, before the evClientGumpReply event fires, so it can be read from the event handler. Reading does not remove it: it can be read any number of times and stays until the character state is reset (disconnect). If there is no answer for this Serial yet, an empty record is returned (Serial = 0) — check ClientGumpResponsePresent first.
- ButtonID —
return_valueof the pressed button.0means the gump was closed without a button (right click, Esc). - Switches —
return_valueof every checked checkbox and selected radio button. - TextEntries — every text entry of the gump:
IDis itsreturn_value,Textis what the player typed.
Возвращает ответ клиента на гамп, показанный скриптом через SendGumpToClient. Serial — значение, которое вернул SendGumpToClient.
Ответ сохраняется сразу, как только клиент его прислал, — раньше, чем срабатывает событие evClientGumpReply, поэтому его можно читать прямо из обработчика события. Чтение ответ не удаляет: его можно читать сколько угодно раз, он хранится до сброса состояния персонажа (дисконнекта). Если ответа на этот Serial ещё нет, возвращается пустая запись (Serial = 0) — сначала проверьте ClientGumpResponsePresent.
- ButtonID —
return_valueнажатой кнопки.0— гамп закрыли без кнопки (правый клик, Esc). - Switches —
return_valueвсех отмеченных чекбоксов и выбранных радиокнопок. - TextEntries — все поля ввода гампа:
ID— ихreturn_value,Text— что ввёл игрок.
function ClientGumpResponse(Serial: Cardinal): TClientGumpResponse;
Type definition:
TClientGumpTextResponse = packed record
ID: Integer; // text entry return_value
Text: String;
end;
TClientGumpResponse = packed record
Serial: Cardinal;
GumpID: Cardinal;
ButtonID: Integer;
Switches: TArray<Integer>;
TextEntries: TArray<TClientGumpTextResponse>;
end;
def ClientGumpResponse(Serial: int) -> ClientGumpResponse: ...
The returned object has fields Serial, GumpID, ButtonID, Switches (list of int) and TextEntries (list of objects with ID and Text).
Reading the answer in the event handler:
procedure OnClientGumpReply(Serial, GumpID: Cardinal; ButtonID: Integer);
var
R: TClientGumpResponse;
i: Integer;
begin
R := ClientGumpResponse(Serial);
AddToSystemJournal('Button: ' + IntToStr(R.ButtonID));
for i := 0 to Length(R.Switches) - 1 do
AddToSystemJournal('Checked: ' + IntToStr(R.Switches[i]));
for i := 0 to Length(R.TextEntries) - 1 do
AddToSystemJournal('Entry ' + IntToStr(R.TextEntries[i].ID) + ': ' + R.TextEntries[i].Text);
end;
begin
SetEventProc(evClientGumpReply, 'OnClientGumpReply');
// ... SendGumpToClient(...) ...
while True do
Wait(100);
end.
def on_client_gump_reply(serial, gump_id, button_id):
r = ClientGumpResponse(serial)
AddToSystemJournal(f'Button: {r.ButtonID}, checked: {r.Switches}')
for t in r.TextEntries:
AddToSystemJournal(f'Entry {t.ID}: {t.Text}')
SetEventProc(EventType.EvClientGumpReply, on_client_gump_reply)
# ... SendGumpToClient(...) ...
while True:
Wait(100)
SendGumpToClient, ClientGumpResponsePresent, WaitForClientGumpResponse, evClientGumpReply