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
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...
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.
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