Senior Member
Join Date: Jan 2011
Location: Flint, MI
Posts: 100
|
I am trying to create an eval rule that will count the number of times the ability has been added and if it has been added more than 3 times throw an error. Here is what I have. Any help with why it is turning the ability red and displaying the error message on every copy of the ability added would be appreciated.
Code:
~These calculations should only happen for the first copy doneif (tagis[Helper.FirstCopy] = 0) if (field[xCount].value >= 3) then @valid = 1 endif |
#1 |
Senior Member
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 464
|
I am no expert, but isn't your script telling the ability to be valid if xCount is 3 or more? That looks like the opposite of what you intend.
|
#2 |
Senior Member
Join Date: Oct 2011
Posts: 865
|
Lord Magus is correct. change the >= to to a < or make @valid=1 by default and make it = 0 if your >= condition is true.
depends on your coding style. |
#3 |
Senior Member
Volunteer Data File Contributor
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729
|
Quote:
On the Right side under all the blue buttons is a "Max Limit" section. If you simply type in 3 then HL will take care of only letting three be added before it throws an error. Much easier. Image1.jpg P.S. - If this is a "Custom Ability" then their is no "xCount" field. To find and see fields make sure you go to "Develop->Enable Data File Debugging". Then add your "Custom Ability" to the character and right click the question mark and you have new choices. Select "Shadow Debug Fields for xxx". Then a new window appears where you can actually see the fields and their values and will look like this: Noname.jpg 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 9th, 2013 at 08:50 AM. |
|
#4 |
Senior Member
Join Date: Jan 2011
Location: Flint, MI
Posts: 100
|
Thank you, I had not seen that max limit before. Or, rather I had, but I had not paid attention to it.
|
#5 |
|
|