Can anyone explain where the characters input is in this packet and how to convert it to text i can read?
I just cant get my head around this packet :/ An example would be ideal. Thanks.
How to get speech from 0xAD packet
Moderator: POL Developer
-
- Grandmaster Poster
- Posts: 120
- Joined: Thu Jan 18, 2007 2:34 am
Its a pain to get text from this because it all depends on if they have speech.mul or not and if so, how many tokens from speech.mul they're using. If GetInt8(3) != 0xC0 then its at offset 12 as a Unicode string.
if GetInt8(3) == 0xC0 then...
the number of speech.mul triggers is the last 4 BITS of GetInt8(12) and the first 4 bits of GetInt8(13) the last 4 bits of 13 is 1/3 of the first trigger. Each trigger is 1 1/2 bytes.
Not gonna guarantee this code since I tested it only a little bit but it would be something like...
if GetInt8(3) == 0xC0 then...
the number of speech.mul triggers is the last 4 BITS of GetInt8(12) and the first 4 bits of GetInt8(13) the last 4 bits of 13 is 1/3 of the first trigger. Each trigger is 1 1/2 bytes.
Not gonna guarantee this code since I tested it only a little bit but it would be something like...
Code: Select all
var speech := "";
var speechstart := 12;
if (packet.GetInt8(3) == 0xC0)
var triggers := packet.GetInt16(12)/16;
var bytes := CInt(triggers*1.5 + 2);
speechstart := CInt(speechstart + bytes);
var speechlen := packet.GetInt16(1) - 1 - speechstart;
speech := CStr(packet.GetString(speechstart, speechlen));
else
var speechlen := (packet.GetInt16(1) - 13)/2;
speech := CChrZ(packet.GetUnicodeString(speechstart, speechlen));
endif
SendSysMessage(character, speech);
Last edited by CWO on Mon Apr 09, 2007 4:47 am, edited 4 times in total.
-
- Grandmaster Poster
- Posts: 120
- Joined: Thu Jan 18, 2007 2:34 am