Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

[5E OGL] Macro that applies one of two (or more) modifiers.

So I noticed a problem* earlier with the macro: %{selected|NPC_athletics} If the npc doesn't have a specified athletics value it assumes zero rather than strength. After much looking I found a thread that seemed to exactly address my concern: <a href="https://app.roll20.net/forum/post/3103448/slug%7D" rel="nofollow">https://app.roll20.net/forum/post/3103448/slug%7D</a> and the macro: %{selected|athletics} which at a glance seemed to fix the problem, until I tested a little more. Whether or not the NPC has a specified athletics value, this simply assumes str. (While academically it would be nice to figure that out in some universal sense, I only actually care about it as an NPC mechanic, the players can fend for themselves). Now it is possible these are both working as intended, but I have hard time seeing how. Ultimately I think one of them working as expected (by me admittedly, which is to say it uses str unless a specified athletics value exists) would solve my problem but I am curious how to craft these types of macros anyway. So I might as well ask for that as well. I would like to know how to craft a macro that would allow me to use of several values based on a basic criteria (most likely highest or lowest), based on a pathfinder sheet macro I tried: Athletics:{Selected|[[ 1d20 +({@{npc_str_mod} , @{npc_athletics} }kh1) ]]} Which does doesn't even pretend to work (including a wide variety of more or less curly braces, NPCD vs NPC etc., it was a longshot, I have no skill at this beyond parroting. The original macro [[ 1d8 + ( { 5 , @{Level} }kl1) ]] found here ( <a href="https://wiki.roll20.net/Macros/Pathfinder_Examples" rel="nofollow">https://wiki.roll20.net/Macros/Pathfinder_Examples</a>... )appears to not work on it's own (even if I create a level attribute, or change level to some attribute name I copy and paste from the character sheet), so there is that. The alternate solution I could see would be to add the npc_athletics_flag to the athletics or str check. But I am not even sure how you would go about doing that (or if I am interpreting those fields correctly). Ideally I would be able to adapt the answer to saving throw macros and perhaps other things.
1480622333

Edited 1480622828
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Hmm, that would seem to be the preferred functionality. I've linked to this post in the OGL thread. I've tried several different permutations of keep highest syntax without success. All the macro tricks I can think of to handle this (even though half of them don't do what is needed) require you to enter something in each skill field. If you're doing that anyways, you might as well enter in the relevant ability scores yourself and negate the need for fancy macro mathemagicks in the first place. Here's hoping Steve updates the sheet to improve these skill rolls. EDIT: While I can't find the attribute for the various ability mods on the npc, your example: Athletics:{Selected|[[ 1d20 +({@{npc_str_mod} , @{npc_athletics} }kh1) ]]} just needs some syntax adjustment to work, and calling the correct attribute for the ability mod: @{npc d _str_mod}: Athletics:[[ 1d20 +[[{[[@{selected|npc d _str_mod}]] , @{selected|npc_athletics} }kh1[ABILITY/SKILL]]] ]] would be the proper syntax. See the&nbsp; wiki for more details.
Thank you for the formatting help, and for boosting the signal, I am getting the impression that I may not be able to fix this one, but that the developers presumably could. &nbsp; &nbsp; It still doesn't quite work sadly (though I think you already knew that). &nbsp;If I use this macro on a token representing a character with a defined athletics value it works fine, and if I use it on one without it does nothing (not even an error message) &nbsp;If after changing npc_athletics to npcd_athletics, and I enter a zero in the npcd_athletics field on the sheet it works. &nbsp;Given that the original macro&nbsp;%{selected|NPC_athletics} assumes a zero when the field is blank it seems odd that this variant doesn't do the same. &nbsp; Would there be a way to take this&nbsp; Athletics:[[ 1d20 +[[{[[@{selected|npc d _str_mod}]] , @{selected|npcd_athletics} }kh1[ABILITY/SKILL]]] ]] and throw an else 0 into the npcd_athletics half of the k1? &nbsp;Would that improve the situation? &nbsp; &nbsp;
Charles B. said: Would there be a way to take this&nbsp; Athletics:[[ 1d20 +[[{[[@{selected|npc d _str_mod}]] , @{selected|npcd_athletics} }kh1[ABILITY/SKILL]]] ]] and throw an else 0 into the npcd_athletics half of the k1? &nbsp;Would that improve the situation? &nbsp; &nbsp; Yeah; replace @{selected|npcd_athletics} with 0@{selected|npcd_athletics}
1480633239
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Silvyre said: Charles B. said: Would there be a way to take this&nbsp; Athletics:[[ 1d20 +[[{[[@{selected|npc d _str_mod}]] , @{selected|npcd_athletics} }kh1[ABILITY/SKILL]]] ]] and throw an else 0 into the npcd_athletics half of the k1? &nbsp;Would that improve the situation? &nbsp; &nbsp; Yeah; replace @{selected|npcd_athletics} with 0@{selected|npcd_athletics} Huh, would never have thought of that. My brain is having a hard time accepting that that works even though seeing should be believing.
Woot, that now totally works, exactly as I would want it to. &nbsp; Thank you both very much. &nbsp;(Not sure how many people ask this question, but since this appears to work perfectly, part of me thinks it should makes it way to one of those wiki macro pages ;-). &nbsp;That give me what I need to create NPC specific macros, which really covers everything I need as the GM.&nbsp; Now, because I can't leave well enough alone. . .&nbsp; This works for PC's without athletics, and all npc's, for PC's with athletics it simply returns str. &nbsp;Do we know what I would add to this to have an option to call whatever pc's use for athletics when trained? PC's who are trained appear to have athletics_prof (which like this (@{pb}*@{athletics_type}) ). &nbsp;
1480635354
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
PCs just have a bonus for each skill which already does this. Just hover over the number next to a skill to find the name.
[[@{selected|npc d _str_mod}]] , @{selected|npc_athletics} What is the reason behind the first value being in double brackets, and the second not? &nbsp;(Sorry now I am just picking your brains, but I couldn't find anything on the wiki that seemed like it would answer that question). &nbsp;
1480641866
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
The mod has a floor calculation in it. Using the nested inline roll keeps the tooltip cleaner.