Page 1 of 1

Packet 0xC1

Posted: Tue Mar 07, 2006 10:19 pm
by Beaud
Send Speech [0x1C]

Code: Select all

Send Speech (Variable # of bytes)
BYTE cmd
BYTE[2] blockSize
BYTE[4] itemID (FF FF FF FF = system)
BYTE[2] model (item hex # - FF FF = system)
BYTE Type
BYTE[2] Text Color
BYTE[2] Font
BYTE[30] Name
BYTE[?] Null-Terminated Message (? = blockSize - 44)
Now heres my script( its not working its too long )
Here's pol output

Code: Select all

Unexpected message type e0, 3 bytes (IP:127.0.0.1, Account:admin)
0000: e0 86 2c                                           ..,..... ........
Client#2: Too-long message length of 27360
Here's my code

Code: Select all

Use uo;
use os;
use polsys;
use cfgfile;

program SingleClickHook()
	Print("Hooking Single Click 0x09");
	return 1;
endprogram

const SPEECH_PKT := 0x1c;

const TYPE_TEXT := 0;
const TEXT_FONT := 3;
const TEXT_COLOR := 910;

Exported Function SendSpeechPacket( character, byref packet )
	var objserial := packet.GetInt32(1);
  var mobserial := SystemFindObjectBySerial(character);
  objserial := SystemFindObjectBySerial(objserial);
  if(!objserial.IsA(POLCLASS_ITEM))
  	return;
  endif
  var outpkt := CreatePacket(SPEECH_PKT, MSGLEN_VARIABLE);             
  outpkt.SetInt16(1, outpkt.GetSize()); // set the size of the packet
  outpkt.SetInt32(3, objserial); // set the serial of the item
  outpkt.SetInt16(7, objserial.objtype); // set the model of the item 
  outpkt.SetInt8(9, TYPE_TEXT); // set the type of text
  outpkt.SetInt16(10, TEXT_COLOR); // set the text color
  outpkt.SetInt16(12, TEXT_FONT); // set the text font
  outpkt.SetString(14, objserial.name, 1); // set the item name
  outpkt.SendPacket(character);
  
EndFunction
Any help is appreciated. :P

Posted: Wed Mar 08, 2006 2:22 am
by CWO
Wierd... it doesnt look like its complaining of the packet 0x1C... the output on the console is complaining about 0xe0 and its only being sent as 3 bytes after what I think POL is saying that its declaring a size much larger than that...

Posted: Wed Mar 08, 2006 11:06 am
by Beaud
This message is changing at each modification I make :S.

Posted: Wed Mar 08, 2006 4:13 pm
by CWO
is there a mistake in your script? You set objserial variable from the first byte of the packet but its actually the third...

Also, from what I see, you're just changing the color if its an item.. You dont need to recreate the packet at all. Just change the color byte in the "packet" variable and send it.

Code: Select all

Use uo;
use os;
use polsys;
use cfgfile;

program SingleClickHook()
   Print("Hooking Single Click 0x09");
   return 1;
endprogram

const SPEECH_PKT := 0x1c;

const TYPE_TEXT := 0;
const TEXT_FONT := 3;
const TEXT_COLOR := 910;

Exported Function SendSpeechPacket( character, byref packet )
  var objserial := packet.GetInt32(3);
  objserial := SystemFindObjectBySerial(objserial);
  if(!objserial.IsA(POLCLASS_ITEM))
     return;
  endif
  packet.SetInt8(9, TYPE_TEXT); // set the type of text
  packet.SetInt16(10, TEXT_COLOR); // set the text color
  packet.SetInt16(12, TEXT_FONT); // set the text font
  packet.SendPacket(character);
  return 1;
EndFunction

Posted: Thu Mar 09, 2006 10:33 am
by Beaud
Nah this is 0x09 hook, so the BYTE[1] is the serial. And, if I don't see how it could send that pkt if I don't specify the the name, serial in 0x1C

Posted: Thu Mar 09, 2006 12:43 pm
by CWO
ahh ok... another thing to check...

outpkt.SetInt32(3, objserial); // set the serial of the item

shouldnt that be

outpkt.SetInt32(3, objserial.serial); // set the serial of the item

since you set objserial to the objref?