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

Question on a character sheet macro

1731734331

Edited 1731735727
I use character sheet macros in a system I designed and need some help. Specifically, I'm looking for advice from someone knowledgeable, like The Aaron, Keith Curtis, or anyone else who can assist. In my system, a d20 roll is generated against a calculated "attack to hit" number. For example, if you need a 10 to hit and roll a 15, you hit by 5. Dodging works with a lower is better mechanic, so if you have a 15 dodge and roll a 5, you dodged by 10. I'm designing a macro where the attack number is taken from the character sheet. For instance, if a character needs a 5 or better to hit with their longsword, the macro will check the weapon's base attack number from the character sheet. The macro will then ask for situational modifiers. I'm combining the defense roll in the same macro so that the character enters the number the DM gives them when asked. For example, I might tell the player that the goblin parries on an 8. My macro works, but there's an issue. I want the option of either DODGE or PARRY in the macro. Since parry is better with a lower base number and dodge is better with a higher base number, the formula for determining how much one succeeds or fails by is different for each. In the current macro, I have the defense roll defaulting to either 999 or -999, which is nonsensical. Is there a way to make the macro only roll either the parry or dodge number and not perform the d20 defense roll if the default number is left as 999 or -999? Here is the macro I use: /em makes an attack with @{WPN1} and hits or misses by [[1d20 + @{BaseMod} + @{Current_Pluses} + @{DexMod} + @{SkL_1} + @{WPQual_1} + @{SPBN_1} + ?{Situational modifier|0}]] // Calculate the difference between the d20 roll and the defender's parry number, display the result The defender succeeded or failed THE PARRY by [[(1d20) - ?{Enter the defender's modified parry number|999}]] // Calculate the difference for the dodge: Lower is better, so a lower d20 roll means success The defender succeeded or failed THE DODGE by [[?{Enter the defender's modified dodge number|-999} - 1d20]] Thanks for any help I can get!
1731735374
Gauss
Forum Champion
Hi Aramathis,  Sometimes what helps best is to explain the math  as if Roll20 did not exist. Step by step, in as simple language as possible.  Example:  You roll a d20, you add the bonuses.  Next, you subtract that value from the number needed to hit.  If that number is positive it is either a dodge or a parry.  If the number is closer to zero it is a dodge, if it is farther from zero it is a parry.  Note: I don't know that this is how it actually works. That is where I (and anyone else who will help) will need a concrete step by step example with numbers. 
Hey Gauss, I think what I'm trying to achieve is called a conditional statement. I want the macro to only roll for either the parry or the dodge if a number is entered, and to ignore it if left blank. I'm not sure if this is possible, but I appreciate your response! 
1731742622

Edited 1731742703
Gauss
Forum Champion
Aramathis said: Hey Gauss, I think what I'm trying to achieve is called a conditional statement. I want the macro to only roll for either the parry or the dodge if a number is entered, and to ignore it if left blank. I'm not sure if this is possible, but I appreciate your response!  Yes, I know what it is called. :) But to write your macro I need to know exactly the process you are using. So I need the example. Please provide it using my example of the example as a template. 
Can't you do this with just a nested query? The defender succeeded or failed THE ?{dodge or parry|parry,PARRY by [[1d20-?{enter the defender's modified parry number}]]|dodge,DODGE by [[?{wnter the defender's modified dodge number}-1d20]]}
1731764386

Edited 1731766028
But since we're talking conditionals, here's a fun roll expression: [[([[1d20]]-abs(?{num|0}))*(?{num}/abs(?{num}))]] $[[0]] If the input is 0, the line is invalid, and is not shown (but any other complete lines in the macro are, as long as they're parsed separately). If the input is positive, it rolls 1d20-X, and if the input is negative, it rolls 1d20-abs(X))*-1, which is equal to (positive) input -1d20. So in effect, in one query, and one output, you can get either kind of calculation. The $[[0]] at the end is there just to show the d20 roll.
1731765813

Edited 1731765889
Tuo, The first one: The defender succeeded or failed THE ?{dodge or parry|parry,PARRY by [[1d20-?{enter the defender's modified parry number}]]|dodge,DODGE by [[?{wnter the defender's modified dodge number}-1d20]]} works perfectly with one exception. With parry it is possible to have a lower then 0 parry like for example: parrying with a base -5, if you roll a 20 on the defense roll you parry by 25.  The macro does not seem to work with parry numbers below 0.  Fix that one issue and I am golden! 
Aramathis said: Tuo, The first one: The defender succeeded or failed THE ?{dodge or parry|parry,PARRY by [[1d20-?{enter the defender's modified parry number}]]|dodge,DODGE by [[?{wnter the defender's modified dodge number}-1d20]]} works perfectly with one exception. With parry it is possible to have a lower then 0 parry like for example: parrying with a base -5, if you roll a 20 on the defense roll you parry by 25.  The macro does not seem to work with parry numbers below 0.  Fix that one issue and I am golden!  Ah, yeah, that'll result in a double negative (--), and that halts the parser. You can get around that by moving the numbers around a little: The defender succeeded or failed THE ?{dodge or parry|parry,PARRY by [[(?{enter the defender's modified parry number}-1d20)*-1]]|dodge,DODGE by [[?{wnter the defender's modified dodge number}-1d20]]}
1731766809

Edited 1731767699
Tuo & Gauss, Thank you so much! When I started using Roll20 to GM my games—originally played as tabletop games—I had to teach myself whatever I could glean from others, as I had no background in this type of platform. I had designed my own game system, which I had been using for many years at the table, but transitioning it into Roll20 was a challenge since I had zero knowledge of the process or programing mechanics. Through many hours of trial and error, I managed to create my own character sheet and the accompanying sheet macros but I still do not possess a real understanding of the programing language I am using.  Thanks again! Ara