Starfinder Playlist
  1. #1

    Generating Images/Maps (FGU Scripting)

    Hey everyone,

    I'm trying to create an extension for Fantasy Grounds Unity that will generate basic outdoor maps from a set of backgrounds and other decorative images.

    I have never written a FG extension before, and I am running into some issues, hopefully someone can help.

    So far, I have created an additional button in the Images window that creates a new image under a new category with a random name. I am trying to figure out how to add a layer to it (using an asset that is already loaded) and not having any luck. Is there an API call to do this? What I have been trying is just using "createChild" and "setValue" on the image node I created, but it is not adding entries in the "<layers />" node.

    Any ideas?


    Here's an example of the XML I am generating... (I can't get anything to go under the layers element!)
    <category name="Maps - Generated">
    <Plains-b67bd10c-1aef-4f99-b63c-b77298014775>
    <image type="image">
    <allowplayerdrawing>on</allowplayerdrawing>
    <gridsnap>on</gridsnap>
    <layers />
    </image>
    <locked type="number">0</locked>
    <name type="string">Plains - Fri Jul 31 16:52:44 2020</name>
    </Plains-b67bd10c-1aef-4f99-b63c-b77298014775>
    </category>
    Last edited by seansps; July 31st, 2020 at 21:53.

  2. #2
    There is no way to interact with the image data at this point that will allow you to interact with layers. The only thing you can do currently is use a DB.setValue call on the node to reset all layers, and set a single layer in place using a string variable. We won't be looking at fleshing out the image API until sometime after we get to release; since there are a lot of moving parts in the image area still.

    Regards,
    JPG

  3. #3
    Thanks, that's too bad, this would be a great feature, but I look forward to being able to have more control here!

    As far as what you said about "set a single layer in place using a string variable". Is it possible to do this to add layers using existing JPG assets? (Each as a layer?)

  4. #4
    No, it was simply a way to create a simple single layer image to support existing ruleset functionality. The DB.setValue call to an image data node with a string clears all layers, and inserts the one in the string as the only layer.

    Regards,
    JPG

  5. #5
    Got it. Thanks for the info!

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
  •  
FG Spreadshirt Swag

Log in

Log in