View previous topic :: View next topic |
Author |
Message |
Meldawn
Joined: 10 Aug 2010 Posts: 1
|
Posted: Tue Aug 10, 2010 17:54 Post subject: shout from command line |
|
|
I have looking for a way to send a shout to the module from the server command line. I don't want to send a message, the say command won't work for me.
Is this possible? |
|
Back to top |
|
|
Ginden
Joined: 07 Feb 2009 Posts: 4
|
Posted: Tue Aug 10, 2010 19:56 Post subject: |
|
|
Yes, it's possible.
You must hook the server message by nwnx_chat. Then you should use SpeakMessage... _________________ In Soviet Russia, NWNX edit you! |
|
Back to top |
|
|
Ravine
Joined: 26 Jul 2006 Posts: 105
|
Posted: Tue Aug 10, 2010 20:12 Post subject: |
|
|
Yeah, that's what i do too. Grab the 'say' message from console, and redirect it to an NPC, who shout it.
However, the 'say' command not sending one message to the server. It sends the message to every player individually. So if there are 3 players on the server, the NPC will shout it 3 times, so you have to script this (also, if the server is empty, no message will be sent). |
|
Back to top |
|
|
Fireboar
Joined: 17 Feb 2008 Posts: 323
|
Posted: Wed Aug 11, 2010 0:41 Post subject: |
|
|
Yes, 'say' sends the message individually to each PC so nwnx_chat fires once for each message. The best way to get round this is probably to have a variable "LAST_MESSAGE" (or whatever) set on the module to whatever the most recent message hooked by the chat server_script is, and an integer variable "LAST_MESSAGE_EXPIRE" set to 1, with a DelayCommand of one second setting it to 0. Then if the current message is equal to the last message and LAST_MESSAGE_EXPIRE == 1, suppress the message and do nothing with it. |
|
Back to top |
|
|
Ravine
Joined: 26 Jul 2006 Posts: 105
|
Posted: Wed Aug 11, 2010 9:24 Post subject: |
|
|
I simply use the "if(GetFirstPC() == cmMessage.Recipient) " check. FirstPC should be the same inside the cycle (but i saw it fail once). |
|
Back to top |
|
|
Fireboar
Joined: 17 Feb 2008 Posts: 323
|
Posted: Thu Aug 12, 2010 14:34 Post subject: |
|
|
Ravine wrote: | I simply use the "if(GetFirstPC() == cmMessage.Recipient) " check. FirstPC should be the same inside the cycle (but i saw it fail once). |
That's a good idea, just be aware that if the PC in question is in the process of leaving the server, then yes, it will fail. |
|
Back to top |
|
|
|