5E Product Walkthrough Playlist
Page 1 of 2 12 Last
  1. #1

    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)
    Get metadata and data from a specific campaign:
    Code:
        campaign = data.getCampaign('Basic Campaign')
        print(campaign.metadata, campaign.getData())
    Other Data Files
    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
    1. Pull data using the datahelper.pymethods, or by directly accessing it through campaign.py.
    2. Use the included utils to convert the data from XML→Dict→
    3. Render the data usable for FGModGen or readable by other processes.


    Installation
    1. Download Python 3.x
    2. Clone or download FGModGen(Github)
    3. 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.
    But it may also consist of image, text, or other files.

    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\')
    FGModGen is written in Python 3 and currently supports image and map packing. The source is here(github).

    Installation
    1. Download Python 3.x
    2. Clone or download FGModGen
    3. 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)
    4. Run the script.
    5. 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!

  2. #2

    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.

  3. #3
    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')
    From here change the data in ModuleGen to your liking.

    x = ModuleGen('HMaps', author='Hooker', xmlout='hookermaps', libdir='hookermaps/maps')
    Where `HMaps` is what you want the name of your mod to be.
    `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')`
    These directions should help. https://stackoverflow.com/questions/...ndows-7-64-bit

    Instead of creating a new one, open the python file in the github zip.

    Cheers

  4. #4

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096
    Thanks, hooker!

  5. #5

    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.

  6. #6
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,291
    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!

  7. #7

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096
    Congrats, hooker. You made the big time.

  8. #8
    I have updated the initial post and included a new project! I hope to merge the two together as I progress. Cheers.

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

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

    1. Git latest/redownload the repositories and then run
      Code:
      pip install -r requirements.txt
      in your local cmd/powershell.
    2. If you don't feel like getting the latest code you can just run
      Code:
      pip install lxml
    3. 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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
5E Character Create Playlist

Log in

Log in