View previous topic :: View next topic |
Author |
Message |
Lugoun
Joined: 18 May 2007 Posts: 36
|
Posted: Mon Dec 15, 2008 8:51 Post subject: |
|
|
I just added xp_chat and everything is working good, but I am looking for some different logging than what is available now.
Currently the xp_chat.txt file is recording the messages as per my chat script file calling NWNXChat_Log().
However, xp_chat.txt is cleared whenever the server is restarted.
Is there a method to setting up a separate log that just continues to append the messages from restart to restart?
Thanks, _________________ Lugoun
www.hotta-rpg.org |
|
Back to top |
|
|
PNJ
Joined: 30 Jun 2007 Posts: 67
|
Posted: Mon Dec 15, 2008 16:23 Post subject: |
|
|
Use the command WriteStamp to store the chat in your server log, but watchout for the spam. |
|
Back to top |
|
|
Lugoun
Joined: 18 May 2007 Posts: 36
|
Posted: Mon Dec 15, 2008 20:12 Post subject: |
|
|
ahh ha, ok thanks PNJ for the reply here and the NWN2 forums helping me with my WriteTimestampedLogEntry issue. _________________ Lugoun
www.hotta-rpg.org |
|
Back to top |
|
|
dmguild
Joined: 20 Sep 2007 Posts: 15
|
Posted: Wed Dec 31, 2008 18:01 Post subject: |
|
|
What do I need to do to implement this? There is no Readme or instructions on how to use it.
Is it as simple as loading the plugin with NWNX4, copying the nwnx_chat script into your module, and adding the NWNXChat_PCEnter and NWNXChat_PCExit functions into the modules onenter and exit scripts?
I've searched the forms for some instructions, but it's frustrating trying to find anything here. It would be nice if there was a readme or something describing how to install / use and what all these awesome plugins can do for an NWNX4 capable PW. |
|
Back to top |
|
|
GodBeastX
Joined: 09 Aug 2006 Posts: 65
|
Posted: Mon Jan 05, 2009 22:47 Post subject: |
|
|
dmguild wrote: | What do I need to do to implement this? There is no Readme or instructions on how to use it.
Is it as simple as loading the plugin with NWNX4, copying the nwnx_chat script into your module, and adding the NWNXChat_PCEnter and NWNXChat_PCExit functions into the modules onenter and exit scripts?
I've searched the forms for some instructions, but it's frustrating trying to find anything here. It would be nice if there was a readme or something describing how to install / use and what all these awesome plugins can do for an NWNX4 capable PW. |
Pretty much how you set it up. There's also an INI which tells what script will get called when chat happens. |
|
Back to top |
|
|
dmguild
Joined: 20 Sep 2007 Posts: 15
|
Posted: Sat Jan 10, 2009 22:00 Post subject: |
|
|
GodBeastX wrote: | dmguild wrote: | What do I need to do to implement this? There is no Readme or instructions on how to use it.
Is it as simple as loading the plugin with NWNX4, copying the nwnx_chat script into your module, and adding the NWNXChat_PCEnter and NWNXChat_PCExit functions into the modules onenter and exit scripts?
I've searched the forms for some instructions, but it's frustrating trying to find anything here. It would be nice if there was a readme or something describing how to install / use and what all these awesome plugins can do for an NWNX4 capable PW. |
Pretty much how you set it up. There's also an INI which tells what script will get called when chat happens. |
Thanks, so I can just edit that script to log what I want and use it to script other voice commands? |
|
Back to top |
|
|
dmguild
Joined: 20 Sep 2007 Posts: 15
|
Posted: Sat Jan 10, 2009 22:28 Post subject: |
|
|
Does anyone have the demo module listed a few pages back? The link is broken.
or
Does anyone have a sample chat_script?
I'm using;
NWNX4 Chat Plugin V.0.3.6
NWNX1.9 |
|
Back to top |
|
|
Lugoun
Joined: 18 May 2007 Posts: 36
|
Posted: Fri Jan 16, 2009 1:01 Post subject: |
|
|
I opened up the NWN1 version of the chat script and found some samples and other goodies here and there in the threads that I updated for NWN2 & NWNX4.
Hopefully something will be useful to you.
First here is a copy and paste from the NWN1 sample chat script:
Code: |
//::///////////////////////////////////////////////
//:: chat_script
//:: FileName
//:: Copyright (c) 2005 dumbo (dumbo@nm.ru)
//:://////////////////////////////////////////////
/*
### ! for use with Chat plugin for NWNX ! ###
some debug information, some emotes and log
msg modes:
1: talk
2: shout
3: whisper
4: private
5: srv?
6: party
if msg from DM, then nMode += 16 (17 - DM talk, 19 - DM whisper...)
*/
//:://////////////////////////////////////////////
//:: Created By: dumbo
//:: Created On: 2005-09-08
//:://////////////////////////////////////////////
#include "dmb_chat"
void main()
{
// speaking object
object oPC = OBJECT_SELF;
object oPCn;
string sMsg = "speaker name="+GetName(oPC);
// debug string
SendMessageToPC(oPC, sMsg);
// get text
SetLocalString(oPC, "NWNX!CHAT!TEXT", dmb_GetSpacer());
string sText = GetLocalString(oPC, "NWNX!CHAT!TEXT");
int nMode = StringToInt(GetStringLeft(sText,2));
int nTo = StringToInt(GetSubString(sText,2,10));
SendMessageToPC(oPC, sText);
sText = dmb_GetStringFrom(sText, 12);
// debug string
string sMsgT = "mode="+IntToString(nMode)+", to="+IntToHexString(nTo)+", str="+sText;
SendMessageToPC(oPC, sMsgT);
// sample of suppress message
if (GetSubString(sText, 0, 1)=="*")
{
sText = dmb_GetStringFrom(sText);
// 0 4 9
int nPos = FindSubString("sit pray hi", sText);
switch (nPos)
{
case 0: ActionPlayAnimation(ANIMATION_LOOPING_SIT_CROSS, 1.0, 10000.0); break;
case 4: ActionPlayAnimation(ANIMATION_LOOPING_MEDITATE, 1.0, 10000.0); break;
case 9: ActionPlayAnimation(ANIMATION_FIREFORGET_SALUTE); SpeakString("Hello!"); break;
}
SetLocalString(oPC, "NWNX!CHAT!SUPRESS", "1");
}
else if (GetSubString(sText, 0, 1)=="!")
{
sText = dmb_GetStringFrom(sText);
// 0 4 9
int nPos = FindSubString("gfp pray hi", sText);
switch (nPos)
{
case 0:
{
oPCn = GetFirstPC();
while (GetIsObjectValid(oPCn))
{
SendMessageToPC(oPC, "["+GetPCPlayerName(oPCn)+"] "+GetName(oPCn));
oPCn = GetNextPC();
}
}
case 4: ActionPlayAnimation(ANIMATION_LOOPING_MEDITATE, 1.0, 10000.0); break;
case 9: ActionPlayAnimation(ANIMATION_FIREFORGET_SALUTE); SpeakString("Hello!"); break;
}
SetLocalString(oPC, "NWNX!CHAT!SUPRESS", "1");
}
else
{
sMsg = "["+GetPCPlayerName(OBJECT_SELF)+"] "+GetName(OBJECT_SELF);
if (nMode==1 || nMode==3)
{
int nIdx = 1;
float fDst = 3.0;
if (nMode==1)
{
fDst = 10.0;
sMsg += " >talk> ";
}
else
sMsg += " >whisper> ";
while (GetIsObjectValid(oPCn=GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR,
PLAYER_CHAR_IS_PC,
OBJECT_SELF, nIdx++)))
if (GetDistanceToObject(oPCn) < fDst &&
oPCn != oPC)
sMsg += GetName(oPCn)+":";
else break;
}
else if (nMode==2)
sMsg += " >shout> All";
else if (nMode==6)
{
sMsg += " >party> ";
oPCn = GetFirstFactionMember(OBJECT_SELF, TRUE);
while (GetIsObjectValid(oPCn))
{
if (oPCn != oPC)
sMsg += GetName(oPCn)+":";
oPCn = GetNextFactionMember(OBJECT_SELF, TRUE);
}
}
else if (nMode==4)
{
oPCn = dmb_getPC(nTo);
sMsg += " >private> " + "["+GetPCPlayerName(oPCn)+"] "+GetName(oPCn);
}
else
{
sMsg += " >DM> ";
oPCn = GetFirstPC();
while (GetIsObjectValid(oPCn))
{
if (GetIsDM(oPCn))
sMsg += " ["+GetPCPlayerName(oPCn)+"] "+GetName(oPCn)+":";
oPCn = GetNextPC();
}
}
SetLocalString(oPC, "NWNX!CHAT!LOG", sMsg+"\n");
SetLocalString(oPC, "NWNX!CHAT!LOG", " *** "+sText+"\n");
}
// remove garbage
DeleteLocalString(oPC, "NWNX!CHAT!TEXT");
DeleteLocalString(oPC, "NWNX!CHAT!SUPRESS");
}
|
Here is a sample of a work in process I had (just copied from my notepad notes I have at work and not complied or error checked, etc., etc.)
Code: |
#include "nwnx_chat"
void main()
{
//Get chat message
string sMsg = NWNXChat_GetMessageText();
//Get PC Speaker, and ID Information
object oPC=OBJECT_SELF;
string sSpeakerData = GetName(oPC) + " [" + GetPCPlayerName(oPC) + "]";
//Get chat mode, ID of target player, and chat message body
int nMode = StringToInt(GetStringLeft(sMsg,2));
int nTo = StringToInt(GetSubString(sMsg,2,10));
string sChatText = GetStringFrom(sMsg, 12);
string sMode;
string sChatTargetPC;
object oPCTarget;
if(nMode == CHAT_CHANNEL_SERVER_MSG)
{
return;
}
else if (nMode == CHAT_CHANNEL_TALK || nMode== CHAT_CHANNEL_WHISPER)
{
int nIdx = 1;
float fDst;
if (nMode==1)
{
fDst = 10.0;
sMode = "<LOCAL>";
}
else
{
fDst= 3.0;
sMode = "<WHISPER>";
}
while (GetIsObjectValid(oPCTarget=GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, OBJECT_SELF, nIdx++)))
{
if (GetDistanceToObject(oPCTarget) <= fDst && oPCTarget != oPC)
sChatTargetPC += GetName(oPCTarget) + ":";
else break;
}
}
else if(nMode == CHAT_CHANNEL_SHOUT)
{
sMode = "<SHOUT>";
sChatTargetPC = "ALL"
{
else if(nMode == CHAT_CHANNEL_PARTY)
{
sMode = "<PARTY>";
oPCTarget = GetFirstFactionMember(oPC, TRUE);
while(GetIsObjectValid(oPCTarget))
{
if(oPCTarget != oPC)
sChatTargetPC += GetName(oPCTarget) + ":";
oPCTarget = GetNextFactionMember(oPC, TRUE);
}
}
else if(nMode == CHAT_CHANNEL_PRIVATE)
{
sMode = "<PRIVATE>";
oPCTarget = NWNXChat_GetPCByPlayerID(nTo);
sChatTargetPC += GetName(oPCTarget) + ":";
}
else if(nMode == CHAT_CHANNEL_DM)
{
sMode = "<DM>";
oPCTarget = NWNXChat_GetPCByPlayerID(nTo);
if(GetIsObjectValid(oPCTarget))
sChatTargetPC += GetName(oPCTarget) + ":";
}
else
{
sMode = "<OTHER>";
oPCTarget = NWNXChat_GetPCByPlayerID(nTo);
if(GetIsObjectValid(oPCTarget))
sChatTargetPC += GetName(oPCTarget) + ":";
}
//Structure Message for Logs or DMs
string sChatMessage = sMode + " #FROM: " + sSpeakerData + " #TO: " + sChatTarget + " #Message: " + sChatText;
WriteTimestampedLogEntry(sChatMessage);
if(GetLocalInt(GetModule(), "HOTTA_DM_LISTENING") == TRUE)
{
Object oDM = GetFirstPC();
while(GetIsObjectValid(oDM))
{
if(GetIsDM(oDM) && GetLocalInt(oDM, "HOTTA_DM_LISTENING"))
{
SendMessageToPC(oDM, sChatMessage);
}
oDM = GetNextPC();
}
}
}
|
_________________ Lugoun
www.hotta-rpg.org |
|
Back to top |
|
|
dmguild
Joined: 20 Sep 2007 Posts: 15
|
Posted: Fri Jan 16, 2009 2:55 Post subject: |
|
|
Outstanding! Thank you so much I am going to play with it now.... |
|
Back to top |
|
|
dmguild
Joined: 20 Sep 2007 Posts: 15
|
Posted: Fri Jan 16, 2009 3:36 Post subject: |
|
|
Just to make sure I got this right.
name this script something like chat_script
make modificatinos to what i want to do and fix a couple things like the wrong {, a mising ; and one mispelled variable compile it, put it on the server
and make sure the xp_chat.ini calls out the chat_script (no extension)
what are the options for loglevel=?
then this will send messages to the log file xp_chat.txt?
will the xp_chat.txt be overwritten every time or will it append or rotate?
thanks |
|
Back to top |
|
|
dmguild
Joined: 20 Sep 2007 Posts: 15
|
Posted: Fri Jan 16, 2009 4:29 Post subject: |
|
|
Hmmmm it's writing the messages to the nwserverLog1.txt but not the xp_chat.txt is that normal?
Is there a way I can use this to capture what someone says and either change it or squash it before sending to the destination player(s)? |
|
Back to top |
|
|
Lugoun
Joined: 18 May 2007 Posts: 36
|
Posted: Wed Feb 04, 2009 20:36 Post subject: |
|
|
Not sure if you need this still, I only pop in once in awhile to see whats happening
The answer is definitely yes. You can see in the NWN1 chat script calls to SetLocalString(oPC, "NWNX!CHAT!SUPRESS",1);
You can apply the same theory of operation in that example to the NWN2 code:
void NWNXChat_SuppressMessage();
You can take the string of text of the original chat message and chop it up/change it however you want and then use
int NWNXChat_SendMessage(object oSender, int nChannel, string sMessage, object oRecipient=OBJECT_INVALID);
To resend out your modified message.
Here's a rough example of this (jotted out in notepad and not compiled, etc):
Code: |
#include "nwnx_chat"
void main()
{
//Get chat message
string sMsg = NWNXChat_GetMessageText();
//Get PC Speaker, and ID Information
object oPC=OBJECT_SELF;
string sSpeakerData = GetName(oPC) + " [" + GetPCPlayerName(oPC) + "]";
//Get chat mode, ID of target player, and chat message body
int nMode = StringToInt(GetStringLeft(sMsg,2));
int nTo = StringToInt(GetSubString(sMsg,2,10));
string sChatText = GetStringFrom(sMsg, 12);
//some variables to be used
string sChatTextMod;
object oPCTarget;
//Search for the word "clown"
int nPosClown = FindSubString(sChatText, "clown");
if (nPosClown != -1) //If the word "clown" is in the text message
{
//Suppress the current message from being sent.
NWNXChat_SuppressMessage();
//Modify the original string to insert "EVIL " in front of "clown"
sChatTextMod = InsertString(sChatText, "EVIL ", nPosClown);
//Get ahold of the original receipient of the message (can be invalid)
oPCTarget = NWNXChat_GetPCByPlayerID(nTo);
//Resend the modified message via the original chat channel
NWNXChat_SendMessage(oPC, nMode, sChatTextMod, oPCTarget)
}
}
|
So basically if someone chatted to me in game "Joe is a clown." or "Quit clowning around!" that original message would be suppressed and I (should) instead receive "Joe is a EVIL clown." or "Quit EVIL clowning around!" _________________ Lugoun
www.hotta-rpg.org |
|
Back to top |
|
|
TroveLord
Joined: 22 Nov 2006 Posts: 136 Location: Italy
|
Posted: Tue Feb 17, 2009 23:30 Post subject: |
|
|
Is there a way to make two PCs receive two different messages with NWNXChat_SendMessage?
I see it has a recipient parameter but I can't make it work. |
|
Back to top |
|
|
Zebranky
Joined: 04 Jun 2006 Posts: 415
|
Posted: Wed Feb 18, 2009 21:26 Post subject: |
|
|
TroveLord wrote: | Is there a way to make two PCs receive two different messages with NWNXChat_SendMessage?
I see it has a recipient parameter but I can't make it work. |
What are you passing it as the recipient? _________________ Win32 SVN builds: http://www.mercuric.net/nwn/nwnx/
<Fluffy-Kooshy> NWNx plugin is to this as nuclear warheads are to getting rid of fire ants.
<ThriWork> whenever I hear nwn extender, I think what does NWN need a penis extender for? |
|
Back to top |
|
|
TroveLord
Joined: 22 Nov 2006 Posts: 136 Location: Italy
|
Posted: Wed Feb 18, 2009 22:22 Post subject: |
|
|
Zebranky wrote: | TroveLord wrote: | Is there a way to make two PCs receive two different messages with NWNXChat_SendMessage?
I see it has a recipient parameter but I can't make it work. |
What are you passing it as the recipient? |
I'm looping the players and sending them messages. The sender is the PC speaking, the recipients are the looped players. I need to show different texts to players without using the private channel. Is that possible. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|