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 
 
NWNXFuncs_PopupMessage() crashes server

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



Joined: 19 Dec 2015
Posts: 7

PostPosted: Sat Jan 09, 2016 16:32    Post subject: NWNXFuncs_PopupMessage() crashes server Reply with quote

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
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Mon Jan 11, 2016 14:49    Post subject: Reply with quote

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
View user's profile Send private message
Sir Vendel



Joined: 19 Dec 2015
Posts: 7

PostPosted: Sun Jan 24, 2016 8:54    Post subject: Reply with quote

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
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Mon Jan 25, 2016 15:58    Post subject: Reply with quote

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
View user's profile Send private message
Sir Vendel



Joined: 19 Dec 2015
Posts: 7

PostPosted: Fri Jan 29, 2016 10:57    Post subject: Reply with quote

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
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Fri Jan 29, 2016 11:19    Post subject: Reply with quote

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
View user's profile Send private message
Sir Vendel



Joined: 19 Dec 2015
Posts: 7

PostPosted: Tue Feb 23, 2016 18:55    Post subject: Reply with quote

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
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Tue Feb 23, 2016 19:09    Post subject: Reply with quote

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(Cool;
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
View user's profile Send private message
Valgav



Joined: 28 Aug 2010
Posts: 53

PostPosted: Sun Mar 13, 2016 3:02    Post subject: Reply with quote

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 Wink
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Mon Mar 14, 2016 13:48    Post subject: Reply with quote

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
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Mon Mar 14, 2016 14:05    Post subject: Reply with quote

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
View user's profile Send private message
DarkSet



Joined: 06 Jun 2016
Posts: 98

PostPosted: Sat Jun 25, 2016 16:55    Post subject: Reply with quote

This function crushes server for me as well. Looks like it's just bugged. Sad, but true Smile
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