DICE PACKS BUNDLE
  1. #1

    Return order of getChildren as per XML order

    Afternoon Folks,

    I've got a node which stores the results of the dice rolls. Works lovely:

    <savedroll>
    <id-00004>
    <result type="number">6</result>
    </id-00004>
    <id-00005>
    <result type="number">10</result>
    </id-00005>
    <id-00006>
    <result type="number">3</result>
    </id-00006>
    </savedroll>
    However when I do a DB call and get the children, they come in a random order, last time it was:

    Runtime Notice: s'v' | databasenode = { charsheet.id-00005.savedroll.id-00006 }
    Runtime Notice: s'v' | databasenode = { charsheet.id-00005.savedroll.id-00005 }
    Runtime Notice: s'v' | databasenode = { charsheet.id-00005.savedroll.id-00004 }
    Next time it was 8,9,7

    Any thoughts?

    Cheers
    MBM
    Ruleset and much more content built for FGU.
    Come join me on Twitter at: https://twitter.com/MadBeardMan to see what I'm up to!

  2. #2
    Ikael's Avatar
    Join Date
    Jan 2008
    Location
    Finland/Joensuu
    Posts
    2,383
    That is correct. DB.getChildren does not return in order where they are presented in XML, instead they are identified by their node name (string type) in table and when you use pairs to iterate them through they seem to come out in "random" order. In SavageWorlds I had need to get them in asc order so I have implemented getChildrenSorted function t achieve that.

    Quote Originally Posted by MadBeardMan View Post
    Afternoon Folks,

    I've got a node which stores the results of the dice rolls. Works lovely:



    However when I do a DB call and get the children, they come in a random order, last time it was:



    Next time it was 8,9,7

    Any thoughts?

    Cheers
    MBM
    "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!

  3. #3
    Quote Originally Posted by Ikael View Post
    That is correct. DB.getChildren does not return in order where they are presented in XML, instead they are identified by their node name (string type) in table and when you use pairs to iterate them through they seem to come out in "random" order. In SavageWorlds I had need to get them in asc order so I have implemented getChildrenSorted function t achieve that.
    It's ok I fixed it myself.

    I now have the 'dice' number stored along with the result, and it sets the 'Dice..i' with that value.

    Cheers!
    MBM
    Ruleset and much more content built for FGU.
    Come join me on Twitter at: https://twitter.com/MadBeardMan to see what I'm up to!

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