Starfinder Playlist
  1. #1

    [5E] Get the list of all classes

    Hello!

    I'd like to retrieve from codes all the classes that are loaded. So if there's a module that contains new classes I'll be able to get them too.

    I'm pretty sure it's very easy to do but I can't really understand how it can be done.
    My twitch channel


    Currently DMing:
    D&D 5e - "Waterdeep: Dragon Heist"

    Language: Italian

  2. #2
    Quote Originally Posted by st4lk3r87 View Post
    Hello!

    I'd like to retrieve from codes all the classes that are loaded. So if there's a module that contains new classes I'll be able to get them too.

    I'm pretty sure it's very easy to do but I can't really understand how it can be done.
    Code:
    for _,nodeClass in pairs(DB.getChildrenGlobal("class")) do
      Debug.console("nodeClass:",nodeClass);
    end
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  3. #3
    Quote Originally Posted by celestian View Post
    Code:
    for _,nodeClass in pairs(DB.getChildrenGlobal("class")) do
      Debug.console("nodeClass:",nodeClass);
    end
    Argh!!! I totally missed the getChildrenGlobal. Thank you!
    I've tried it and it works only with custom classes. It looks like to get all the classes located in other modules (like the PHB) I have to use "reference.classdata" instead of "class". Is it wrong?
    My twitch channel


    Currently DMing:
    D&D 5e - "Waterdeep: Dragon Heist"

    Language: Italian

  4. #4
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,362
    Quote Originally Posted by st4lk3r87 View Post
    I've tried it and it works only with custom classes. It looks like to get all the classes located in other modules (like the PHB) I have to use "reference.classdata" instead of "class". Is it wrong?
    Read-only data (usually in commercial modules) is in the reference.*** database path. Some info on editable and read-only data here: https://www.fantasygrounds.com/wiki/...ta_File_Format
    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!

  5. #5
    Quote Originally Posted by Trenloe View Post
    Read-only data (usually in commercial modules) is in the reference.*** database path. Some info on editable and read-only data here: https://www.fantasygrounds.com/wiki/...ta_File_Format
    Thank you Trenloe. So if I want to retrieve all the classes I should collect from "class" path and "refernece.classdata" I guess.
    My twitch channel


    Currently DMing:
    D&D 5e - "Waterdeep: Dragon Heist"

    Language: Italian

  6. #6
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,362
    Quote Originally Posted by st4lk3r87 View Post
    So if I want to retrieve all the classes I should collect from "class" path and "refernece.classdata" I guess.
    Yup.

    What I've done for lookups in the PFRPG2 ruleset is to look in three places in order:
    1. In the campaign data first - this allows the GM to override standard entries with their own custom data.
    2. Editable entries in modules.
    3. Read-only entries in modules.
    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
    There is a function in the CoreRPG LibraryData script to retrieve all the registered node paths.

    Code:
      local vMappings = LibraryData.getMappings("class");
      for i = 1, #vMappings do
        for _,nodeClass in pairs(DB.getChildrenGlobal(vMappings[i])) do
          Debug.console("nodeClass:",nodeClass);
        end
      end
    Regards,
    JPG

  8. #8
    Quote Originally Posted by Moon Wizard View Post
    There is a function in the CoreRPG LibraryData script to retrieve all the registered node paths.

    Code:
      local vMappings = LibraryData.getMappings("class");
      for i = 1, #vMappings do
        for _,nodeClass in pairs(DB.getChildrenGlobal(vMappings[i])) do
          Debug.console("nodeClass:",nodeClass);
        end
      end
    Regards,
    JPG
    Thank you!
    Does this approach cover all the three steps mentioned by Trenloe?
    My twitch channel


    Currently DMing:
    D&D 5e - "Waterdeep: Dragon Heist"

    Language: Italian

  9. #9
    Yes, for 5E ruleset.

    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
  •  
5E Product Walkthrough Playlist

Log in

Log in