Code: Select all
exported function HandleSpeech( character, byref packet )
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
// the variable 'speech' is now the exact text they said. Do whatever you want with it from here.