PDA

View Full Version : Debug.chat not working in named-script onInit function



bmos
August 3rd, 2022, 14:26
I just noticed while doing some testing that a Debug.chat('test') line in an onInit function of a named script is not showing up in chat.
I'm assuming the chat may not be available when that function is called, or perhaps it's something else.
Here's a little ext to make it easy to replicate.

EDIT: Comm.addChatMessage also seems to be unusable when called from onInit like this.

bmos
August 3rd, 2022, 15:38
MeAndUnique shared Interface.onDesktopInit as an alternate approach, so if this is just 'intended behavior' I get it and would suggest it be added to https://fantasygroundsunity.atlassian.net/wiki/spaces/FGCP/pages/996645578/script.

Moon Wizard
August 3rd, 2022, 17:41
If you use Debug.chat in the global scripts, those are actually called before the chat window exists; so there is no chat window to write to. In those scenarios, the application falls back to writing to console log.

Regards,
JPG