-
February 18th, 2018, 20:02 #11
-
February 18th, 2018, 22:23 #12
- Join Date
- Nov 2017
- Posts
- 9
That's probably because that example script is the one I'm using for my Princes of Apocalypse campaign. Please change the campaign init to use a campaign you have saved.
-
February 18th, 2018, 22:45 #13
So what if I'm in multiple campaigns and playing multiple characters? How would I have it look through every campaign in the ./campaigns folder and backup every character?
run.py
Code:from phantasy import datahelper import pprint import os def main(): x = datahelper.DataHelper() princes = None print(__file__) for campaign in x.campaigns: if campaign.startswith('Princes'): princes = x.getCampaign(campaign) break outdir = os.path.join(os.path.dirname(__file__), 'render') pprint.pprint(princes.getAttribute('charsheet', {'name': 'Krug'})) pprint.pprint(princes.getAttribute('feat', {'name': 'Great Weapon Master'})) #princes.rD(princes.getAttr('charsheet', {'name': 'Krug'}), outdir) return 0 if __name__ == "__main__": main()
-
February 18th, 2018, 23:01 #14
- Join Date
- Nov 2017
- Posts
- 9
You'd want to loop through every campaign like it does now but don't check for the names. I don't have the time at the moment to write it out; but I believe in you!
-
February 18th, 2018, 23:54 #15
I don't know python but would you please make any suggestions? Do I just need the two pprint lines? What is the significance of feat?
Code:from phantasy import datahelper import pprint import os def main(): x = datahelper.DataHelper() mycampaign = None print(__file__) for campaign in x.campaigns: mycampaign = x.getCampaign(campaign) outdir = os.path.join(os.path.dirname(__file__)) pprint.pprint(mycampaign.getAttribute('charsheet')) pprint.pprint(mycampaign.getAttribute('feat')) # mycampaign.rD(mycampaign.getAttr('charsheet'), outdir) return 0 if __name__ == "__main__": main()
Last edited by mlesnews; February 19th, 2018 at 00:09.
-
February 20th, 2018, 17:19 #16
@Bidmaron
Question for you Bidmaron, were you able to get it to work where it created a module that you then loaded into Fantasy Grounds? If so, what did do or show? Thanks in advance.
-
February 20th, 2018, 19:07 #17
- Join Date
- Nov 2017
- Posts
- 9
I don't know python but would you please make any suggestions? Do I just need the two pprint lines? What is the significance of feat?
Question for you Bidmaron, were you able to get it to work where it created a module that you then loaded into Fantasy Grounds? If so, what did do or show? Thanks in advance.
First you add all of the pictures that you want to make into a module into the image folder and setup your script to render from and zip to the correct locations.
Then you can freely load up or create a new campaign. Check the load modules tab.
From there you can load the images from the Images & Maps tab from the group dropdown.
Cheers!
-
February 20th, 2018, 23:20 #18
Archangel
- Join Date
- Apr 2008
- Location
- Virginia Beach
- Posts
- 3,096
What he said!
-
February 21st, 2018, 02:12 #19
Thanks guys, I'll update, run it and see what happens! Whoop, I'm excited!
Code:from phantasy import datahelper import pprint import os def main(): x = datahelper.DataHelper() for title, campaign in x.campaigns.items(): outdir = os.path.join(os.path.dirname(__file__), 'render', title) if not os.path.exists(outdir): os.makedirs(outdir) if 'Princes' in title: characters = x.getCharacters(campaign) for name, charsheet in characters.items(): outfile = os.path.join(outdir, name) x.renderData(charsheet, outfile, campaign.metadata['db.xml']) return 0 if __name__ == "__main__": main()
Last edited by mlesnews; February 21st, 2018 at 02:48.
-
February 21st, 2018, 03:11 #20
- Join Date
- Nov 2017
- Posts
- 9
Yeah, if you don't have any campaigns with that in it you may want to remove it or change it to a campaign you have saved. I just add that for my testing purposes as I have a few campaigns and don't want to backup all characters for all campaigns.
Also I think you misunderstand the current separation between projects.
FGModGen is the code for generating a mod file based on data.
FantasyGrounded is a way to read and backup data from campaigns.
At some point I hope to merge the two, but currently they're separate.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks