-
July 14th, 2014, 07:23 #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) thenfor k, v in pairs (basicskills.getChildren()) doif v.getChild("name").getValue() == sCombatSkill thenlocal ID = ("a way to find the ID number of the skill in the database")return ID;endID.setVisible(true);endendend
Any help is appreciated.
-PaulLast edited by Paul Pratt; July 14th, 2014 at 07:45.
-
July 14th, 2014, 09:57 #2
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,561
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
-
July 14th, 2014, 17:27 #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?
-
July 14th, 2014, 17:48 #4
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,561
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" />
JPG
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks