-
January 1st, 2018, 18:22 #1
- Join Date
- Nov 2017
- Posts
- 9
Mod File Generation and Packing Tool
Sadly I cannot edit the title but maybe I'll create a new post once I consolidate it the packages below.
FantasyGrounded
New Project(2/13)
FantasyGrounded (PhantasY) is a project that helps utilize and explore data from the Fantasy Grounds application. Currently campaign data is supported including data available from previous sessions. As a DM and as a player I prefer to backup my character sheet after each session -- the first goal of this project is to automate character backups after each session.
Search through existing campaigns:
Code:from phantasy import datahelper data = datahelper.DataHelper() for campaign in x.campaigns: print(campaign)
Code:campaign = data.getCampaign('Basic Campaign') print(campaign.metadata, campaign.getData())
The other forms of data in the root folder, some of which are listed here(FG Wiki), will be implemented similarly.
Searching & Reading Campaign Data
- Pull data using the datahelper.pymethods, or by directly accessing it through campaign.py.
- Use the included utils to convert the data from XML→Dict→
- Render the data usable for FGModGen or readable by other processes.
Installation
- Download Python 3.x
- Clone or download FGModGen(Github)
- Setup run.py to either search or read campaigns as below.
TODO
- Rulesets/Lua
- FGModGen is currently ruleset agnostic although it can generate modules for specific rulesets. It is necessary to allow a larger scripting platform for the Lua implementation that SmiteWork's provides.
- Extensions
- Extensions (and most other FG files) are compressed files with scripting resources. The first order of FantasyGrounded's extension capabilities is to allow UI modifications. Think FG Gap and BigFonts' XML font and graphics wrapping capabilities.
- Distribution
- Simple integration into the forum for posting and updating.
https://github.com/zacharyhooker/fantasygrounded
FGModGen
I've updated this project! (2/13)
An FG .mod files generally consist of two files:
- definition.xml - Includes the name, author, and ruleset of the mod.
- db.xml - A list of all of the data, including file locations, and their references.
FGModGen is a module generator and packer: you specify a folder, author, and mod name and the script finds images in the folder you specify and compiles a valid definition and db XML file. Then you can call mod.zip(location) to zip and install the mod to your Fantasy Ground's data folder.
Code:newMod = ModuleGen('ModuleName', author='You', xmlout='ModuleNameOUt') newMod.genXML() newMod.zip('S:\Fantasy Grounds\Data\modules\')
Installation
- Download Python 3.x
- Clone or download FGModGen
- Edit or create a new main execution and zip the file out to your FG Data/Modules folder.
(Check the bottom of MapModuleGen.py or create a new file and import ModuleGen) - Run the script.
- Load Fantasy Grounds and enable the new module in-game.
FAQ
- How is this useful for the average player?
It makes organizing maps so much nicer -- you can group them all at once and add or remove them based on what you load in the module tab. You can include larger maps in your campaigns and allow preloading over HTTP or FTP. Simply pack all of your images and maps, host the mod file somewhere and have others download and install it at their leisure. - Is there a guide for editing the XML?
I found that this(FG forums) guide is the most descriptive. If you're interested in any editing or modding the wiki can also help. I find that reverse engineering other's work is the best way to learn. - It's not working!
Please copy a few lines of the error you're seeing and Google them before PMing or posting please
TODO
- Merge with FantasyGrounded
- Implement encounters.
- Unify XML reading and production with FGrounded.
https://github.com/zacharyhooker/fantasygrounded
If any of you have any ideas or feedback, please let me know.Last edited by hooker; February 14th, 2018 at 03:21. Reason: Adding new content!
-
January 1st, 2018, 18:28 #2
Archangel
- Join Date
- Apr 2008
- Location
- Virginia Beach
- Posts
- 3,096
Welcome to the boards, hooker! A very notable start with us!
I am a windows and python idiot, so where does your code shown get typed in?
This looks famously useful.
-
January 1st, 2018, 18:46 #3
- Join Date
- Nov 2017
- Posts
- 9
Bidmaron, you need to download the code from github. This link should work: https://github.com/zacharyhooker/FGM...ive/master.zip, then download Python 3 (I prefer 3.6) from here
In the github zip you'll see the basic structure of the data.
Open MapModuleGen.py in notepad or IDLE (comes with python) and scroll to the bottom.
You should see this:
x = ModuleGen('HMaps', author='Hooker', xmlout='hookermaps', libdir='hookermaps/maps')
x.genXML()
#x.zip()
x.zip('S:\Fantasy Grounds\Data\modules')
x = ModuleGen('HMaps', author='Hooker', xmlout='hookermaps', libdir='hookermaps/maps')
`xmlout` is the directory you want your XML stored (you can change it to whatever, but I'd keep it something small.
`libdir` is the directory your images are stored in.
The `xmlout` and `libdir` are relative directories though absolute should work.
For instance..
`x = ModuleGen('BidmaronMaps', author='Bidmaron', xmlout='C:/mystuff/bidmaronmaps', libdir='C:/mystuff/bidmaronmaps/maps')`
Instead of creating a new one, open the python file in the github zip.
Cheers
-
January 1st, 2018, 18:48 #4
Archangel
- Join Date
- Apr 2008
- Location
- Virginia Beach
- Posts
- 3,096
Thanks, hooker!
-
January 1st, 2018, 18:49 #5
Archangel
- Join Date
- Apr 2008
- Location
- Virginia Beach
- Posts
- 3,096
Trenloe/MW, is there a place to put tools such as hooker's that are not ruleset dependent, or can we just save this in CoreRPG thread somewhere? This seems useful enough to warrant some kind of lasting link somewhere.
-
January 1st, 2018, 23:56 #6
Being stickied in the workshop works. Which it is now.
Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
January 2nd, 2018, 02:55 #7
Archangel
- Join Date
- Apr 2008
- Location
- Virginia Beach
- Posts
- 3,096
Congrats, hooker. You made the big time.
-
February 14th, 2018, 00:50 #8
- Join Date
- Nov 2017
- Posts
- 9
I have updated the initial post and included a new project! I hope to merge the two together as I progress. Cheers.
-
February 18th, 2018, 06:08 #9
hello hooker, I'm not sure I'm setting things up correctly. I pulled everything down with the github desktop client, installed latest version of python, and repointed x.zip path to where my FG lives.
I looked in ./phantasy/utis.py and changed what appeared to be a typo in line 1, lxml to xml
1. from xml import etree
Which changed the error to what you see below.
G:\Games\Fantasy Grounds\Data\fantasygrounded> python run.py
run.py
raceback (most recent call last):
File "run.py", line 19, in <module>
main()
File "run.py", line 14, in main
print(princes.metadata)
ttributeError: 'NoneType' object has no attribute 'metadata'Last edited by mlesnews; February 18th, 2018 at 06:17.
-
February 18th, 2018, 06:48 #10
- Join Date
- Nov 2017
- Posts
- 9
mlesnews -- whoops! I should have added the requirements.txt as part of the install. lxml isn't a typo you'll need to install lxml as well as a few other requirements.
I've added requirements.txt to both of the working repos.
There's 3 ways to solve this:
- Git latest/redownload the repositories and then run Code:
pip install -r requirements.txt
- If you don't feel like getting the latest code you can just run Code:
pip install lxml
- Or manually install lxml as per these directions.
Sorry for the confusion, let me know if you have any other issues.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks