DMsGuild
  1. #1

    Creating a dynamic list

    Hello.

    I am trying to make an extension where I have a list where the player can add the skills they need.

    Something like this:

    Skill Name - Stat - Stat bonus - Total (with roll)

    Basically I want to copy the skill list functions from the 5E D&D module, without the built in skill list.
    Like everything else I've made, I tried to look at the xml file from the 5E module, but after two weeks of trying I am completely stumped.
    I have absolutely no idea how it functions. I don't even understand how it is built.
    I have no experience with coding beyond what I've done for the last month.

    Not afraid to put in the work to make it function, but when I don't even know what to do, I am completely stumped.

    Not even sure what I need to ask to get help. That's how little I understand this.
    Is there someone who can point me in the right direction?
    Maybe ask the right questions? Any help is greatly appreciated.

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Newcastle, UK (for a bit)
    Posts
    26,621
    Well, I'll try to point you somewhere. Don't know if it will be of help, but lets' see...

    So, the 5e standard skill list is defined in the skilldata LUA table (in scripts\data_common.lua). In campaign\scripts\char_skilllist.lua there's a function, constructDefaultSkills, that builds the skill list in the PC sheet when the skills windowlist is first created. In the second part of this function, after the "-- Set properties and create missing entries for all known skills" comment, there's a for loop that steps through each entry in the skilldata table and, if the skill isn't there already, creates an entry for it in the skill list. So, this is actually a dynamic list that is being constructed by code. It is this code that might be of use to you to look at...

    The code is creating a new line in the skills windowlist (as this code is assigned to that control). Details on the windowlist control here: https://fantasygroundsunity.atlassia...373/windowlist

    The code uses the createWindow API command in the windowlist to create a new line - a windowlist is a list of windows, so you need to create a window to create a new line in the list. See info on the createWindow (and windowlist control) here: https://fantasygroundsunity.atlassia...t#createWindow

    This is the code used: local w = createWindow(); And it will create a new window using a windowclass defined in the <class> definition in the list control - in this case the class is "skill_item". Both the skills windowlist and the windowclass skill_item are detailed in campaign\record_char_skills.xml - looking at <windowclass name="skill_item"> will give you the details of what is created with the above createWindow command.

    Continuing in the constructDefaultSkills function we see that the new window created in the list (local variable w) is then used to set the name of the skill and the stat:

    Code:
    				w.name.setValue(k);
    				if t.stat then
    					w.stat.setStringValue(t.stat);
    				else
    					w.stat.setStringValue("");
    				end
    w.name and w.stat refer to the controls of that name in the skill_item windowclass.

    I know that's a lot of info. I recommend you go slowly through this - looking at the areas I mention in the code. If you haven't already extract the 5e (and CoreRPG) rulesets into a directory outside of the FG rulesets directory and use "Find in files" a lot to see how things tie together.

    Hope that helps point you in the right direction, and hope it's vaguely what you're looking for...
    Last edited by Trenloe; May 21st, 2020 at 20:05.
    FG Con 16 Fantasy Grounds Online RPG Convention - Postponed New date To Be Confirmed.
    Register at www.fg-con.com for all the latest info.

    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. #3
    Sounds to me that you are looking for a simple windowlist with the elements to track Skill Name - Stat - Stat bonus - Total (with roll), is that correct? I think the simplest solution would be to give your windowlist the <allowcreate /> tag and add scripting to the total numberfield to collect the stat and stat bonus. 3.5E is another way to handle skill lists, but is easier to break apart the parts you don't need. Like for instance, taking out the portions and lines of code that reference the DataCommon skills. This is the pre-built list of skills.
    How to provide an Unity Connection issue?-Connection Issues and What to Provide

    Unity Updater issue?-Updater Issues

    Classic and Unity Port Forwarding?-Fantasy Grounds Connections Explained

    Comcast or Cox ISP User?-Comcast XFinity and Cox Users

    Have a suggestion?-Idea Informer

  4. #4
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Newcastle, UK (for a bit)
    Posts
    26,621
    After reading @superteddy57's reply, I may have not really understood what you're looking for, because I probably made a lot of assumptions...

    The skills windowlist I mention, in 5e, allows players to create new skills - via the right-click "Create item" option, or through going into edit mode and clicking the green + button.

    If all you want to do is start with a blank skill list, allowing players to enter whatever they want, then take the code from the 5e ruleset, but comment out the call to the constructDefaultSkills function I mentioned in post #2. If you then want to change the fields then look at the skill_item windowclass I mentioned.
    FG Con 16 Fantasy Grounds Online RPG Convention - Postponed New date To Be Confirmed.
    Register at www.fg-con.com for all the latest info.

    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
    Thanks both of you. I think I can try a bit more with this information.
    Neither english nor coding is my native language, so it is a bit tough to describe exactly what I am trying to do.

    But I think superteddy57 got it. Just a place where the player can list the skills that he has, and when he adds them the list is populated with options for choosing attribute and other elements (like total score, bonuses etc.)

  6. #6
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Newcastle, UK (for a bit)
    Posts
    26,621
    Quote Originally Posted by ShakyLuigi View Post
    Just a place where the player can list the skills that he has, and when he adds them the list is populated with options for choosing attribute and other elements (like total score, bonuses etc.)
    OK, cool - thanks for clarifying. Then look at doing what I mentioned in post #4 - get the 5e code and disable the constructDefaultSkills function.

    I did this in a test campaign using a modified 5e ruleset (just commented out constructDefaultSkills). The image on the left is the basic setup for a new PC (we'd have to see where the perception is being set) and the image on the right is after I've entered edit mode and added two new skills manually:

    Attached Images Attached Images
    FG Con 16 Fantasy Grounds Online RPG Convention - Postponed New date To Be Confirmed.
    Register at www.fg-con.com for all the latest info.

    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
    Thanks for the help! I ended up using the 3.5 solution, as it was much easier to understand for me. I've transfered it into my extension, and been able to use ut. Now I just need to modify it a bit more to suit the ruleset, but with this help I spent one day solving something I tried solving for the last two weeks. So thanks again for the help!

Thread Information

Users Browsing this Thread

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
DMsGuild Classic

Log in

Log in