Try this out: !ammo @{Akry|character_id} weapon1damagestat [[ -1 * @{Akry|weapon1damagestat} + {@{Akry|weapon1damagestat} + d0}=@{Akry|str-mod} * @{Akry|dex-mod} + {@{Akry|weapon1damagestat} + d0}=@{Akry|dex-mod} * @{Akry|str-mod} * (1 - {@{Akry|str-mod} - @{Akry|dex-mod} + d0}=0) ]] If @{weapon1damagestat} = @{str-mod}, sets weapon1damagestat equal to @{dex-mod}. Else, if @{weapon1damagestat} = @{dex-mod}, sets weapon1damagestat equal to @{str-mod}. Else, if @{weapon1damagestat} = @{str-mod} = @{dex-mod}, sets weapon1damagestat equal to @{dex-mod}. Else, (if @{weapon1damagestat} ≠ @{str-mod} and @{weapon1damagestat} ≠ @{dex-mod}), sets weapon1damagestat to 0 (if you'd like, this behaviour could be altered with the insertion of a bit more code, e.g. such that weapon1damagestat does not get changed in this case).