60 lines
3.8 KiB
Plaintext
60 lines
3.8 KiB
Plaintext
//::////////////////////////////////////////////////////////////////////////:://
|
|
//:: SIMTools V2.1 Speech Integration & Management Tools Version 2.1 :://
|
|
//:: Created By: FunkySwerve :://
|
|
//:: Created On: April 4 2006 :://
|
|
//:: Last Updated: September 29 2006 :://
|
|
//:: With Thanks To: :://
|
|
//:: Dumbo - for his amazing plugin :://
|
|
//:: Virusman - for Linux versions, and for the reset plugin :://
|
|
//:: Dazzle - for his script samples :://
|
|
//:: Butch - for the emote wand scripts :://
|
|
//:: The DMFI project - for the languages conversions and many of the emotes:://
|
|
//:: Lanessar and the players of the Myth Drannor PW - for the new languages:://
|
|
//::////////////////////////////////////////////////////////////////////////:://
|
|
#include "fky_chat_inc"
|
|
void main()
|
|
{
|
|
//////////////////////////////////Declarations//////////////////////////////////
|
|
object oPC = OBJECT_SELF, oTarget;// Speaker = oPC
|
|
string sText, sNewText, sLogMessage, sLogMessageTarget, sType, sTarget, sInvite, sSort;
|
|
int nChannel, nTarget;
|
|
/////////////////////////Gather Message and Target Data/////////////////////////
|
|
SetLocalString(oPC, "NWNX!CHAT!TEXT", Speech_GetSpacer()); // Query for chattext
|
|
sText = GetLocalString(oPC, "NWNX!CHAT!TEXT"); // Get chattext
|
|
nChannel = StringToInt(GetStringLeft(sText, 2)); // Get channel
|
|
nTarget = StringToInt(GetSubString(sText, 2, 10)); // Target ID - Return value of -1 is no target. IE, not a tell/privatemessage
|
|
sText = GetStringRight(sText, GetStringLength(sText) - 12);// Remove Target & Channel Info
|
|
if( nTarget != -1 )// Acquire possible target
|
|
{
|
|
oTarget = Speech_GetPlayer(nTarget);
|
|
sLogMessageTarget = "->" + GetName(oTarget) + "(" + GetPCPlayerName(oTarget) + ")";
|
|
}
|
|
sType = GetSubString(sText, 0, 1);//this is the primary sorting string, the leftmost letter of the text
|
|
////////////////////////////////Speech Processing///////////////////////////////
|
|
if (sType == EMOTE_SYMBOL) HandleEmotes(oPC, sText, nChannel);//emotes - taken from Emote-Wand V1000 UpDate Scripted By: Butch (with edits)
|
|
else if (sType == COMMAND_SYMBOL) HandleCommands(oPC, oTarget, sText, nChannel);//commands
|
|
else if (sType == "/")// metachannels and languages
|
|
{
|
|
SetLocalString(oPC, "NWNX!CHAT!SUPRESS", "1");
|
|
sText = GetStringRight(sText, GetStringLength(sText) - 1);
|
|
sSort = GetStringLeft(sText, 2);
|
|
if (ENABLE_LANGUAGES && sSort == "l ") HandleOneLiners(sText, oPC, nChannel);//must be a space after the /l
|
|
else if (ENABLE_METACHANNELS && sSort == "m ") HandleMetaMessage(sText, oPC);//must be a space after the /m
|
|
else if ((VerifyDMKey(oPC) || VerifyAdminKey(oPC)) && sSort == "v ") HandleVentrilo(sText, oPC);//must be a space after the /m
|
|
else FloatingTextStringOnCreature(COLOR_RED+BADCHANNEL+COLOR_END, oPC, FALSE);
|
|
}
|
|
else HandleOtherSpeech(oPC, oTarget, sText, nChannel, sLogMessageTarget);
|
|
////////////////////////////////////Logging/////////////////////////////////////
|
|
if (TEXT_LOGGING_ENABLED)//outside the if/else structure since it always logs if on
|
|
{
|
|
// Log Message
|
|
sLogMessage = GetName(oPC) + "(" + GetPCPlayerName(oPC) + ")" + sLogMessageTarget + "[" + Speech_GetChannel(nChannel) + "] " + sText + "\n";
|
|
// Log
|
|
SetLocalString(oPC, "NWNX!CHAT!LOG", sLogMessage);
|
|
}
|
|
////////////////////////////////////Cleanup/////////////////////////////////////
|
|
DeleteLocalString(oPC, "NWNX!CHAT!TEXT");
|
|
DeleteLocalString(oPC, "NWNX!CHAT!SUPRESS");
|
|
DeleteLocalString(oPC, "NWNX!CHAT!LOG");
|
|
}
|