http://packets.polserver.com/index.php?op=showpacket&packet=0xBF, the key is subcommand 4.
Example function exists in distro, gumps_ex.inc in gumps package.
Code:
function GFCloseGump(mobile, pid, ret_val:=0)
var packet := CreatePacket(0xBF, 13);
packet.SetInt16(1, 13);
packet.SetInt16(3, 4);
packet.SetInt32(5, pid);
packet.SetInt32(9, ret_val);
return packet.SendPacket(mobile);
endfunction
In POL, dialogID is the pid of the script that sent the gump. See the command below.
textcmd .closegump
Code:
use os;
use uo;
include ":gumps:gumps";
include ":gumps:gumps_ex";
include ":gumps:yesno";
program command_closegump( who, param )
if (param)
var closegump := who.GetProp("#CloseGumpPID");
if (closegump)
GFCloseGump(who, closegump);
who.EraseProp("#CloseGumpPID");
return 1;
endif
endif
who.SetProp("#CloseGumpPID", GetPid());
YesNo(who, "This gump will close if you write .closegump 1");
who.EraseProp("#CloseGumpPID");
return 1;
endprogram
According the sourcefiles I have, this should compile and work. The idea anyway is correct.
--
Note though, it is possible that client does not reply if you close gump this way. Because of that, the script that sent the gump will turn into zombie, waiting for something to happen that will never occur. Only "workaround" I can think of is to kill the zombie process.
If you know how this could be avoided, I sure am willing to know.
--
edit: fixed a typo.