Hero Lab 4e

Herolab D&D 4e Development => Herolab 4e Development => Topic started by: MagicSN on December 23, 2012, 08:59:32 AM

Title: Combined WHERE clauses
Post by: MagicSN on December 23, 2012, 08:59:32 AM
When I have

      foreach pick in hero from Power where "PowerSrc.Arcane"
          perform eachpick.field[pwAtkFeat].modify[+,bonus,""]
        nexteach

and

      foreach pick in hero from WeaponBase where "WepGroup.wgHeavyBl"
          perform eachpick.field[pwAtkFeat].modify[+,bonus,""]
        nexteach

But I want a foreach which checks on BOTH conditions (and'ed) , how do I do this? Also the problem seems to be that part of the information is in the Powers, and part in the WeaponBase, how do I get around this problem?

Thanks.
Title: Re: Combined WHERE clauses
Post by: Cryptoknight on December 23, 2012, 04:50:32 PM
I believe the and operator is either & or &&

so you could do something like

foreach pick in hero from Power where "PowerSrc.Arcane && WepGroup.wgHeavyBl"
          perform eachpick.field[pwAtkFeat].modify[+,bonus,""]
        nexteach


But in this case I don't know if it would work.  There are no Powers that are in Weapon Groups.
Title: Re: Combined WHERE clauses
Post by: MagicSN on December 23, 2012, 08:37:04 PM
Yes, the problem is that one of the things comes from Power and one from WeaponBase, and I do not know how I could combine this, or if there is even a solution possible with this scripting language.
Title: Re: Combined WHERE clauses
Post by: Cryptoknight on December 23, 2012, 10:59:36 PM
Why not something like an IF statement inside the for each?

Foreach pick in hero from power where "PowerSrc.Arcane"
   IF pick.<don't know the tag>.WepGroup = wgHeavyB1"
       perform eachpick.field[pwAtkFeat].modify[+,bonus,""]
   endif
nexteach

Title: Re: Combined WHERE clauses
Post by: MagicSN on December 24, 2012, 09:50:43 AM
Quote from: Cryptoknight on December 23, 2012, 10:59:36 PM
Why not something like an IF statement inside the for each?

Foreach pick in hero from power where "PowerSrc.Arcane"
   IF pick.<don't know the tag>.WepGroup = wgHeavyB1"
       perform eachpick.field[pwAtkFeat].modify[+,bonus,""]
   endif
nexteach


Simple: I was unsure of the syntax to do this ;-)
Title: Re: Combined WHERE clauses
Post by: Cryptoknight on December 24, 2012, 03:16:31 PM
Well I don't know the path to get at the data, but that's the basic syntax :)
Title: Re: Combined WHERE clauses
Post by: MagicSN on December 26, 2012, 12:25:03 PM
Quote from: Cryptoknight on December 24, 2012, 03:16:31 PM
Well I don't know the path to get at the data, but that's the basic syntax :)

I tried this

      foreach pick in hero from Power where "PowerSrc.Arcane"
         if ("pick.WeaponBase.WepGroup = wgHeavyB1")
            perform eachpick.field[pwAtkFeat].modify[+,bonus,""]
         endif
      nexteach

but it said "Error parsing left-side expression in relational comparision". Any idea what is wrong? (I also
tried various placement of "" and () ).


Steffen
Title: Re: Combined WHERE clauses
Post by: Cryptoknight on December 26, 2012, 05:46:25 PM
Your if... I'd think


If(eachpick.WeaponBase.WepGroup="wgHeavyB1")


would be more syntactically correct, but I think this is a question for the Wolflair forums.
Title: Re: Combined WHERE clauses
Post by: MagicSN on December 27, 2012, 08:44:36 AM
Did not work either. Okay, I will post it to the official forum.