0xBF Subcommand 4

Here you can discuss packets, implementation and design, and software related to the packet sniffing and such. This is not the place to post packages for POL, but rather discuss the packet side of them.

Moderator: POL Developer

Post Reply
blckfire
Apprentice Poster
Posts: 54
Joined: Thu Feb 26, 2015 10:28 am

0xBF Subcommand 4

Post by blckfire » Wed Jun 24, 2015 1:39 pm

I'm using POL96 so I don't have the CloseGump function.

I'm trying to build this packet to send it to the client so that it closes a gump before opening another one.

So, I am able to send the packet, but the client then stops after a few steps

Code: Select all

function CloseGump(mobile, pid, retval := 0)
	var packet := CreatePacket(0xBF, 13);
	packet.SetInt16(1, 0x4);
	packet.SetInt32(3, pid);
	packet.SetInt32(7, retval);
	packet.SendPacket(mobile);
	
	return 1;
endfunction
Do I need to do anything else? after I send this packet?

blckfire
Apprentice Poster
Posts: 54
Joined: Thu Feb 26, 2015 10:28 am

Re: 0xBF Subcommand 4

Post by blckfire » Wed Jun 24, 2015 2:11 pm

It is now solved. I was making some mistakes with the offsetts.

Code: Select all

use uo;
use os;
use polsys;

function CloseGump(mobile, pid, retval := 0)
	var packet := CreatePacket(0xBF, -1);
	packet.SetInt16(3, 0x4);
	packet.SetInt32(5, pid);
	packet.SetInt32(9, retval);
	
	var result := packet.SendPacket(mobile);
	if(!result)
		SendSysMessage(mobile, "Error: "+result);
	endif
	
	GetProcess(pid).kill();
	
	return 1;
endfunction
I post the code to do this in case someone wants to use this.

Harley
Forum Regular
Posts: 318
Joined: Sat Mar 18, 2006 1:41 am
Location: Germany

Re: 0xBF Subcommand 4

Post by Harley » Wed Jun 24, 2015 2:51 pm

Nice one! Are u using it like packethook?

blckfire
Apprentice Poster
Posts: 54
Joined: Thu Feb 26, 2015 10:28 am

Re: 0xBF Subcommand 4

Post by blckfire » Fri Jun 26, 2015 5:47 am

Nope. Just created a custom function to send the package out to the client and it works like a charm.

It basically allows you to emulate the CloseGump() function from later cores.

Eventually I'm going to upgrade the whole server to POL99 but for now I'll have to use this workaround.

As a side note:
Also, I decided to kill the script afterwards to make sure no crumbs are left behind.

Post Reply