Starfinder Playlist
  1. #1

    Join Date
    Apr 2009
    Location
    Fullerton, CA.
    Posts
    625

    Need help with a function to filter a list, please.

    I have a list set up, and on a separate window instance I want to reuse the list, but filter the contents. For instance I have set up a skills list, and then on a mini sheet I want to reuse the list, but only want it to contain a few combat related skills, like "Dodge" , "Parry", climb, etc..

    I have the entire list set to be invisible, figuring I could find the specfic skills and then set them to be visible. I could set up a button field to switch visiblity on off, but that would reside in the skill list template and effect the skills tab. I could have a seperate list, but that defeats the purpose, and forces a player to track/advance a skill in two different places.

    So far, I can find the skill, it's name, but can not turn on/off the visibilty to just a specific skill. It's the whole list that is modified. I figure I need to get the ID of the skill, and am not sure how to do that. If I could find that, I should be able to set that ID node as visible and have a shortened skill list.

    function FilterSkills()
    local node = window.getDatabaseNode();
    local basicskills = node.getChild(".basicskills");
    local sCombatSkill = "Dodge" or "Parry";

    if (basicskills ~= nil) then
    for k, v in pairs (basicskills.getChildren()) do
    if v.getChild("name").getValue() == sCombatSkill then
    local ID = ("a way to find the ID number of the skill in the database")
    return ID;
    end
    ID.setVisible(true);
    end
    end
    end

    Any help is appreciated.

    -Paul
    Last edited by Paul Pratt; July 14th, 2014 at 07:45.

  2. #2
    I'm thinking a hidden skill "type" field for each skill record, then a hidden "filter " field, and set the list to use the hidden filter to only show skills of the given type field.

    It's late, so let me know if you need me to explain more.

    JPG

  3. #3

    Join Date
    Apr 2009
    Location
    Fullerton, CA.
    Posts
    625
    I must be using the "filter" xml tag incorrectly.

    I set up a hidden stringcontrol named "reaction". The value in that control is yes or no. I want to filter so I have only the "yes" skills showing. Using filter I have the <control> tag set to reaction, but I am unsure how to set up the <field> tag.

    I am assuming I use <filteron> insted of <filter> since this would be a child to the skills list?

  4. #4
    Yes. The filteron tag specifies the list child field/control to filter the results by, and the filter tag specifies the string field/control to use as the filter.

    Code:
    				<filter control="filtertype" />
    				<filteron field="skilltype" />
    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