• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Add Custom Expression to Class Special Ability

tcharleschapman

Well-known member
Hi Everyone,

I'm trying to make a drop-down list for a class special ability for an archetype I'm creating. The ability allows the character to add an item to his inventory for free that I get to pick. All I want the drop-down list is to say "Added|Not Added". This is really serving as a Validation Warning to remind me, or anyone else who uses this archetype, to add an item. Otherwise it has no actual function on Hero Lab and is not assigning anything.

Thoughts?
 
All right, I think I found something that "works". This is probably clunky and wouldn't pass so if anyone has any improvements I'm all ears.

Created Two New Contacts.
Added - ID=conAdded
Not Added - ID=conNoAdded

Go to Class Special and select the ability to be edited. In "Custom Expression":

Code:
thingid.conNoAdded|thingid.conAdded

In "Restrict First List To..." select "All Things".
 
Last edited:
If all it needs to do is inform, I wouldn't bother creating a new set of picks, instead I would either use the "Array Based Menu" if I wanted a dropdown, or the "Checkbox?" for an added/not added check.
 
So either of those will work. However, the only reason to add it is to serve as an alert to select something, hence the "Added/Not Added" option. Using the "Array Based Menu" gets me the menu, but doesn't warn me if nothing is selected.
 
Add an eval script which complains if you pick the "Not Added" option. For the array version, this would check the usrIndex field. For the checkbox it would be the usrIsCheck field.
 
I'm going to assume that you're using the array method, and that the first row is "not added" while the second row is "added". Then in an eval rule, set the message to something like "You must add X item for Y archetype!". Set the eval rule to run at Validation 10000 (which is standard), then in the code below, all you need is 1 line.

Code:
validif (field[usrIndex].value <> 0)

Since the default is row 0 for not added, the eval rule will complain and only be satisfied once someone goes to that class special and changes it to row 1 for added.
 
Thanks!

Next, this ability changes at different levels. Currently it is telling me that, at level 15, my level 17 and 20 instances of this class special are valid even though I don't qualify for them. Is there a way to fix that?

Now, questions. I'm trying to figure out how this code works.

1) Does field[usrIndex].value always connect to Array Based Menu? If not, how does it know to go there?

2) So I'm reading this wondering if I have it correct. The code is run through validation. So this means if the code is valid (i.e. "Not Added" is selected), then Hero Lab spits back that a "Validation Detail" needs to be fixed. To make it invalid, you select something else. I don't understand how the "<>" part of the code works.
 
field[usrIndex].value is the row you selected in a user based array, so yes it always is connected to the array based menu. Because arrays are 0 based, the first row has a value of 0. "<>" means "not equal to", so the code I posted basically means "We are valid if the row selected is not the first (row #0)"

I don't understand what you mean. How does it change? Why would you expect a validation error for an ability gained at 17th level, if you are not yet high enough level to gain that ability?
 
Thanks on that answer to my first question. Cleared up a lot.

In response to the 2nd part, I didn't expect a validation error. This ability kicks in at Level 5. However, at levels 1-4 when I don't have the ability, I still receive the validation alert to select an option. I hope that clears it up.
 
Ah in that case, you need to add another validif line to the eval rule, that says "We are valid if we are not hign enough level to get this class ability."

Here is some information, which you can use to create that statement.

tagis is a command that checks for the presence or abscence of a tag. If the tag is found, then tagis returns a 1. If no valid tag is found, it returns a 0. It is used like this:

tagis[GROUPID.TAGID]

Once a class is high enough to gain an ability, the ability gains a Helper.ShowSpec tag.
 
it's just like a doneif shutdown code for a special except you're putting a

validif (tagis[Helper.ShowSpec] <> 0)
 
AndrewD2 - think about that one - do you want to use <> 0 or = 0 to mean "Has not reached the correct level, and is therefore not shown as a special"
 
WhooPS yeah that should be validif (tagis[Helper.ShowSpec] = 0)

There's a reason I copy/paste my shutdown scripts.
 
Back
Top