Multiple Operators within an Expression

How would I write this in IPP?
{If ({STRscore} < 10 && {STRscore} > 7) then STRmod = -1

I am not sure if that even makes sense or not. I am trying to check what an ability score is and then assign its proper modifier to it. If the number is greater than 7 and less than 10 then a -1 gets assigned to another variable for referencing later.


  • Yeah, so the thing is, IPP is really weak in the area of normal programming logic; nested conditionals can be used only in limited situations, and AND/OR logic is simply... absent. Once in a while I've found it a pain to deal with, but more often not I've realized I just needed to change my thinking to IPP-style.

    For example, in your case you want StrMod to be -1 if STR is 8-9. That's doable with multiple [when] clauses but it's pretty ugly, so I won't show it just now.

    I suspect instead what you're looking for is a sliding scale, with StrMod being higher or lower depending on STR. IPP can handle that quite elegantly:
    table: RollSTR
    {StrMod==[#{STR} StrModTable]}&
    STR = {STR}\n&
    Mod = {StrMod}
    table: StrModTable
    type: lookup
    3-4   :-3
    5-7   :-2
    8-9   :-1
    10-13 :0
    14-15 :1
    16-17 :2
    18    :3
  • Perfect! Too bad the plusminus filter does not filter plus as a literal text without using the ndn-n expression. I know it's silly but I prefer to see the plus symbol with my modifiers.

Leave a Comment