5E Product Walkthrough Playlist
Page 2 of 2 First 12
  1. #11
    Quote Originally Posted by Trenloe View Post
    That's a good idea. As long as it's not exporting a sh1t tonne of data each time.

    @Valgul - As an example, here's a simple extension that sets up the export for the DB's calendar node. It exports just an XML file (not a whole module) using DB...
    Thanks a lot! Any idea where should I start looking in order to launch the export every time an attack happens?

  2. #12
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,404
    Quote Originally Posted by Valgul View Post
    Thanks a lot! Any idea where should I start looking in order to launch the export every time an attack happens?
    It depends which ruleset you're using.

    Most commonly it will be in scripts\manager_action_damage.lua. You'll need to do it in the OOB messaging (which runs on the GM side, even for player attacks) as the GM is the only instance that can export.
    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!

  3. #13
    EDIT: I had to use a full path to save the file.
    Last edited by Oso Buho; March 1st, 2018 at 21:24.

  4. #14
    Ikael's Avatar
    Join Date
    Jan 2008
    Location
    Finland/Joensuu
    Posts
    2,384
    Quote Originally Posted by Valgul View Post
    local sFile = "PCs.xml";
    if sFile then
    DB.export(sFile, "charsheet", "character", true);
    ChatManager.SystemMessage("Exported characters log.");
    end
    Will attempt to write PCs.xml file to your OS's root, which is no-go permission-wise. You need to define absolute file path within AppData folder to make sure FG has permissions to write the file.
    "Alright, you primitive screwheads, listen up: THIS... is my BOOMSTICK!" -- Ash Williams, Army of Darkness

    Post your SavageWorlds ruleset feature requests and issue reports here!

  5. #15

  6. #16
    LordEntrails's Avatar
    Join Date
    May 2015
    Location
    -7 UTC
    Posts
    17,244
    Blog Entries
    9
    A consideration, how are you going to handle healing effects and manual corrections to HPs done either in the CT or on the character sheet? Might need a manual "refresh" command/button.

    Problems? See; How to Report Issues, Bugs & Problems
    On Licensing & Distributing Community Content
    Community Contributions: Gemstones, 5E Quick Ref Decal, Adventure Module Creation, Dungeon Trinkets, Balance Disturbed, Dungeon Room Descriptions
    Note, I am not a SmiteWorks employee or representative, I'm just a user like you.

  7. #17

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096
    What I would do is install an onUpdate handler on the current hit points of any character. Then, it doesn't matter how the hit points change. Your handler will get called and you can re-export whatever you need to export. That db name will vary based on the ruleset, but you would install it like this (do it in the onInit of your extension):

    Code:
    		DB.addHandler(sNodeName.. ".*@*","onUpdate",onThingChange);
    Where onThingChange is the name of your handler routine to do the export.

    and uninstall it like this: (do it in the onClose of your extension):

    Code:
    		DB.removeHandler(sNodeName.. ".*@*","onUpdate",onThingChange);
    Last edited by Bidmaron; March 2nd, 2018 at 00:48.

  8. #18
    Quote Originally Posted by LordEntrails View Post
    A consideration, how are you going to handle healing effects and manual corrections to HPs done either in the CT or on the character sheet? Might need a manual "refresh" command/button.
    Actually, I'm considering on creating a whole extension that will pick up any update to the health now. I still have one problem though... maybe someone can help.

    It truly BOTHERS me that I need to hardcode the whole path where to export the file. Is there no global variable of sorts that I can use to pick up the folder of the Campaign that is currently playing?

    Like: DB.export(campaignFolder/PCs.xml, "charsheet", "character", true);

    I've seen there a openDataFolder or openCampaignFolder within the Interface Package... but I want to get the Path so I can use it in my export, not to open it.

    Thanks.
    Last edited by Oso Buho; March 2nd, 2018 at 08:40.

  9. #19
    UPDATE:

    Did it the way I mentioned and it works... or it does 50% of the times.

    I'm using the following in different situations (onInit, and every time a players HP updates):
    local AppDataFolder = os.getenv('APPDATA');
    local PCsFolder = AppDataFolder + '/Roaming/Fantasy Grounds/PCs.xml';
    DB.export(PCsFolder, "charsheet", "character", true);

    Unfortunately, I get an error on os.getenv being null every now and then, it's random (I would say about 75% of the times.

    Any idea on what could be causing this?

  10. #20
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,404
    os.getenv shouldn't be available. I'm surprised it works at all.

    More info here: https://www.fantasygrounds.com/wiki/...ua_Programming
    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!

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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
  •  
Starfinder Playlist

Log in

Log in