-
January 4th, 2018, 04:13 #11
Archangel
- Join Date
- Apr 2008
- Location
- Virginia Beach
- Posts
- 3,096
Actually, you can export to an xml file. Here is some code I am using to export an individual node or set of nodes:
Code:function superExportTabGen(nodeTable,bDoAll) --given a table or generator node, exports the table or generator to an xml file --we should include a verification that referenced tables are included also local sFile=Interface.dialogFileSave( ); if sFile then local aExports; if bDoAll then local sRootMapping=LibraryData.getRootMapping(nodeTable); Debug.chat("nodeTable=",nodeTable,";sRootMapping=",sRootMapping); local topNode=DB.findNode(sRootMapping); aExports=DB.getChildren(sRootMapping); else aExports={DB.getValue(nodeTable,"name")}; --Debug.chat("aExports[1]=",aExports[1]); aExports=scanForTables(aExports,DB.getPath(nodeTable)); end --Debug.chat("size aExports=",tableSize(aExports)); if DB.findNode("temporary") then --Debug.chat("deleting temporary"); DB.deleteNode("temporary"); end DB.createNode("temporary"); local sTopType; for _,sTab in pairs(aExports) do local sourceNode; if type(sTab)=="string" then sourceNode=TableManager.findTable(sTab); else local sTabName=DB.getValue(sTab,"name"); Debug.chat("name=",sTabName); sourceNode=TableManager.findTable(sTabName); end Debug.chat("sTab=",sTab,";sSource=",DB.getPath(sourceNode)); local destNode=DB.createChild("temporary"); Debug.chat("sourceNode=",sourceNode,";destNode=",DB.getPath(destNode)); DB.copyNode(sourceNode,destNode); if not sTopType then sTopType=LibraryData.getRecordTypeFromPath(superGetRecordLevel(sourceNode)); end Debug.chat("record type=",sTopType); DB.setValue(destNode,"xyzzy","string",LibraryData.getRecordTypeFromPath(superGetRecordLevel(sourceNode))); end DB.export(sFile,"temporary"); --,sTopType,true); DB.deleteNode("temporary"); end end --superExportTabGen
-
January 4th, 2018, 05:33 #12
Ohhh thanks for the heads up! I was actually trying to use the os level lua calls to do it and hadn't saw Interface.dialogFileSave( ); before.
I can at least write out the client.xml and definition.xml!
(I need to go look at all the interface.* functions!)
edit: also DB.export() 'Last edited by celestian; January 4th, 2018 at 06:07.
---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
-
January 4th, 2018, 07:09 #13
Thanks to your pointers this is what I ended up doing. I didn't want to have to prompt for both files so I just prompted for the client.xml, then chop it off, append the other and write both.
Code:-- prompt for filename to save client.xml to local sFile = Interface.dialogFileSave( ); if (sFile ~= nil) then local sDirectory = sFile:match("(.*[/\\])"); -- export the client.xml data to selected file DB.export(sFile,dAuthorNode.getPath()); -- export definition file in same path/definition DB.export(sDirectory .. "definition.xml",dDefinitionNode.getPath()); -- show done message local sFormat = Interface.getString("author_completed"); local sMsg = string.format(sFormat, aProperties.name,sFile); ChatManager.SystemMessage(sMsg); file.setFocus(true); end
---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
-
January 4th, 2018, 22:27 #14
Archangel
- Join Date
- Apr 2008
- Location
- Virginia Beach
- Posts
- 3,096
Glad to have been of service, Celestian.
-
January 5th, 2018, 05:08 #15
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,558
Just added the documentation for these functions to the Ruleset API Reference on the wiki.
https://www.fantasygrounds.com/refdoc/
Cheers,
JPG
-
January 5th, 2018, 05:14 #16
-
January 5th, 2018, 07:08 #17
So here is what I'm looking at currently. Feel free to feed back.
This is a view of the Story records, the author export window and the book I am fiddling with.
"05 Thief Kits and Thieving Skills" is a story entry (you can see it in 03 Chapter 3: Thief Kits" story category. Now look at the book and you'll see "Chapter 3: Thief Kits" and within that a entry for "Thief Kits and Thieving Skills".
I assumed people wouldn't really want the numbers listed. You must have them for the story listing to get the order correctly but once I have them and sorted I can strip it out because the ref-manuals list in order of the entries and since I put them in sorted it doesn't change the order.
The export window will allow you to also select classes/effects/encounters and everything else and it will be placed in the refmanual as those specific records. If you refer to those records in a story you must include them or the links in the ref manual will not work. This goes for "STory" entries as well. So if you link a story within the story you'll need to also export Story records.
Unfortunately I don't think I can make use of the Directory or Thumnail at this time (unless someone knows of a trick to copy a image from a file path to a directory?). So that will need to be done external to FG... The main goal of this is to just make creating the bulk of the refmanual. You'll still need to zip it into a mod when you're complete.
---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
-
January 5th, 2018, 13:29 #18
Hi celestian Ive been watching with interest. Am I right in that you are creating content as Story (and other content types) within FG using FG formatting and then using an extension have it copy all that data into a Reference Manual?
-
January 5th, 2018, 15:13 #19
Archangel
- Join Date
- Apr 2008
- Location
- Virginia Beach
- Posts
- 3,096
Celestian, have you looked at the great implementation in the SW ruleset of this? I have long wondered why no one had duplicated that in CoreRPG.
-
January 5th, 2018, 15:17 #20
Archangel
- Join Date
- Apr 2008
- Location
- Virginia Beach
- Posts
- 3,096
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks