View Single Post
ShadowChemosh
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,730

Old February 7th, 2016, 11:19 AM
I think I would be better off to go over how to find the information about Custom Expressions and how to construct your own. You know the old saying 'teach a man to fish'. If not already please read over the "Glossary of Terms" so you know the difference between a "Pick" and a "Thing".

A "Custom Expression" is like a "Find" or "Search" feature really. I assume everyone has done one of those. You have a big word document and you want to find the instance of the word "Shadow". You bring up the "find" window and type in Shadow and press "find" and boom you find it or not in the text.

What if you wanted to find only "specific" instances of "Shadow" like say you wanted only the words with the "S" being capitalize. You can click on "Match Case" to find that specific "Shadow" that is capitalize.

Where I am going with all this is that Custom Expression is just like the above but instead you are looking for Specific "Thing" or "Pick" in the Hero Lab database. Not only are custom expressions used for creating a Drop down list but you will need the same logic for foreach loops and findchild[]. Instead of using "words" to do your find/search you instead use "Tags" specifically a Group.Tag. Tags are the building blocks of HL and help to group together specific Things. Please see Aaron's post HERE for more info on how to work with tags in HL.

We can combine multiple tags together using "and" & "or" logic to produce some very complex expressions. In addition Custom Expressions understand the use of brackets just like math. So in math if I said (1 + 1) * 2 = you know the stuff in the brackets is done before the multiplication. HL uses the same logic style.

In HL custom expressions a "and" statement is done with the "&" symbol and a "or" is done with "|" symbol. Another helpful one to know is "not" by using "!". Let me sum that up:
  • & = and
  • | = or
  • ! = NOT
  • ( ) = Brackets to control groups

Lets look at some of the ones you wanted:
1) I want to create a drop down menu to select from a list of all cantrips.

How do you find the "Tags" you need to work with? The simplest method is to make a character and add a "Cantrip" to it. Then go to Develop->Enable Data File Debugging. Then on the cantrip where you see the "?" RIGHT mouse click to bring up a new window of options. Select "Show Debug Tags" which will bring up the window of all the "Tags" and "Groups" that exist on the Cantrip.

The first Group.Tag you want to start with is the "most" generic of tags which is the "Component" tags. You then drill down to more "exact" tags as you go to the left. In this case "BaseSpell" is the "base" component that makes up all spells in HL. In other systems we don't have a tag that says "Cantrip" but usually the "Spell Level" is simply 0. So you should see a tag for "sLevel.0" meaning its a cantrip or zero level spell.

Put together you get this:
Code:
component.BaseSpell & sLevel.0
The above tells HL to produce a list of Things or Picks that meet the listed expression.

In 5e there is also a "Helper" tag added called "Helper.Cantrip" that could be used to sort the list by instead:
Code:
component.BaseSpell & Helper.Cantrip
Lets say we wanted to exclude all the zero level spells from the Cleric Class.
Code:
component.BaseSpell & sLevel.0 & !sClass.cHelpClr
We add another "and" with a "NOT" equal to the Spell Class (group id) and the "Class Helper ID for Cleric". Where did I find this tag? I added a Cleric Cantrip and looked at the tags on it.

Hero Lab Resources:
Pathfinder - d20pfsrd and Pathfinder Pack Setup
3.5 D&D (d20) - Community Server Setup
5E D&D - Community Server Setup
Hero Lab Help - Hero Lab FAQ, Editor Tutorials and Videos, Editor & Scripting Resources.
Created by the community for the community
- Realm Works kickstarter backer (Alpha Wolf) and Beta tester.
- d20 HL package volunteer editor.

Last edited by ShadowChemosh; March 14th, 2016 at 04:26 PM.
ShadowChemosh is offline   #3 Reply With Quote