View Full Version : Ruleset script accessing module data
Sevatas
June 22nd, 2018, 05:07
In a ruleset (CoreRPG) script, how do I access module data by looking up via record type without already having a record?
Trenloe
June 22nd, 2018, 05:22
Info on the database here - see the "database paths" section for details of the difference between data in a module and the base campaign database: https://www.fantasygrounds.com/wiki/index.php/Developer_Guide_-_Rulesets_-_Database
Note that you can use a wildcard in the database path - e.g. encounter@* would reference the main encounter node (where Story entries are stored) across all open modules (that's what the @* means). See the Data File Format for details of the main database node names: https://www.fantasygrounds.com/wiki/index.php/Campaign_and_Module_Data_File_Overview#CoreRPG_Dat a_File_Format
You need to access the database using the database API. Start here: https://www.fantasygrounds.com/refdoc/DB.xcp
You can find a specific databasenode within the FG structure using DB.findNode: https://www.fantasygrounds.com/refdoc/DB.xcp#findNode
If you need to search through various nodes to find the one you want, you can get all of the children of a specific node with DB.getChildren: https://www.fantasygrounds.com/refdoc/DB.xcp#getChildren and then iterate through the returned table.
Do a search through some of the main FG rulesets for examples of these API calls.
Sevatas
June 22nd, 2018, 18:22
Thanks for your help. I was able to get the script working.
Powered by vBulletin® Version 4.2.1 Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.