|
Senior Member
Join Date: Nov 2017
Location: Trafford, PA, USA
Posts: 226
|
Hi folks, still having a little trouble understanding how to script a foreach loop, and I'm hoping someone can guide me in the right direction.
I'm creating a class ability that selects from a set of rogue talents. I've identified each valid rogue talent with the tag "abCategory.Inh_tal" I then put in the following eval script: Code:
foreach thing in Ability where "abCategory.Inh_tal" field[usrCandid1].text = splice(field[usrCandid1].text, eachthing.tagids[thingid.?], " | ") nexteach But on the class tab, the drop-down menu still shows "Nothing to select". What is my script missing? |
#1 |
Senior Member
Join Date: May 2015
Posts: 830
|
Not sure you are trying to achieve your goal correctly. You probably need to use a candidate expression on said field, not try to muck with values.
|
#2 |
Senior Member
Volunteer Data File Contributor
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729
|
I assume the issue is that you have the Dropdown setup to use Picks and the Foreach loop is looking at Things. Either change your dropdown to look at Things or change the foreach loop to look at Picks. But currently you have apples looking at oranges and wondering why they don't match.
Another way is to take the dropdown out of the equation and do the following: Code:
foreach thing in Ability where "abCategory.Inh_tal" debug eachthing.idstring nexteach 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. |
#3 |
Senior Member
Join Date: Nov 2017
Location: Trafford, PA, USA
Posts: 226
|
Quote:
|
|
#4 |
Senior Member
Volunteer Data File Contributor
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729
|
Quote:
Let’s start over and tell me what you are trying to do/accomplish and then I will have a better chance to answer with the correct way to solve the issue. 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. |
|
#5 |
Senior Member
Join Date: Nov 2017
Location: Trafford, PA, USA
Posts: 226
|
Quote:
I'm creating a class ability that asks the user to select from a menu of rogue talents. One selection, made at first level, and done. Seems easy, but the script I wrote above just doesn't find the right items, even though the debug identified the correct candidates. Thanks for your help. It's very much appreciated. |
|
#6 |
Senior Member
Join Date: Nov 2017
Location: Trafford, PA, USA
Posts: 226
|
|
#7 |
|
|