PDA

View Full Version : Chat output



Xarxus
April 30th, 2023, 10:14
Is it possible to have output in the chat so that it is more elaborate?

For example if I roll initiative in D&D I get this. I can make the writing more detailed, but it remains
a text message and I would like to be able to have a more graphically controlled output instead
57215

Trenloe
April 30th, 2023, 10:36
The format of the chat message structure is documented in the Comm package in the Wiki here: https://fantasygroundsunity.atlassian.net/wiki/spaces/FGCP/pages/996644567/Comm

The most you can do is change the icon, change the font/colour for the whole text, add links and assign a frame (edge/background graphics).

To change the frame you need to use the "mode" which needs to be defined in the XML - <chatsettings> in CoreRPG gameelements.xml. A good example of using custom frames is damned's "Sharing is Caring" extension: https://forge.fantasygrounds.com/shop/items/549/view

Xarxus
April 30th, 2023, 12:07
Ty, as usual.

As far as I can see, it's a free extension, but the code isn't public, right?

Trenloe
April 30th, 2023, 13:48
As far as I can see, it's a free extension, but the code isn't public, right?
Correct. I more included it for the screenshots as an example that can be done.

Everything you should need is in my first post.

Trenloe
April 30th, 2023, 13:52
Also, there's a "Forum thread" link in the Forge page. Follow that link and the first post of the thread has an example for FGC - whereas it's for FGC, a lot of the code can be used as an example, but make sure you check CoreRPG code for the latest implementations.

Xarxus
April 30th, 2023, 16:03
Ty Trenloe


I went ahead with my tests on how to format the chat output and built a simple function to display the results of the dice with colors.
Here is the function.


function onButtonPress()
local rMessage = { sender = "GM", text = "Final result", secret = false, font = "systemfont", diemodifier = 0,
dice = {
{ result = 10, type = "r10" },
{ result = 10, type = "r10" },
{ result = 4, type = "d10" },
{ result = 10, type = "r10" },
}
}

Comm.deliverChatMessage(rMessage);
end

This is the 4d10 output 57217

As you can see I entered 2 red results first, then a normal one, and finally a red result again.

Something is wrong with the writing above the dice, it doesn't group by dice type.
I think I need to sort the table, right?
There is a way to customize that writing. For example putting 4d10, regardless of color?

I then decided to make a new test by changing the type of die to 100.
Also in this case the order is not correct and I think I have to sort the table, but the upper writing is worse than the p
revious one. It seems to me there is a bug. Am I wrong?

This is the 4d100 output 57218