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

Noob Question: Dice Rolling Reference and IF in Macros

1528010368

Edited 1528010661
Already read the closed topic at&nbsp; <a href="https://app.roll20.net/forum/post/1269404/assign-d" rel="nofollow">https://app.roll20.net/forum/post/1269404/assign-d</a>... I'm confused, however. &nbsp;If these rolls are being monitored by the Quantum Engine (generator), wouldn't they have some type of ability to track the rolls? &nbsp;Maybe I'm overthinking it, or not considering what size a database that would require ... The reason I ask is because I wished the means of assigning inline labels to rolls that could be used to recall the result, as a roll query would, automatically. &nbsp;Instead, directly from a roll query, it will reroll the result every time. PROBLEM EXAMPLE: ?{HitEnter|[[1d20]]} That result showed 10 ?{HitEnter} Showed 14 ?{HitEnter} Showed 3 etc.... SUGGESTIONS OF USAGE: Example 1: /roll 2d10[dmg]+2d6[crit]+@{strength_mod} Your sword crashes into @{target|token_name}, gashing {?{dmg}+@{strength_mod}} damage to them, but finds even greater purchase, dealing an additional ?{crit} damage as the blade nearly cleaves them in twain! Example 2: /roll 1d20[atk]+@{strength_mod} You rolled a natural ?{atk} on the die In addition, there should be some comparative operators that refer to those rolls, in the form of "if{compare|true|false}" Example 1: /gmroll 1d20[atk] /em The shady orc attacks you, if{ ?{atk}&gt;@{target|AC}|and finds purchase doing [[2d8]] damage|but misses by a hair}
1528012012
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
This is a much desired feature, and there is likely a suggestion thread or six on it, but at this point, with only a very limited type of exception, only the API will grant you if/then capability. Someone better qualified can explain why, but the topic comes up every now and then.
keithcurtis said: This is a much desired feature, and there is likely a suggestion thread or six on it, but at this point, with only a very limited type of exception, only the API will grant you if/then capability. Someone better qualified can explain why, but the topic comes up every now and then. I'm wondering where I could find such an exception, maybe that is what I need. &nbsp;Or an API that allows me to use the If/Then as a regular conditional in macros, or assigning Die rolls a referenceable variable.
1528043690
vÍnce
Pro
Sheet Author
if/then logic is not included with the macros.&nbsp; There are&nbsp; roll helpers available to roll templates, but they must be written into a sheet's html. That's how certain roll templates will only show crit confirm and crit damage if the attack roll is =&gt; the crit threshold.&nbsp; You might have this availible already depending on your sheet. I'm fairly certain the&nbsp; PowerCards script (scripts are a Pro perk) can handle if/then comparisons for macros.
1528051522
GiGs
Pro
Sheet Author
API Scripter
Wolf Thunderspirit said: Already read the closed topic at&nbsp; <a href="https://app.roll20.net/forum/post/1269404/assign-d" rel="nofollow">https://app.roll20.net/forum/post/1269404/assign-d</a>... I'm confused, however. &nbsp;If these rolls are being monitored by the Quantum Engine (generator), wouldn't they have some type of ability to track the rolls? &nbsp;Maybe I'm overthinking it, or not considering what size a database that would require ... The thing you're missing here: the devs could add IF conditionals and variables to dice macros if they wanted to, but they don't want to. It's not because there's a technical limitation that makes it hard, it's not because of database size limits, it's because they just don't want to. We can speculate on reasons for this, from "wanting to keep the dice syntax simple and understandable" (lol, look at how convoluted we have to get to make so many dice rolls), and "wanting to segment features based on subscription level" (way more likely to me). But in the end, all that matters is, this is a really desired feature, and the devs have made clear by years of inactivity that they have no intention of implementing it.
1528056831
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Or there are technical or business model considerations of which we are unaware. Assuming the motivation of a third party is little more than speculation.
1528129545

Edited 1528129594
The limited exception is&nbsp; conditional statements making use of grouping and target numbers. It's poorly explained on the wiki, but the basic idea is to compare multiple numbers with a target number using grouping {} and target number syntax &lt; or &gt;, then multiply the number of successes by some formula to give the correct output values whether the target number is met or missed. A very simple version of this might be if I want to calculate 1d6 damage if I hit but 0 damage if I miss. I'm rolling a d20 and need 11 or greater to hit. /roll [[ 1d20&gt;11 ]] * [[ 1d6 ]] If I hit I'll output a die roll from 1 to 6. If I miss I'll output a 0. Of course, I can't output BOTH the attack roll and the damage; using the attack roll to calculate damage consumes it and it is no longer available for display. The wiki describes more complicated comparisons and more complex outputs. But always remember there is no way to both display a die roll and use it in another calculation. Using the die roll consumes it.
David that might be useful though. &nbsp;Let me see ... If I did something like this: [[1d20&gt;@{target|AC}]] That would generate either a hit or miss, yes? &nbsp;(Assuming that the target's AC was something that could be found, either a 0 [miss], or whatever number equals or is higher than that AC. [ AC is 15, rolled 16, range is 15-20, result 16 [hit]]) The trick then, would be in making that into a variable that remains static until changed my another roll to the same variable. &nbsp;I'm not a pro at coding, so I don't know the ins and outputs of this, so it's speculation, but let's experiment anyway. Is there a command that does a silent query, first of all? ' ?{ ... } ' will always generate a pop up to input something, unless that variable is already set and known, then it is silent on it's own. &nbsp;But is there a manner in which that pop up never seeks player validation, taking what it has generated? Say; for example, something like ' ??{ ... } ' ? In such a way, you could then, do ??{ HitMiss |&nbsp;[[1d20&gt;@{target|AC}]] }, Assigning the result to variable 'HitMiss' without prompting the user to validate it in any way, and also not re-initiate the roll. &nbsp;Then, {?{HitMiss}&lt;@{target|AC} ...................... ack! **Bangs Head on a wall** .... Still need an IF/ THEN statement to output "/em You missed!" ...... darn! .... And the silent query was also a speculative, nor do I know what the code can do independently. Thought I was onto something there ... guess not ... drat!
1528166850
vÍnce
Pro
Sheet Author
<a href="https://wiki.roll20.net/Script:PowerCards#Conditio" rel="nofollow">https://wiki.roll20.net/Script:PowerCards#Conditio</a>...
ahhhhhh ... so I'll have to see about that Vince, TY. &nbsp;I thought Powercards was for other than D&D 5e, now I see it works for all. &nbsp;Definitely gonna install and check it out ... I just hope that with so many API's running I don't bog down the game or anything ...
1528169229
Gen Kitty
Forum Champion
Just remember, there will be times where a player forgot a bonus or that they had advantage or had disadvantage or forgot that the bonus they used actually expired last round... and you need to be able to gracefully handle "The number I added to this roll was wrong so I got the wrong result" issues. :)
The trick then, would be in making that into a variable that remains static until changed my another roll to the same variable. Can't be done in a macro. There are no variables in macros, only roll queries. "Is there a command that does a silent query, first of all? No. Still need an IF/ THEN statement to output "/em You missed!" ...... darn! As was said, conditional rolls are limited. They only work with numbers, and each conditional roll only produces one number. To do the things you're trying to do, you need to use Javascript and create API scripts.