PDA

View Full Version : Trying to send a /save command via code



alloowishus
January 6th, 2025, 00:06
I know this has something to with the manager_chat.lua script, as an example of something similar I see this:

Comm.registerSlashHandler("w", ChatManager.processWhisper, "[charactername] [message]");

but nothing regarding adding support for "/save". Any ideas? Thanks!

jharp
January 6th, 2025, 01:05
Comm.activateSlashCommand("save");

Discussed here:
https://www.fantasygrounds.com/forums/showthread.php?62615-dice-rolls-with-die-What-exactly-happens&p=548481&viewfull=1#post548481

alloowishus
January 6th, 2025, 20:43
Comm.activateSlashCommand("save");

Discussed here:
https://www.fantasygrounds.com/forums/showthread.php?62615-dice-rolls-with-die-What-exactly-happens&p=548481&viewfull=1#post548481

That works, thanks!

Trenloe
January 6th, 2025, 21:00
I'm curious - FG saves the database held in memory to the campaign db.xml file automatically every 5 minutes, what's the use case to force this save?

jharp
January 6th, 2025, 21:40
Well for me, FoWEnhanced makes use to save FoW data.

alloowishus
January 7th, 2025, 02:18
I'm curious - FG saves the database held in memory to the campaign db.xml file automatically every 5 minutes, what's the use case to force this save?

I have a lot of experience with this, it seems that for my purposes, it does NOT go to memory first, it goes to the disk. I wrote some custom code that auto applies spell effects and the way I achieved this is by adding a node to the combat tracker for the creature being targetted. This all works fine when i test myself, however, when players are connected it seems to go all haywire and only works periodically. The only thing I could pin it down to was the fact that it was not writing to the disk in time. Saving seems to work.

damned
January 7th, 2025, 04:50
FG doesnt read from disk during the game - it only writes to the disk. Once the table has loaded all ruleset, extension and database are loaded into memory and run from there.
Is it possible its a database permissions issue? Where in the DB are you writing the data to?

alloowishus
January 7th, 2025, 19:14
FG doesnt read from disk during the game - it only writes to the disk. Once the table has loaded all ruleset, extension and database are loaded into memory and run from there.
Is it possible its a database permissions issue? Where in the DB are you writing the data to?

Yes, I have run into that too, but the fact that /save seems to solve the problem makes me think that it reads from the disk, or something, I don't know, but writing nodes and reading from them in a short amount of time otherwise is VERY flaky. I have been testing this for quite a while too.