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
|
|
#4 |
Senior Member
Join Date: Nov 2017
Location: Trafford, PA, USA
Posts: 226
|
Quote:
|
|
#5 |
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. |
|
#6 |
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. |
|
#7 |
Senior Member
Volunteer Data File Contributor
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729
|
Quote:
So class ability A selects a rogue talent and then does what? You can't add this rogue talent, you can not change any of its values, and its scripts will not fire because its not a Pick. To cover your current issue your foreach is reading THINGS and your dropdown is setup to look at PICKS. This is why originally you where getting "Nothing to select". To fix this go into your class ability and on the "Item Selection" section change "Restrict First List To..." to be "All Things". Now your list you generate will be Things and the dropdown will be Things. To cover one last idea is that you do NOT need a foreach loop to even build a dropdown list. You can add your own "Custom Expression" and the dropdown is built for you. For the custom expression simply add this: Code:
component.Ability & abCategory.Inh_tal 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. |
|
#8 |
Thread Tools | |
Display Modes | |
|
|