News:

Welcome to the Herolab 4e user added support site.

Main Menu

Combined WHERE clauses

Started by MagicSN, December 23, 2012, 08:59:32 AM

Previous topic - Next topic

MagicSN

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.

Cryptoknight

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.

MagicSN

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.

Cryptoknight

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


MagicSN

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 ;-)

Cryptoknight

Well I don't know the path to get at the data, but that's the basic syntax :)

MagicSN

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

Cryptoknight

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.

MagicSN

Did not work either. Okay, I will post it to the official forum.