Log in

View Full Version : Filter Data Library?



SieferSeesSomething
August 9th, 2025, 23:57
Let's say I've got a module with a bunch of data dumped in the same place that I want to display in a sidebar, but organized differently. Is there a good way to do that if I don't really have the capability to change the organization of the module data itself?

For a specific example, let's say the module is organized so that it's got races and subraces in the same <reference><races> xml bucket, and I want to display one record library in the sidebar for races, and one for subraces. (This isn't exactly what I want to do, but it's close enough.) Like some way to make a record that takes only some of the data from within some category of xml in the module? I don't mind doing some lua string manipulation or even specifying the xml elements I want to include/exclude manually, just not sure where I'd do it.


aRecordOverrides = {
["race"] = {
aDataMap = { "race", "reference.races" },
sListDisplayClass = "masterindexitem_id",
sRecordDisplayClass = "reference_race",
tOptions = {
bExport = true,
}
}
};

function onInit()
LibraryData.overrideRecordTypes(aRecordOverrides);
end

So I got this right now in my data_library.lua. That's as far as I've gotten.

LordEntrails
August 10th, 2025, 02:45
Purely from a logic point of view, There has to be something to distinguish the races from the sub-races. Is their some attribute? Could you use a discrete list of values for all races and assume anything else is then a subrace?

Not sure what the LUA code would like like to filter, but I think that would be your approach.

Moon Wizard
August 11th, 2025, 05:12
I would highly recommend against hard-coding vs. setting up as records; as you will be creating a lot more work for yourself when adding new material and data modules.

There's a good reason why the 5E material breaks up records like it does to support all the various books.

Regards,
JPG

claedawg
August 11th, 2025, 05:17
Is this for 5E?

I haven't played 5E in over year and I'm not a coder, but if I remember correctly, sub-races are created in the Parent Race entry and do not have their own sidebar, as you can only select the subrace if you have the parent race entered on the CS. If that is correct, I doubt you would be able to create a sidebar menu for the sub-races as they are not a thing unto themselves.

superteddy57
August 11th, 2025, 05:23
Is this for 5E?

I haven't played 5E in over year and I'm not a coder, but if I remember correctly, sub-races are created in the Parent Race entry and do not have their own sidebar, as you can only select the subrace if you have the parent race entered on the CS. If that is correct, I doubt you would be able to create a sidebar menu for the sub-races as they are not a thing unto themselves.

In terms of 5E this is incorrect at this time. The subraces are a button on the race masterindex window. Once you click it it will open it's masterindex to add them. The system will pick up what subrace belong with which race.
65093

claedawg
August 11th, 2025, 14:13
Oh yeah, I think they also made the same improvement for sub-classes the last I played. I had forgotten all about that.

SieferSeesSomething
August 25th, 2025, 02:54
Nah it's for 4e. Basically the full context is that there's two Compendium converters floating out there to turn old ddi data for those lucky enough to still have it into FG modules. One has been updated more recently than the other one. I made my 4e Races extension to work with that one, but not the other one. I finally got ahold of the other one and have been trying to make my extensions work with it, too, but it's difficult because the data is organized in a way more unhelpful way because it's older lol.

The data is made for the reference library but not really for anything else. The records aren't organized for a proper records library well like the other 4e module. For example, it looks like this, although I'll change the name of any actual 4e data.


<?xml version="1.0" encoding="iso-8859-1"?>
<root version="2.2">

<reference static="true">
<races>
<ATypeOfElf641>
<name type="string">ATypeOf Elf</name>
<source type="string">Race</source>
<description type="formattedtext"><p><b>ATYPEOF ELF FEATURES</b></p><b><listlink><link class="powerdesc" recordname="reference.races.ATypeOfElfRacialTrait641@4e Races, Backgrounds, Themes">Elf Racial Trait</link><link class="powerdesc" recordname="reference.races.ATypeOfElfElfWeaponProficiencyATyp eOfElf641@4e Races, Backgrounds, Themes">Elf Weapon Proficiency (This Elf)</link></listlink></b><p></p><p>A bunch of the xt descriptions of this race. Ipsum lorem. Etc and so on. </description>
</ATypeOfElf641>
<ATypeOfElfRacialTrait641>
<name type="string">Elf Racial Trait</name>
etc etc etc various string tags
</ATypeOfElfRacialTrait641>



As you can see, the races and their traits and proficiencies are all in the same level of the <races> element. So when my extension adds a record library for races, their powers and traits appeared in the list, too. If I could fix this, I was thinking of also using the logic to pick out subraces from the list, since even my other 4e module considers things like Gold Dwarf and normal Dwarf different races.

Wonder if the best thing to do would be to either just give up and have it work for only one of the two 4e data modules floating around lol. Either that or fork the original parser, but that would only be useful for a few people that have this specific version of the old ddi data. Might not be worth it.

Fin lol.