• 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

Custom Expression conundrum

Redcap's Corner

Well-known member
I've been using custom expressions to build lists of creatures of particular types and sizes using the following basic formula:

Code:
(HasType.tpMonHuman & (RaceSize.Small11 | RaceSize.Medium0))

Unfortunately, now I need that list of all creatures of a particular subtype and size. Unfortunately, it would seem subtypes are directly bootstrapped onto races, rather than being expressed through tags. So, is this possible?

I need to construct a custom expression that builds a list of Large-sized giants.
 
You might try nested foreaches. Not generally recommended because it can be expensive for the processer, but could work...

Something like:

Code:
var finalexpr as string
var tempstr as string

foreach thing in BaseRace where "HasType.tpMonHuman & (RaceSize.Small11 | RaceSize.Medium0)"
  tempstr = "Race." & eachthing.idstring

  ~ If our current iterated race has the correct subtype bootstrapped, then add the temporary string for this race to the final candidate expression
  foreach bootstrap in eachthing where "component.Subtype & thingid.stGiant"
    finalexpr = splice(finalexpr,tempstr, " | ")
    nexteach
  nexteach

field[usrCandid1].text = finalexpr
 
Last edited:
Back
Top