PDA

View Full Version : Forcing the DB to save



Tabulazero
June 2nd, 2019, 15:31
Is there a function that forces the DB to save ?

For example I create a window called "locked_window" and give it a name "newWindow".

I can do that by typing the following command in the chat:
/openwindow locked_window newWindow

If I immediately open the DB.xml file, no trace of "newWindow"

However, if I then type /save in the chat window and reopen the DB.xml, here it is.

Since I plan to basically check if the title of locked_window is empty and if not to copy "newWindow" to a new node, forcing a save of the DB would be helpful. How can I do that ?

damned
June 2nd, 2019, 16:47
Fantasy Grounds doesnt read from the db.xml within a session - only at the start of the session.
The rest of the session it works from a copy that is loaded in memory.
This copy is written to disk on exit and every 5mins.
The data that you seek is in the db - it just may not be in the db instance that you can see right now...

type /save to force the write so you can check your code - but the game itself can access it already.

Tabulazero
June 2nd, 2019, 22:58
Thank you for the info.

I have an additional thing I am struggling with: how can I get a databasenode to delete itself on an OnClose event ?

I have tried getDatabaseNode().delete(); and it crashes utterly fantasy ground.

damned
June 2nd, 2019, 23:55
https://www.fantasygrounds.com/forums/showthread.php?42895-3-5-damage-pathways-(drag-drop)&p=381351&viewfull=1#post381351