View previous topic :: View next topic |
Author |
Message |
Sir Vendel
Joined: 19 Dec 2015 Posts: 7
|
Posted: Sat Jan 09, 2016 16:32 Post subject: NWNXFuncs_PopupMessage() crashes server |
|
|
This function intrigued me with its potential:
NWNXFuncs_PopupMessage()
However, when playing, calling this function crashes the server.
Am I missing something, or is this a bug? |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Mon Jan 11, 2016 14:49 Post subject: |
|
|
That method always works for me.
Are you sure your calling it correctly?
I believe it needs to have a tlk reference to the string you wish to appear on the clients screen.
Can you show logs and script used to call it? |
|
Back to top |
|
|
Sir Vendel
Joined: 19 Dec 2015 Posts: 7
|
Posted: Sun Jan 24, 2016 8:54 Post subject: |
|
|
How can I use a tlk table reference, when the input argument is a string, not an int? This is the function definition (it entirely lacks description):
void NWNXFuncs_PopupMessage(object oPlayer, string sMessage) |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Mon Jan 25, 2016 15:58 Post subject: |
|
|
The method definitely accepts tlk reference, your declaration/definition must be wrong.
Try changing the string to be an int, then specify the int reference to the string you wish to popup.
Make you may need to change the lower level method to pass it to nwnx as an int also.
Remembering off hand, I think maxrocks code had parameter parsers which would detect whether its a string or int or not, then pass it accordingly. |
|
Back to top |
|
|
Sir Vendel
Joined: 19 Dec 2015 Posts: 7
|
Posted: Fri Jan 29, 2016 10:57 Post subject: |
|
|
Tried calling NWNXFuncs_PopupMessage(oPC,IntToString(0)); which would get tlk ref #0 ("Bad strref"). Server still crashes.
Can anyone paste what definition and implementation they use? Or link me to a non-outdated variant of nwnx_funcs? |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Fri Jan 29, 2016 11:19 Post subject: |
|
|
Quote: |
void NWNXFuncs_PopupMessage(object oPlayer, string sMessage) {
SetLocalString(oPlayer, "NWNX!FUNCS!POPUPMESSAGE", sMessage);
DeleteLocalString(oPlayer, "NWNX!FUNCS!POPUPMESSAGE");
}
|
This is the one I have, but I always provided a tlk reference.
Are you making sure to delete the string after setting it?
I think it crashes the server when the player object is removed from work, with nwnx strings attached. |
|
Back to top |
|
|
Sir Vendel
Joined: 19 Dec 2015 Posts: 7
|
Posted: Tue Feb 23, 2016 18:55 Post subject: |
|
|
I have the exact same implementation, and it crashes.
To set a TLK table reference either by IntToString(x) (i.e. stringifying the tlk table number) or by GetStringByStrRef(x) (i.e. the entire string to be spoken) results in a crash for me. |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Tue Feb 23, 2016 19:09 Post subject: |
|
|
The only thing I can think of is this:
Does the tlk entry exist in the server tlk and the client tlk?
I don't know if the server needs it or not.
But if you don't have the tlk entry at server side, then it might result in crash.
I think the command basically sends an int value to the client to tell them what popup to show - so I would have thought it doesn't matter.
The only thing I can think of besides the implementation and tlk file, is maybe your server system?
This is how I am using the function in my auto reboot and save method.
Quote: |
void BootAndSave()
{
WriteTimestampedLogEntry("Starting Boot & Save");
SetLocalInt(GetModule(),"READY_FOR_REBOOT",0);
object oPC = GetFirstPC();
ExportAllCharacters();
while(oPC != OBJECT_INVALID)
{
//BootPC(oPC);
int iMsg = -1;
int iRand = Random(;
switch(iRand)
{
case 0: iMsg = 4259;break;
case 1: iMsg = 4260;break;
case 2: iMsg = 4499;break;
case 3: iMsg = 4540;break;
case 4: iMsg = 17205;break;
case 5: iMsg = 17206;break;
case 6: iMsg = 17238;break;
case 7: iMsg = 86106;break;
}
NWNXFuncs_BootPCWithMessage(oPC,iMsg);
oPC = GetFirstPC();
}
SetLocalInt(GetModule(),"READY_FOR_REBOOT",1);
WriteTimestampedLogEntry("Finished Boot & Save - Ready for Reboot");
}
|
|
|
Back to top |
|
|
Valgav
Joined: 28 Aug 2010 Posts: 53
|
Posted: Sun Mar 13, 2016 3:02 Post subject: |
|
|
I'm digging up this thread because I also had problems with that function.
Baaleos one thing: You're using NWNXFuncs_BootPCWithMessage not NWNXFuncs_PopupMessage it's a huge difference |
|
Back to top |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Mon Mar 14, 2016 13:48 Post subject: |
|
|
Good point - think I misunderstood - I thought he was referring to the boot with popup.
I've never actually experienced the popup message method.
The boot with popup works fine though. |
|
Back to top |
|
|
ShaDoOoW
Joined: 20 Aug 2005 Posts: 584
|
Posted: Mon Mar 14, 2016 14:05 Post subject: |
|
|
oh PopupMessage? I dont think it works at all and even if it wouldn't crash for someone it will most probably cause memory leaks which will crash nwserver when shutdown anyway _________________ Community Patch / NWNX Patch / NWNX Files / NWNX Connect |
|
Back to top |
|
|
DarkSet
Joined: 06 Jun 2016 Posts: 98
|
Posted: Sat Jun 25, 2016 16:55 Post subject: |
|
|
This function crushes server for me as well. Looks like it's just bugged. Sad, but true |
|
Back to top |
|
|
|