PDA

View Full Version : Campaign save frequency



codester70
March 2nd, 2018, 15:00
Hello, hopefully this is the right place to post this. I'm investigating the possibility of creating a web-based tool to allow my players to view and maybe even maintain their characters outside of Fantasy Grounds. We don't have the luxury of having everyone using their computers at the game table, so I thought a tablet or phone might suffice. However, I've noticed that the db.xml file doesn't seem to be getting updated with every change that happens on the character sheet, at least not immediately. Am I going about this the wrong way? Is there an alternative? Is there a way to get this information via socket programming?

Thank you!

Trenloe
March 2nd, 2018, 15:51
The db.xml file is a permanent copy of the FG in-memory database. It is not updated every time a change is made as this would be very inefficient and unnecessary. It is auto-saved every 5 minutes and also when the GM exits the application.

damned
March 2nd, 2018, 22:40
So changes to the db.xml from outside the app while the campaign is running - wont get used - they will be overwritten at the next save.

codester70
March 3rd, 2018, 16:16
It sounds like there's no practical way to create a web-based companion app, so I'll have to figure out something else. Thanks for the replies, though!

Bidmaron
March 3rd, 2018, 17:19
It won't be easy but it is very possible. You would have to write an extension to export current content as xml file and then have your app respond to the update to that file. As to getting information back into FG, that is harder, but it is possible. If you really want to do this, I will outline how to get information back into FG from outside.

codester70
March 5th, 2018, 15:47
It won't be easy but it is very possible. You would have to write an extension to export current content as xml file and then have your app respond to the update to that file. As to getting information back into FG, that is harder, but it is possible. If you really want to do this, I will outline how to get information back into FG from outside.

What would really be helpful is a client API, where I could connect to the host IP to send and receive these updates. But barring that, any other information you have would be very welcome. Thank you!

Bidmaron
March 6th, 2018, 06:02
Unlikely to happen until FGU, and even then it would be very slow to arrive, if ever.

Here is what I did:
Export the data like I said before
I had a visual basic app that responded to updates to the folder (using windows folder events) which would detect the export, read the data and take the proper action.
When I needed something sent back to FG, I would place a signal graphic into the images directory of Fantasy Grounds.
I had an extension running that would react to the signal graphic using the handlers onChildAdded and onChildUpdated on the DB "images" node.
The onChildAdded would set a pointer to the file
The onChildUpdated would make sure that the file added was the signal file (by ensuring that the image name started with 'Signal Graphic'.
The remainder of the file name would indicate an xml file name that had the data for FG.
Once I extracted the xml file name, use Import to bring that data into FG and install it wherever it needed to go.
When done, export a signal file.
The visual basic app would detect this signal file and delete the signal graphic added above (that way, the images folder wouldn't get cluttered with a bunch of signal files).

It worked. Massive kluge, but it was an effective way to get data into FG. I could dig up my code if you are serious about this.

As far as I know, stuffing crap into the images folder is the only external stimuli that will force an event in FG. It took me a long time to figure out the handshake mechanism (in the days when I did this import and export weren't yet available, so I had to force a module update that the folder mod external program would detect. To get data back in I had to modify the module and then the image event firing would cause the modified module to reload - this remains a viable way to do things also, but I prefer the import/export mechanism.)

codester70
March 6th, 2018, 13:53
Thank you, Bidmaron! Very creative solution!