Member
Join Date: Feb 2017
Location: Italy
Posts: 65
|
How can I hide/preclude all the other traits that don't come from a determined source? Like, if I have "The Shackled City" source selected I want to see only its traits, nothing else (not even - Custom Trait -).
I've tried this method, but it gives me this error: Here's the code I used (Phase First, Priority 10000, Index 1): Code:
~ Find all other traits foreach thing in Trait where "!TraitCat.ShackCity" ~ If no trait category then pull the thingid If (eachthing.tagcount[TraitCat.?] = 0) Then perform eachthing.pulltags[thingid.?,HideTrait] ~ If we have a category then pull the cateogry only ~ if we have not already pulled it. Else If (eachthing.intersect[TraitCat,TraitCat] = 0) then perform eachthing.pulltags[TraitCat.?] Endif Endif nexteach ~ Create Hide Trait Catagory tags perform pulltags[TraitCat.?,HideTrCat] ~ Push the hide trait tags to the hero perform hero.pushtags[HideTrCat.?] perform hero.pushtags[HideTrait.?] |
#1 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,215
|
Right now, you've got a typo in the second line of that text - debug the trait picks - figure out what the correct component Id is that you should be using to identify them as a group.
|
#2 |
Member
Join Date: Feb 2017
Location: Italy
Posts: 65
|
How do I "figure out" such thing?
|
#3 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,215
|
Develop menu, make sure Enable Data File Debugging is turned on. Then, add a trait to your test character, right-click it, and choose "Show Debug Tags for XXXXX". In the list of tags, look for the various "component" tags, and find one that will narrow the search down as much as possible.
|
#4 |
Member
Join Date: Feb 2017
Location: Italy
Posts: 65
|
Now I get this:
|
#5 |
Member
Join Date: May 2021
Posts: 84
|
The HideDeity and HideDeiCat tags were added in an update to specifically allow data file authors to control which deities are shown to the player.
Those tag groups were probably hardcoded into the denytag element of the "Deity" ChooserTable, which is something that scripts can't change on existing choosers or tables in the UI. Unless similar tag groups were added to the denytag element of the traits table, you can't use the same method since it requires LW to have explicitly mapped the tag group on the hero to a tag group on the things that would be displayed. |
#6 |
Member
Join Date: Feb 2017
Location: Italy
Posts: 65
|
Quote:
|
|
#7 |
Member
Join Date: Feb 2017
Location: Italy
Posts: 65
|
Another question: I'm trying to hide all non-Core languages (all those languages outside the Core Rulebook), but I'm having a hard time with that too.
Code:
~ Find all non-Greyhawk languages foreach thing in BaseLang Category where "!component.BaseLang" ~ If no language category then pull the thingid If (eachthing.tagcount[LangCat.?] = 0) Then perform eachthing.pulltags[thingid.?,HideLang] ~ If we have a category then pull the cateogry only ~ if we have not already pulled it. Else If (eachthing.intersect[LangCat,LangCat] = 0) then perform eachthing.pulltags[LangCat.?] Endif Endif nexteach ~ Create Hide Language Catagory tags perform pulltags[LangCat.?,HideLanCat] ~ Push the hide deity tags to the hero perform hero.pushtags[HideLanCat.?] perform hero.pushtags[HideLang.?] |
#8 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,215
|
In line 2, what is "Category"?
"Reference to undeclared variable" means "I don't recognize this code (because it's not something that exists) - maybe you were trying to use a variable?" |
#9 |
Member
Join Date: May 2021
Posts: 84
|
Here is the documentation for the "foreach ___ in ___ where ___" loops.
http://hlkitwiki.wolflair.com/index....age_Statements In addition to the extra "Category" text which shouldn't be there, the first line of your code has a bigger problem and the for-loop's code will never run. Code:
foreach thing in BaseLang where "!component.BaseLang" Trying to do this sort of thing dynamically like the original code only works in specific situations, where everything is set up in a specific way. (For example, the original code might not work as expected if any deity is tagged with multiple categories, since even if that particular thing entry is excluded by the where part of the for-each loop, it will be hidden if any other thing has one of the other same category tags.) It also doesn't work well for a situation where there isn't an easy tag to filter in the where expression. If you are creating your own set of datafile, I would suggest adding your own language category to the specific languages you want to keep using extthing (in the xml) or "*Extend Thing" entries in the editor to add the tag. Code:
<extthing thing="lCommon" group="LangCat" tag="DEMcore"/> <extthing thing="lGnome" group="LangCat" tag="DEMcore"/> If you are trying to do a setting conversion from within the script of an individual adjustment, that's significantly more difficult and would require a very thorough understanding of how the existing herolab code works. Last edited by ploturo; April 18th, 2022 at 06:36 PM. |
#10 |
|
|