Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - D&D 5th Edition SRD


Thread Tools Display Modes
Junior Member
Join Date: Oct 2022
Posts: 1

Old October 25th, 2022, 07:48 AM
I'm attempting to create a Class Special for a homebrew class that allows the user to select 2 out of 4 spells on a fighter-type class that they'll be able to use.

While attempting to create the Eval Rule script to check that the user hasn't selected the same spell twice, I kept coming up against a syntax error that seems to be in error itself.

According to Mathias in another thread, I should legitimately be able to have multiple conditionals for my validif statement while using a tagexpr[]
Originally Posted by Mathias View Post
No, you can't combine them like you wanted to (unless you can write things as a tagexpr[] inside a single if () then, since a tagexpr can handle more complex logic).
This was my Eval Rule script:

    validif (field[usrChosen1].ischosen + field[usrChosen2].ischosen < 2)
~ Check for duplicate selection
    validif (tagexpr[count:Kami.spAugury < 2 & count:Kami.spDeteEvil < 2 & count:Kami.spSpeaDead < 2 & count:Kami.spSpeaPlan < 2])

Which would produce the following error while testing/compiling:

PHP Code:
Hero Lab was forced to stop compilation after the following errors were detected:

Syntax error in 'evalrule' script for Thing 'cSamCWWotK' (Eval Rule '#1'on line 3
-> Error parsing left-side expression in relational comparison 
Switching out validif for an if/then produced the same exact error.

When I tried this variation:

    validif (field[usrChosen1].ischosen + field[usrChosen2].ischosen < 2)
~ Check for duplicate selection
    validif (tagexpr[tagcount[Kami.spAugury] < 2 & tagcount[Kami.spDeteEvil] < 2 & tagcount[Kami.spSpeaDead] < 2 & tagcount[Kami.spSpeaPlan] < 2])
I received this error instead:

PHP Code:
Hero Lab was forced to stop compilation after the following errors were detected:

Syntax error in 'evalrule' script for Thing 'cSamCWWotK' (Eval Rule '#1'on line 3
-> Invalid tag template specified'tagcount[Kami.spAugury]' 
The only way I was able to get it to work and function properly was with this (which seemed like a lot more work):

    validif (field[usrChosen1].ischosen + field[usrChosen2].ischosen < 2)
~ Check for duplicate spell selection
    if (tagcount[Kami.spAugury] >= 2) then
       @valid = 0
    elseif (tagcount[Kami.spDeteEvil] >= 2) then
       @valid = 0
    elseif (tagcount[Kami.spSpeaDead] >= 2) then
       @valid = 0
    elseif (tagcount[Kami.spSpeaPlan] >= 2) then
       @valid = 0
       @valid = 1
I'm exceptionally new to coding in HL, so I don't know if I wrote the script wrong the first couple of ways, but from everything I was digging up it *should* have worked? Just wondering if there is a more elegant way to have coded that, and/or if this is a syntax bug with the editor/compiler that it won't parse the tagexpr[] statement properly?

As an additional (related) matter - am I correct in that there is no way to place a bootstrap conditional on the spells so only the 2 that the user has selected will show? From what I've been reading, the conditionals get checked way before my custom tags would be assigned from the user selections of the spells. If anyone can think of a magical answer to make this work, I'd appreciate being pointed in the right direction
Gamefrog is offline   #1 Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -8. The time now is 06:04 AM.

Powered by vBulletin® - Copyright ©2000 - 2023, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.