PDA

View Full Version : ChatManager Handler Registration



mattekure
November 9th, 2021, 15:20
In my testing today with these functions, both the registerDeliverMessageCallback and registerReceiveMessageCallback do not fire when the message is hidden for GM only. I can only get them to fire if I turn on the option "Chat: Show GM rolls"

I would like the function to be able to view the message whether or not it is set to secret.

Moon Wizard
November 9th, 2021, 16:57
There is nothing in the chatmanager handler registration that changes the behavior of the client nor when the events are fired; it only allows ruleset/extension code to register for the existing events (instead of overriding the chatentry/chatwindow controls).

Secret messages are not passed to everyone, since they are not sent by the client source. If you need a "behind the scenes" behavior, you should use the OOB messaging system.

Regards,
JPG

mattekure
November 9th, 2021, 17:16
My extension code runs on the host side only. There is no messages being passed to clients. The extension attempts to monitor messages in the chat window, both publically viewable and if possible, also messages secret for the GM, then tests the text of the message against some pattern matching. If it matches, it triggers syrinscape to play a sound, if not it does nothing.

Previously I used the basicchatentry override method and even overriding the Comm.deliverChatMessage functions in order to get the info. I would prefer to use the register functions if there is any way the code can see the secret messages being output to the chat on the host side.

Moon Wizard
November 9th, 2021, 18:24
If you look at the new chat_entry.lua script code; it simply passes the same events to the registered handlers. There is no interpretation or change in behavior.

Regards,
JPG

mattekure
November 9th, 2021, 22:26
I think I understand how the pieces are working. It appears that these handlers do pick up all of the messages sent via Comm.deliverChatMessage() because the chatwindow.onReceiveMessage event is being fired. However, they do not trigger on Comm.addChatMessage() calls because there is no onReceiveMessage event.

That said, is there a way to get the message data from Comm.addChatMessage() calls?

Moon Wizard
November 9th, 2021, 23:31
No, any script-added messages have always been specifically removed from being passed and modified by additional script events. You'll have to capture at a higher level in the call chain.

Regards,
JPG