PDA

View Full Version : Need your expertise about char_main.xml



stany
May 19th, 2017, 13:31
Hello everyone,
I'm working on an extension.
I need to show a single value common to all players.
This value will change during game play and will remain for the next session
I wanted to post it on the desktop but I understand that the values of the desktop are not saved in the database.
Can you help me please ?
thank you for everything

Andraax
May 19th, 2017, 13:50
Use the MOTD extension and edit the MOTD story entry during play?

stany
May 19th, 2017, 14:07
MOTD extension is not the good way.
The game system grants at the beginning of the game a common pool of special dices that all players can use. This dice stock decreases as they use these special dices. The goal is that players can see this dice stock easily.

Trenloe
May 19th, 2017, 15:20
You can save desktop panel data to the FG campaign database, you just have to code it to do so.

You can look at the lightsidechit in the Star Wars EotE ruleset. The lightsidechit windowclass is added to the lightsidechit panel in definitions\desktop.xml. A public lightsidechit database node is created in managers\desktopmanager.lua (the database needs to be public so that the player side can access it) and the code to handle it is covered in classes\desktop\chit.lua. It's not simple, as OOB messaging has to be used (depending on who has access to the desktop panel information).

stany
May 19th, 2017, 15:32
Thanks for your help.
I'm going to see it. I try your solution

Trenloe
May 19th, 2017, 21:12
Attached is a simple example extension of storing a number in the database and displaying it on the desktop.

This should work in any CoreRPG based ruleset.

The extension "Desktop Panel Example" adds a basic panel to the desktop (can be unlocked and moved) with a number control within. Only the GM can change it by clicking on it and typing a number, or using the scroll wheel.

On the player side, we need to wait for FG to fully initialize before the code can access the database. So, for the player, the desktop panel will show "Click to sync". Once each player clicks on the panel then the number displayed will be in sync with the GM - it's read only on the player side.

This is just an example of how to store data in the database and access it to display in a desktop panel. Different data could be handled in the same way. If you wanted the players to be able to change it then you'd need to setup some OOB messaging from the players to the GM, as only the GM can change public data.

Here's an example, showing the desktop panel:

https://www.fantasygrounds.com/forums/attachment.php?attachmentid=19026