snupy
June 21st, 2026, 11:08
TL;DR: the title
I am referring to PFRPG as that is the only system I use, but things should apply more generally.
Looking at the wiki, the only mathematical operations allowed when writing effects seem to be, for PC tags only,
H[other tag]: Half of the other tag bonus
X[other tag]: Multiply other tag by X where X is 2-9
X [other tag]: Adds an arbitrary number X to other tag. Works only in effects which supports a number as bonus type. Beware the space between the X and [other tag].
-[other tag]: Negative the other tag bonus (including half and double)
Btw I imagine H rounds down? It would be useful to specify the rounding in the wiki.
This may seem plenty, but in fact it does not cover all the needs. The main thing missing is (integer) division by a number other than 2. In fact one of Kel’s extensions (currently not compatible and unlisted) adds a way to do that. Furthermore, the syntax is a bit weird.
Rather than making add hoc additions, it may be useful to add a general way to support mathematical operations between tags. Looking at the documentation, LUA natively supports a number of mathematical operations, although exactly what depends on which Lua version is being used.
Would it be possible to add, while maintaining the tags above, the possibility to pass a string directly to LUA for mathematical operations?
Something like
ATK: LUA_MATH(math.floor(LVL/3)+2*STR )
for an effect which gives an attack bonus equal to level divided by 3 (rounded down) + twice the strength bonus.
Here LUA_MATH() is the function to process a string in LUA and return the result I am advocating for. It would need to recognise current tags such as LVL, STR as variables with the appropriate value. From quick googling, math.floor is the LUA function for floor of a floating number. Depending on LUA version it may be possible to treat numbers as integers directly.
Yes, the example above is artificial but
- Current tags/effects operations do not cover all the ruleset use cases, at least for 3.5/PFRPG
- Homebrewing may expand a user needs beyond what the ruleset calls for
- Calling LUA for mathematical functions would vastly expand the possible uses, presumably to everything any use may ever need, without introducing much new code (I think?), while also allowing for a more natural and readable syntax for math operations.
- It would maintain backward compatibility, and the added functionality would be fairly isolated (I think) from other code
Failing all that, can we have integer division of tags, pretty please?
I am referring to PFRPG as that is the only system I use, but things should apply more generally.
Looking at the wiki, the only mathematical operations allowed when writing effects seem to be, for PC tags only,
H[other tag]: Half of the other tag bonus
X[other tag]: Multiply other tag by X where X is 2-9
X [other tag]: Adds an arbitrary number X to other tag. Works only in effects which supports a number as bonus type. Beware the space between the X and [other tag].
-[other tag]: Negative the other tag bonus (including half and double)
Btw I imagine H rounds down? It would be useful to specify the rounding in the wiki.
This may seem plenty, but in fact it does not cover all the needs. The main thing missing is (integer) division by a number other than 2. In fact one of Kel’s extensions (currently not compatible and unlisted) adds a way to do that. Furthermore, the syntax is a bit weird.
Rather than making add hoc additions, it may be useful to add a general way to support mathematical operations between tags. Looking at the documentation, LUA natively supports a number of mathematical operations, although exactly what depends on which Lua version is being used.
Would it be possible to add, while maintaining the tags above, the possibility to pass a string directly to LUA for mathematical operations?
Something like
ATK: LUA_MATH(math.floor(LVL/3)+2*STR )
for an effect which gives an attack bonus equal to level divided by 3 (rounded down) + twice the strength bonus.
Here LUA_MATH() is the function to process a string in LUA and return the result I am advocating for. It would need to recognise current tags such as LVL, STR as variables with the appropriate value. From quick googling, math.floor is the LUA function for floor of a floating number. Depending on LUA version it may be possible to treat numbers as integers directly.
Yes, the example above is artificial but
- Current tags/effects operations do not cover all the ruleset use cases, at least for 3.5/PFRPG
- Homebrewing may expand a user needs beyond what the ruleset calls for
- Calling LUA for mathematical functions would vastly expand the possible uses, presumably to everything any use may ever need, without introducing much new code (I think?), while also allowing for a more natural and readable syntax for math operations.
- It would maintain backward compatibility, and the added functionality would be fairly isolated (I think) from other code
Failing all that, can we have integer division of tags, pretty please?