• 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

Counting tags by class?

TCArknight

Well-known member
Howdy!

This is a question for files I'm working on for pathfinder, but as it's a general procedural question I figured it belonged here. :)

I have a tag "Custom.MyTag" which two of my classes forward to the Hero. I've got a tagcount[Custom.Mytag] >= 3 exprreq on a feat as a prereq. However, right now as it is if I have a Class1 2 / Class2 1 multiclass character the Hero will have 3 Custom.Mytag entries and meet the prereqs when it shouldn't.

Is there a way to get the current class level being added and splice that value to the end of the tag making something like MyTag2 or MyTag3? Then I could check for tagcount[Custom.Mytag3] >= 1 . Right?

Any thoughts are welcome. :)
TC
 
You'll have to manually create a different tag for each class.

However, for tests that are looking for any of those tags, if you construct your tag ids correctly, you can use a ? in the tagcount:

tagcount[Custom.MyTag?]

if all of your tags begin with MyTag, and then have some other text or numbers.

Why don't you tell me without using hero lab terms what you're trying to achieve with this - there may be another option for how to go about it.
 
Thanks. :)

I'm trying to get things together for the Psionics Unleashed book, so I'm trying to create a tag to manage the "Manifester Level 3+" requirements and such since the Psionics files and tags aren't active yet.

I'm adding a "Psionic" tag for the class and this one I'm thinking do something like this:

count number of current levels in class
newcount = add 1 to count
tag = "Manifest" & newcount

forward tag to hero

Then, if the hero has 2 levels of the class already, the newcount will be 3 and tag will be "Manifest3". so my prereq check could look for Custom.Manifest3 if that makes sense?

TC
 
You can use a foreach in your prereq to search through the manifester classes on the hero and look up the manifester level of each. That seems preferable to creating 20 different tags.
 
I didn't think whether a class was a Manifester was exposed in the code at this point?

Or do you mean something like:

Foreach class
if class has tag manifester
if level >= 3
Valid
endif
endif

Something like that?
 
Yes, although you can use:

foreach Class in hero where "The Manifester Tag"

Rather than having to get into the foreach before checking whether that tag exists.
 
Ok, I'm almost there...

However, I still get an Invalid Syntax on the eachpick.thingid in the code below.

