5E Product Walkthrough Playlist
  1. #1
    Ikael's Avatar
    Join Date
    Jan 2008
    Location
    Finland/Joensuu
    Posts
    2,384

    How to write/create image database nodes?

    Am I able to create databasenode with type="image" with bitmap value using FG API? The problem is that image typed databasenodes should look as following
    Code:
    <image type="image">
      <bitmap>path/to/image_file</bitmap>
    </image>
    First of all you cannot create databasenode containing value and no type so <bitmap>path/to/image_file</bitmap> doesn't work, then I tested creating <bitmap type="string">path/to/image_file</bitmap> which works but when I save the db.xml file the image databasenode is stripped to have no value. The only spot where I am able to "write" image typed databasenodes is to do Module.export.

    Does anyone know if this can be done with current FG engine/API?
    "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!

  2. #2
    I'm not entirely sure what you are trying to do, so I don't know if I can help you. But to add an image to the database, you must first add the image to the campaign/module. Then you must put a reference in the <image> section directly off the root. The definition I see in current databases looks like this:
    <id-00002>
    <image type="image">
    <bitmap>images/Flanaess.jpg</bitmap>
    </image>
    <isidentified type="number">0</isidentified>
    <name type="string">Flanaess</name>
    </id-00002>
    ... so the <bitmap> attribute has its own typing internally and you don't need to add anything like 'type="string"'. Perhaps the lack of a <name> value on your image is what is causing problems. At any rate, if you add the image inside of FG, this should be already done. If you are adding it to a module, I think you would have to manually edit the xml. I'm not sure how you might do this by progmatically creating the database node other than to say it might be required to make it a child of <root><image>.
    Last edited by Nickademus; November 25th, 2016 at 22:54.
    I never claimed to be sane. Besides, it's more fun this way.

  3. #3
    You can create a drawing-only image node using the DB.createChild or databasenode.createChild function. However, you can not set the bitmap value. It's not supported in the API at all.

    Regards,
    JPG

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
  •  
DICE PACKS BUNDLE

Log in

Log in