5E Character Create Playlist
Page 2 of 3 First 123 Last
  1. #11

    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
    Sorry about all the debug code. I have fully tested this, and it can be stripped out

  2. #12
    Quote Originally Posted by Bidmaron View Post
    Actually, you can export to an xml file. Here is some code I am using to export an individual node or set of nodes:
    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.

  3. #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
    Works great, thanks!
    ---
    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.

  4. #14

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096
    Glad to have been of service, Celestian.

  5. #15
    Just added the documentation for these functions to the Ruleset API Reference on the wiki.
    https://www.fantasygrounds.com/refdoc/

    Cheers,
    JPG

  6. #16
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,684
    Blog Entries
    1
    Quote Originally Posted by Moon Wizard View Post
    Just added the documentation for these functions to the Ruleset API Reference on the wiki.
    https://www.fantasygrounds.com/refdoc/

    Cheers,
    JPG
    Nice.
    Documentation.
    The. Best. Part. Of. The. Job!

  7. #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.

  8. #18
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,684
    Blog Entries
    1
    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?

  9. #19

    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.

  10. #20

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096
    Quote Originally Posted by celestian View Post
    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.

    So, you are wanting a thumbnail of the document obviously, but I am not sure what you are looking for on the directory because you should be able to get the directory from the filename you get through the dialog.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
DICE PACKS BUNDLE

Log in

Log in