foreach pick in hero from BaseClass where "Custom.Manifest"
if (#levelcount[eachpick.thingid] >= 3) then
@valid = 1
endif
nexteach

Do I need to move the thingid to a variable and use that in the levelcount macro?
 
#levelcount[] has to have the Id of the class in question inside the brackets. It won't accept anything else. It's also not set up to accept a variable.

field[cTotalLev].value is the field on a class that stores the level of the class, so:

Code:
foreach pick in hero from Class where "Custom.Manifest"
  validif (field[cTotalLev].value >= 3)
  nexteach

(validif(XXXXX) is turned by the compiler into:

Code:
if (XXXXXX) then
  @valid = 1
  done
  endif
 
Many thanks!

I thought the cTotalLev was the character level which is why I didn't use it. My bad. :)

This code gives me an "invalid use of a reserved word in script" :
Code:
foreach pick in hero from Class where "Custom.Manifest"
  validif (field[cTotalLev].value >= 3)
  notify "Class Level: " & each.field[cTotalLev].value
  nexteach

It appears to be linked to the cTotalLev word. If I change it to:
Code:
foreach pick in hero from Class where "Custom.Manifest"
  ~validif (field[cTotalLev].value >= 3)
  notify "Class Level: " & each.field[cTotalLev].value
  if (field[cTotalLev].value >= 3) then
     @valid = 1
     done
  endif
  nexteach

I get the error on line 4. If I change it to:
Code:
foreach pick in hero from Class where "Custom.Manifest"
  validif (each.field[cTotalLev].value >= 3)
  notify "Class Level: " & each.field[cTotalLev].value
   nexteach

I don't get any errors on compile, but if I check the feat with a Psion 3, it still shows as requiring the Manifester 3+. I change it to this:
Code:
foreach pick in hero from Class where "Custom.Manifest"
  validif (eachpick.field[cTotalLev].value >= 3)
  notify "Class Level: " & each.field[cTotalLev].value
   nexteach

I get the same results. no errors, but no popup for the notify either. I try:
Code:
foreach pick in hero from BaseClass where "Custom.Manifest"
  validif (eachpick.field[cTotalLev].value >= 3)
  notify "Class Level: " & each.field[cTotalLev].value
   nexteach

And I get a popup with 'Attempt to access field 'cTotalLev' that does not exist for thing 'cPUPsion' as well as 'Class Level: 0' message from the notify. cTotalLev is part of cHelpPsi (Psion Class helper), right?

What is the difference between using Class and BaseClass?
 
BaseClass is the Class Level. Class is the Class Helper. That's why #5 isn't working - it's looking at the class levels.

Is this in a prereq or an evalrule?

In your tries #1 and #2, since there's no eachpick, you're testing the context of the script - that's the hero - and that doesn't have a cTotalLev field, so that's why #s 1 and 2 are failing.

#3 and #4 ought to work - I can't figure out why they don't

give me these results, if you will, please:

Code:
debug "a"
foreach pick in hero from Class where "Custom.Manifester"
  debug eachpick.field[name].text
  debug eachpick.field[cTotalLev].value
  if (eachpick.field[cTotalLev].value >= 3) then
    @valid = 1
    endif
  nexteach
debug "b"
You can see the debug results in the Develop menu - first make sure the first option, "Enable Data File Debugging" is checked, then go to the bottom, to "Floating Info Windows", and "Show Debug Output".
 
Mathias,

Thank you very much for your help with this. :)

This is in a prereq on the feat. I've got the class helper forwarding Hero.Psionic tag and it has the Custom.Manifest tag on itself.

Here's the result from the debug:
Code:
**********  Start Evaluation Cycle  **********

a
b
a
b
a
b

I added a level of my Psion and went to the Feat tab. There, I went to add a feat, and when I scrolled down, my Craft Cognizance Crystal feat was showing as needing manifester level 3. I added two more levels and went back to the feat with the same result:
Code:
**********  Start Evaluation Cycle  **********

a
b
a
b
a
b

**********  Start Evaluation Cycle  **********

a
b
a
b
a
b

I've also attached the files I'm using.
 

Attachments

Okay, so its not finding the class. Let's find out why.

Try out:

Code:
debug "a"
foreach pick in hero from Class
  debug eachpick.field[name].text
  debug eachpick.tagids[Custom.?]
  nexteach
 
Ok, I thought there would be something missing, but it does seem to be catching the class and the tags...

Code:
**********  Start Evaluation Cycle  **********

a
Psion
Custom.Psionic,Custom.Manifest
a
Psion
Custom.Psionic,Custom.Manifest
a
Psion
Custom.Psionic,Custom.Manifest

But, this does work:
Code:
debug "a"
foreach pick in hero from Class
  debug eachpick.field[name].text
  debug eachpick.tagids[Custom.?]
  debug eachpick.field[cTotalLev].text
  if (eachpick.field[cTotalLev].value >= 3) then
    @valid = 1
    debug "b"
  endif
  nexteach
Code:
**********  Start Evaluation Cycle  **********

a
Psion
Custom.Psionic,Custom.Manifest
2
a
Psion
Custom.Psionic,Custom.Manifest
2
a
Psion
Custom.Psionic,Custom.Manifest
2

**********  Start Evaluation Cycle  **********

a
Psion
Custom.Psionic,Custom.Manifest
3
b
a
Psion
Custom.Psionic,Custom.Manifest
3
b
a
Psion
Custom.Psionic,Custom.Manifest
3
b

If I do this:
Code:
debug "a"
foreach pick in hero from Class where "Custom.Manifest"
  debug eachpick.field[name].text
  debug eachpick.tagids[Custom.?]
  debug eachpick.field[cTotalLev].text
  if (eachpick.field[cTotalLev].value >= 3) then
    @valid = 1
    debug "b"
  endif
  nexteach
I get this:
Code:
**********  Start Evaluation Cycle  **********

a
a
a

It seems there's something with the where "Custom.Manifest" bit of the check..

thoughts?
 
Well, I got it working. :)

Instead of using "Custom.Manifest" i used tagids[Custom.Manifest]:
Code:
debug "a"
foreach pick in hero from Class where tagids[Custom.Manifest]
  debug eachpick.field[name].text
  debug eachpick.tagids[Custom.?]
  debug eachpick.field[cTotalLev].text
  if (eachpick.field[cTotalLev].value >= 3) then
    @valid = 1
    debug "b"
  endif
  nexteach
And this is the result:
Code:
**********  Start Evaluation Cycle  **********

a
Psion
Custom.Psionic,Custom.Manifest
3
b
a
Psion
Custom.Psionic,Custom.Manifest
3
b
a
Psion
Custom.Psionic,Custom.Manifest
3
b

I guess it needs the specific callout to the tagids?
 
Back
Top