logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
NWNX_Chat Truncating Message Text (Documentation Request?)

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows technical support
View previous topic :: View next topic  
Author Message
Matarsak



Joined: 20 Feb 2011
Posts: 3

PostPosted: Fri May 18, 2012 20:35    Post subject: NWNX_Chat Truncating Message Text (Documentation Request?) Reply with quote

I wasn't able to find any thorough documentation on how exactly to use nwnx_chat for Windows (and would very much appreciate it if someone can point me in its direction), so I'm using (or at least, attempting to use snippets shamelessly ripped out of SIMTools) to forward DM channel requests and potentially later handle other custom commands. The server's running on Win Server 2008 R2, if that matters at all. NWNX + plugins from the SIMTools install. The issue is that the message text seems to be cut off after the first 16 characters (counting the channel and target portion, so only 4 characters of actual text seem to get through.

For example, typing "0123456789" from both DM and player clients tosses back something like
Code:
14        -10123
(without quotes, put in code because the spaces were being swallowed).

Here's the log text:
Quote:

NWNX Chat version 0.3.4 for Windows.
(c) 2005-2006 by dumbo (dumbo@nm.ru)
(c) 2006-2008 virusman (virusman@virusman.ru)
Settings:
chat_script: fky_chat
server_script: fky_chat_srv
max_msg_len: 1024
processnpc: 0
ignore_silent: 0

! ChatProc hooked at 43ca00.
! RunProc located at 5bf9d0.
! GetIDProc located at 452f70.

o CHAT: mode=E, from_oID=7FFFFFFE, msg='0123456789', to_ID=FFFFFFFF
o CHAT: mode=1E, from_oID=7FFFFFFD, msg='0123456789', to_ID=FFFFFFFF


So it looks like the full text is being recorded somewhere, but not making it through. Hopefully, this means I boneheaded something in the code.

The OnModuleLoad has a call to the following function (pretty much right out of SIMTools):
Code:

void InitSpeech()
{
    int nCount;
    object oMod = GetModule();
    // Allocate Memory
    string sMemory;
    for( nCount = 0; nCount < 8; nCount++ ) // Reserve 8*128 bytes
        sMemory += "................................................................................................................................";
    SetLocalString(oMod, "NWNX!CHAT!SPACER", sMemory);
}


On client enter calls this one:
Code:

void Speech_OnClientEnter(object oPlayer)
{
  if( !GetIsObjectValid(oPlayer) ) return;

  WriteTimestampedLogEntry("Speech_OnClientEnter begin.");
  object oMod = GetModule();
  SetLocalString(oPlayer, "NWNX!CHAT!GETID", ObjectToString(oPlayer) + "        ");
  string sID = GetLocalString(oPlayer, "NWNX!CHAT!GETID");
  int nID = StringToInt(sID);
  if( nID != -1)
  {
    SetLocalObject(oMod, sSpeech_SpeechList + sID, oPlayer);
    SetLocalInt(oPlayer, sSpeech_PlayerID, nID);
  }
  DeleteLocalString(oPlayer, "NWNX!CHAT!GETID");
  WriteTimestampedLogEntry("Speech_OnclientEnter complete.");
}


And OnClientExit:
Code:

void Speech_OnClientExit(object oPlayer)
{
  if( !GetIsObjectValid(oPlayer) ) return;

  int nID = GetLocalInt(oPlayer, sSpeech_PlayerID);
  DeleteLocalInt(oPlayer, sSpeech_PlayerID);
  DeleteLocalObject(GetModule(), sSpeech_SpeechList + IntToString(nID));
}


The chat script, stripped down for testing, just contains the following:
Code:

    object oPC = OBJECT_SELF, oTarget;// Speaker = oPC
    string sText;
    int nChannel, nTarget;

    SetLocalString(oPC, "NWNX!CHAT!TEXT", "NWNX!CHAT!SPACER"); // 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
    string sFullText = sText;
    sText = GetStringRight(sText, GetStringLength(sText) - 12);// Remove Target & Channel Info
    if( nTarget != -1 )// Acquire possible target
        oTarget = Speech_GetPlayer(nTarget);

    SendMessageToPC(GetFirstPC(), sFullText);


And again, the message forwarded contains only the first four characters of the full chat text.
Back to top
View user's profile Send private message
addicted2rpg



Joined: 01 Aug 2008
Posts: 106

PostPosted: Sat May 19, 2012 14:42    Post subject: Reply with quote

I don't even run nwnx_chat so here is my crappy help (lol)-

Try passing it with the actual SPACER string, and not the text "NWNX!CHAT!SPACER"

i.e., NOT
Code:

SetLocalString(oPC, "NWNX!CHAT!TEXT", "NWNX!CHAT!SPACER"); // Query for chattext

but
Code:

SetLocalString(oPC, "NWNX!CHAT!TEXT", GetLocalString(GetModule(), "NWNX!CHAT!SPACER"));
Back to top
View user's profile Send private message
Matarsak



Joined: 20 Feb 2011
Posts: 3

PostPosted: Sat May 19, 2012 20:25    Post subject: Reply with quote

Bingo--boneheaded mistake it is!

Thank ye kindly.
Back to top
View user's profile Send private message
waleed432



Joined: 15 Nov 2014
Posts: 1

PostPosted: Sat Nov 15, 2014 13:44    Post subject: Reply with quote

can you post a link to the plugin (the windows version)

The link you provide is for the linux version.
_________________
aliii
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows technical support All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
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