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

"Conditional Statements (Math Only)" Bug (looking for Finesse Macro)

1532647892

Edited 1532649183
I'm trying to remember how to correctly use conditional statements, because I'm trying to remember how to create a Finesse Macro (OGL 5e Sheet, not that it's very relevant), but, here is what I have so far: &{template:default} {{name=Finesse}} {{Strength=[[{ {@{strength_mod},@{strength_mod}}>@{dexterity_mod}}*(0.5)]]}} {{Dexterity=[[{ {@{dexterity_mod},@{dexterity_mod}}>@{strength_mod}}*(0.5)]]}} Translated: &{template:default} {{name=Finesse}} {{Strength=[[{ {-2,-2}>3}*(0.5)]]}} {{Dexterity=[[{ {3,3}>-2}*(0.5)]]}} You will notice that they are identical, save being transposed. I honestly have no idea where I was running with this macro, but, here's the base values: @{dexterity_mod} = 3 @{strength_mod} = -2 Normally, this should not create an Error, as shown here: &{template:default} {{name=Finesse}} {{Strength=[[{ {@{strength_mod},@{strength_mod}}>@{dexterity_mod}}*(0.5)]]}} {{Dexterity=[[{ {@{dexterity_mod},@{dexterity_mod}}>0}*(0.5)]]}} Translated: &{template:default} {{name=Finesse}} {{Strength=[[{ {-2,-2}>3}*(0.5)]]}} {{Dexterity=[[{ {3,3}>0}*(0.5)]]}} THAT works, and the ONLY thing I changed was the comparison to the Str Mod of -2 into a flat 0. Apparently you are unable to compare against anything that parses as the following: ( - which means that not only am I unable to compare against -2, but I am unable to compare against (-2) Could someone report this oversight to the Roll20 Dev Team so they can fix it Could someone help me figure out a Macro for Finesse? I figured it out: &{template:default} {{name=Finesse}} {{Finesse=[[{@{strength_mod},@{dexterity_mod}}kh1]]}} {{Strength=[[floor((@{strength} -10) /2)]]}} {{Dexterity=[[floor((@{dexterity} -10) /2)]]}} there's still that Bug tho. I've really gone to some extensive lengths to try getting it to work, including the @{prefix} Attribute trick (assign an Attribute to "@{") amongst other similar tricks within that vein of thought. The Macro is fine until you try to compare against a negative number. Placing a number in front of it fails to work, as the second number is then not used for comparison..
Try putting a 0 in front. If it is a positive number it will result in 03 which equals 3, and if it is a negative number it will result in 0-2 and be a number rather than a string as you have noticed. It's also good for checking if there was no value specified at all. (Though that application is not needed in your case.) I'm still a little confused as to what you are expecting to do with this macro? Are you just wanting to know which is higher between DEX and STR, or what?.
1532656342
GiGs
Pro
Sheet Author
API Scripter
I dont know what you're trying to do with the macros in the first part of the post, so I cant answer that. Your final finesse macro is:  &{template:default} {{name=Finesse}} {{Finesse=[[{@{strength_mod},@{dexterity_mod}}kh1]]}} {{Strength=[[floor((@{strength} -10) /2)]]}} {{Dexterity=[[floor((@{dexterity} -10) /2)]]}} The Strength and Dexterity calculations are puzzling to me. Wont they be the same as the @(strength_mod} and @{dexterity_mod} in the {{Finesse}} section? If they are already calculated, why not just use {{Strength=@{strength_mod} }} there?
Kyle G. said: Try putting a 0 in front. If it is a positive number it will result in 03 which equals 3, and if it is a negative number it will result in 0-2 and be a number rather than a string as you have noticed. It's also good for checking if there was no value specified at all. (Though that application is not needed in your case.) I actually already tried that, it parses "0-3" as "0" result "-3", read over the tooltip of that output, the negative number is still there when the 0 is vanished on the output of the equation, while just "3" parses as "3" result "" (that's not a typo, it eats the value you are comparing to, it's literally nothing), so, it's legit something behaving as it should not. G G said: I don't know what you're trying to do with the macros in the first part of the post, so I cant answer that. Your final finesse macro is:  &{template:default} {{name=Finesse}} {{Finesse=[[{@{strength_mod},@{dexterity_mod}}kh1]]}} {{Strength=[[floor((@{strength} -10) /2)]]}} {{Dexterity=[[floor((@{dexterity} -10) /2)]]}} The Strength and Dexterity calculations are puzzling to me. Wont they be the same as the @(strength_mod} and @{dexterity_mod} in the {{Finesse}} section? If they are already calculated, why not just use {{Strength=@{strength_mod} }} there? There's multiple reasons for having that bit on the end the way it is. For example, a Sheet Update (however unlikely) breaks the "_mod" suffix? already have Plan B prepared. Also, it is useful for reminding myself what kind of build a Character has (useful knowledge to a GM for building encounters), it's also able to be used on any 5e Sheet as they all support the longhand method, even the Community Sheet (which by default lacks the "_mod" suffix Call) but, it is ultimately optional though, as the specific key part for use is the part immediately after "Finesse=" whilst the rest just makes it a glorified Finesse Check (it's in a Template specifically to make it look pretty, it's using the &{template:default} for Cross-Sheet Beautification Compatibility) The Longhand of just the Finesse Check would be simply: [[{floor((@{strength} -10) /2),floor((@{dexterity} -10) /2)}kh1]] I know that works on bare minimum of Community & OGL both (that's half the Sheets for 5e already!) As for what I was doing with the Macros in the first part of the Post, I was demonstrating a Bug that I had uncovered, so that it was reproducible, so that it could be addressed, & subsequently fixed.
1532659033
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Blue64 said: I'm trying to remember how to correctly use conditional statements, because I'm trying to remember how to create a Finesse Macro (OGL 5e Sheet, not that it's very relevant), but, here is what I have so far: &{template:default} {{name=Finesse}} {{Strength=[[{ {@{strength_mod},@{strength_mod}}>@{dexterity_mod}}*(0.5)]]}} {{Dexterity=[[{ {@{dexterity_mod},@{dexterity_mod}}>@{strength_mod}}*(0.5)]]}} Translated: &{template:default} {{name=Finesse}} {{Strength=[[{ {-2,-2}>3}*(0.5)]]}} {{Dexterity=[[{ {3,3}>-2}*(0.5)]]}} You will notice that they are identical, save being transposed. I honestly have no idea where I was running with this macro, but, here's the base values: @{dexterity_mod} = 3 @{strength_mod} = -2 The "bug" here (also, you very much buried the lead that you were reporting a bug) is actually an improper syntax: { {@{strength_mod},@{strength_mod}}>@{dexterity_mod}} This would do literally nothing as there is nothing to group, so then when you multiply it by 0.5, it looks for some sort of grouping thing, but finds nothing to group. I'm actually kind of surprised you didn't get a chat error message along the lines of "yada yada yada expected, but something something found". The correct way to write what I assume you were trying for here is this: ( {@{strength_mod},@{strength_mod}}>@{dexterity_mod} )
I did get that when it reached the - or ( however, the correct syntax was used, as I was practically copy/pasting from the Wiki 3 characters at a time, switching back & forth. it doesn't like ( {@{strength_mod},@{strength_mod}}>@{dexterity_mod} ) it actually wanted (I tried) { {@{strength_mod},@{strength_mod}}>@{dexterity_mod} }
1532691426
GiGs
Pro
Sheet Author
API Scripter
Blue64 said: G G said: I don't know what you're trying to do with the macros in the first part of the post, so I cant answer that. Your final finesse macro is:  &{template:default} {{name=Finesse}} {{Finesse=[[{@{strength_mod},@{dexterity_mod}}kh1]]}} {{Strength=[[floor((@{strength} -10) /2)]]}} {{Dexterity=[[floor((@{dexterity} -10) /2)]]}} The Strength and Dexterity calculations are puzzling to me. Wont they be the same as the @(strength_mod} and @{dexterity_mod} in the {{Finesse}} section? If they are already calculated, why not just use {{Strength=@{strength_mod} }} there? There's multiple reasons for having that bit on the end the way it is. For example, a Sheet Update (however unlikely) breaks the "_mod" suffix? already have Plan B prepared. Also, it is useful for reminding myself what kind of build a Character has (useful knowledge to a GM for building encounters), it's also able to be used on any 5e Sheet as they all support the longhand method, even the Community Sheet (which by default lacks the "_mod" suffix Call) but, it is ultimately optional though, as the specific key part for use is the part immediately after "Finesse=" whilst the rest just makes it a glorified Finesse Check (it's in a Template specifically to make it look pretty, it's using the &{template:default} for Cross-Sheet Beautification Compatibility) This is weird logic to me, for a couple of reasons: Why would a sheet update break the _mod stats? If an update did break those stats, you are using them in a different part of the macro, so your macro will break anyway.  Likewise saying it is able to be used in versions of the sheet which dont have _mod stats doesnt make sense, because you use the _mod stats in the macro. It's no big deal, I was just scratching my head in confusion about why you'd mix the two methods in the macro. But some of your phrasing (referring to the _mod Call) does make me wonder if we are on the same page about what the strength_mod stats are. Strength_mod and dexterity_mod are just attributes, just like strength and dexterity. They aren't qualities of an attribute, like _current and _max.
1532978282

Edited 1532978395
G G said: This is weird logic to me, for a couple of reasons: Why would a sheet update break the _mod stats? If an update did break those stats, you are using them in a different part of the macro, so your macro will break anyway. Likewise saying it is able to be used in versions of the sheet which don't have _mod stats doesn't make sense, because you use the _mod stats in the macro. It's no big deal, I was just scratching my head in confusion about why you'd mix the two methods in the macro. But some of your phrasing (referring to the _mod Call) does make me wonder if we are on the same page about what the strength_mod stats are. strength_mod and dexterity_mod are just attributes, just like strength & dexterity . They aren't qualities of an attribute, like _current & _max . it's very usable because the last half of the Script does the Longhand version of the _mod variable, so all they would need is to Copy/Paste from within the Script it's self, making it look something like this: &{template:default} {{name=Finesse}} {{Finesse=[[{[[floor((@{strength} -10) /2)]],[[floor((@{dexterity} -10) /2)]]}kh1]]}} {{Strength=[[floor((@{strength} -10) /2)]]}} {{Dexterity=[[floor((@{dexterity} -10) /2)]]}} as for how/why a Sheet might break one of it's own commands, there's various ways this is possible: Dev Codes whilst half asleep Lightning Strike on the Storage Servers (Damaged Hardware) Corrupted Data on the Storage Servers (Damaged Software) Lost in Translation (something didn't copy correctly between the Dev & Roll20) New Sheet Format (which you'll recall OGL sheet recently went through within the last year) just off the top of my head, there might be even more methods. if you want the exclusively _mod version: &{template:default} {{name=Finesse}} {{Finesse=[[{@{strength_mod},@{dexterity_mod}}kh1]]}} {{Strength=[[@{strength_mod}]]}} {{Dexterity=[[@{dexterity_mod}]]}} primarily it was so even new players to 5e (I've met 2 just this week already) could comprehend what was supposed to be going on, it was to allow a multiple view perspective to what numbers were coming from where & why. This Macro is also a good alternative to some Sheet's methods for Finesse, as some Sheets remove none of their extra Math to enforce it to work from within the framework (Example Given: Community Sheet), whereas other Sheets oversimplify the results & offer no explanation of what exactly is going on (EG: OGL).