There is a Branch of the nwnx svn, called Events_Update
http://nwn.virusman....s/events_update
I dont know if it works, but it contains conversation node code.
char* CNWNXEvents::OnRequest (char* gameObject, char* Request, char* Parameters)
{
Log(2,"Request: \\"%s\\"\\n",Request);
Log(2,"Params: \\"%s\\"\\n",Parameters);
this->pGameObject = gameObject;
this->nGameObjectID = *(dword *)(gameObject+0x4);
if (ConditionalScriptRunning)
{
if (strncmp(Request, "GET_NODE_ID", 11) == 0)
{
if (strlen(Parameters) > 2)
sprintf(Parameters, "%d", nCurrentNodeID);
return NULL;
}
else if (strncmp(Request, "GET_ABSOLUTE_NODE_ID", 20) == 0)
{
if (strlen(Parameters) > 2)
sprintf(Parameters, "%d", nCurrentAbsoluteNodeID);
return NULL;
}
else if (strncmp(Request, "GET_NODE_TYPE", 13) == 0)
{
if (strlen(Parameters) > 1)
sprintf(Parameters, "%d", nNodeType);
return NULL;
}
else if (strncmp(Request, "GET_NODE_TEXT", 13) == 0)
{
if(!pConversation) return NULL;
int nLocaleID = atoi(Parameters);
const char *pText = NULL;
if(nNodeType == StartingNode || nNodeType == EntryNode)
{
CDialogEntry *pEntry = &pConversation->EntryList[nCurrentAbsoluteNodeID];
CExoLocString *pNodeText = &pEntry->Text;
pText = pNodeText->GetStringText(nLocaleID);
}
else if(nNodeType == ReplyNode)
{
CDialogReply *pReply = &pConversation->ReplyList[nCurrentAbsoluteNodeID];
CExoLocString *pNodeText = &pReply->Text;
pText = pNodeText->GetStringText(nLocaleID);
}
else return NULL;
if(!pText) return NULL;
int len = strlen(pText);
char *pNewText = (char *) malloc(len+1);
strncpy(pNewText, pText, len);
pNewText[len]=0;
return pNewText;
return NULL;
}
else if (strncmp(Request, "SET_NODE_TEXT", 13) == 0)
{
if(!pConversation) return NULL;
int nLocaleID;
int nParamLen = strlen(Parameters);
//char *sNewText = (char *) malloc(nParamLen);
char *nLastDelimiter = strrchr(Parameters, '¬');
if (!nLastDelimiter || (nLastDelimiter-Parameters)<0)
{
Log(0, "o nLastDelimiter error\\n");
//free(sNewText);
return NULL;
}
int nTextLen = nParamLen-(nLastDelimiter-Parameters)+1;
char *sNewText = (char *) malloc(nTextLen);
if(sscanf(Parameters, "%d¬", &nLocaleID)<1)
{
Log(0, "o sscanf error\\n");
free(sNewText);
return NULL;
}
strncpy(sNewText, nLastDelimiter+1, nTextLen-1);
CExoLocStringElement *pLangEntry=NULL;
if(nNodeType == StartingNode || nNodeType == EntryNode)
{
CDialogEntry *pEntry = &pConversation->EntryList[nCurrentAbsoluteNodeID];
CExoLocString *pNodeText = &pEntry->Text;
pLangEntry = pNodeText->GetLangEntry(nLocaleID);
}
else if(nNodeType == ReplyNode)
{
CDialogReply *pReply = &pConversation->ReplyList[nCurrentAbsoluteNodeID];
CExoLocString *pNodeText = &pReply->Text;
pLangEntry = pNodeText->GetLangEntry(nLocaleID);
}
if(!pLangEntry){ free(sNewText); return NULL; } //do nothing if there is no text
if(pLangEntry->Text.Text)
{
free(pLangEntry->Text.Text);
pLangEntry->Text.Text = sNewText;
pLangEntry->Text.Length = strlen(sNewText)+1;
}
return NULL;
}
}
if (ActionScriptRunning)
{
if (strncmp(Request, "GET_SELECTED_NODE_ID", 20) == 0)
{
if (strlen(Parameters) > 1)
sprintf(Parameters, "%d", nSelectedNodeID);
return NULL;
}
else if (strncmp(Request, "GET_SELECTED_ABSOLUTE_NODE_ID", 29) == 0)
{
if (strlen(Parameters) > 1)
sprintf(Parameters, "%d", nSelectedAbsoluteNodeID);
return NULL;
}
else if (strncmp(Request, "GET_SELECTED_NODE_TEXT", 22) == 0)
{
if(!pConversation) return NULL;
int nLocaleID = atoi(Parameters);
CDialogReply *pReply = &pConversation->ReplyList[nSelectedAbsoluteNodeID];
CExoLocString *pNodeText = &pReply->Text;
const char *pText = pNodeText->GetStringText(nLocaleID);
if(!pText) return NULL;
int len = strlen(pText);
char *pNewText = (char *) malloc(len+1);
strncpy(pNewText, pText, len);
pNewText[len]=0;
return pNewText;
}
}
if (!scriptRun) return NULL; //The following functions are accessible only from event script
if ((strncmp(Request, "GET_EVENT_ID", 12) && strncmp(Request, "GETEVENTID", 10)) == 0)
{
if (strlen(Parameters) > 1)
sprintf(Parameters, "%d", nEventID);
return NULL;
}
if (strncmp(Request, "GET_EVENT_SUBID", 15) == 0)
{
if (strlen(Parameters) > 1)
sprintf(Parameters, "%d", nEventSubID);
return NULL;
}
else if (strncmp(Request, "GET_EVENT_POSITION", 18) == 0)
{
if (strlen(Parameters) > 24)
sprintf(Parameters, "%f¬%f¬%f", vPosition.x, vPosition.y, vPosition.z);
}
else if (strncmp(Request, "GET_ITEM_RADIAL", 18) == 0)
{
if (strlen(Parameters) > 1)
sprintf(Parameters, "%d", nRadial);
}
else if (strncmp(Request, "BYPASS", 6) == 0)
{
bBypass = atoi(Parameters);
}
return NULL;
}