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

Roll range macro???

1713091563

Edited 1713092405
Cron
Pro
Trying to make a funny macro for my bard. Something like: 1d20@(>=6|[ ](image)(<=7-19|[ ] (image)(=20|[ ](image)+@pb+@pb+@charisma_mod The goal being on a roll of 1-6 it outputs roll +pb +mod and an image 7-19 outputs roll +pb +pb +mod a different image 20 outputs roll +pb +pb +mod another image. PB in there twice for expertise. Any help greatly appreciated.
1713113671

Edited 1713114797
Cron
Pro
&nbsp;[[1d20((&gt;6|[ ]( 7-19|["><a href="https://imgur.com/some.gif)(&gt;=7-19|[" rel="nofollow">https://imgur.com/some.gif)(&gt;=7-19|[</a> ]( <a href="https://imgur.com/someother.gif)(=20|[" rel="nofollow">https://imgur.com/someother.gif)(=20|[</a> ]( <a href="https://imgur.com/different.gif))+@{selected|PB}+@{selected|PB}+@{selected|charisma_mod}" rel="nofollow">https://imgur.com/different.gif))+@{selected|PB}+@{selected|PB}+@{selected|charisma_mod}</a> ]] Something like this but this returns 1
Thanks to brilliant suggestion over discord I found This post . Now I just need to figure out how you do number ranges. They way I was doing it before was completely impossible. &amp;{template:default} {{name=Performance}} {{[1](#)=You died.}}{{[3-6](#)=You did ok.}} {{[7-11](#)=You did well.}} {{[12-19](#)=You did really well.}}&nbsp; {{[20](#)=You did Epic.}} {{[[[ceil(1d100 / 25)]]](#)=}} $[[0]] 1 and 20 work, number ranges do not, now just need to find a way for group ranges to work. I can try to add in links and PB bonus/cha bonus once I get that figured out. Anyone have any ideas?
1713373427
Gauss
Forum Champion
Hi Cron,&nbsp; I suggest doing the number ranges in a brute force method.&nbsp; Example: {{[3](#)=You did ok.}}&nbsp; {{[4](#)=You did ok.}}&nbsp; {{[5](#)=You did ok.}}&nbsp; {{[6](#)=You did ok.}}
Yikes, it will make for a long macro but since you only see the result, that works. TYVM
Thought I had this figured out. I am trying to combine two scripts. This and This . &amp;{template:default} {{name=Overwrite rows}} {{ [[[1d1]]](#) =Original}} {{ [[[1d1]]](#) =Overwrite}} &amp; &amp;{template:default} {{name=Buff}} {{[img](<a href="https://not-real.fake.com/some-folder/[[[1d4]]].gif" rel="nofollow">https://not-real.fake.com/some-folder/[[[1d4]]].gif</a>)}} {{amount=$[[0]]}} The goal being on a roll of 1d20 it displays the # and the appropriate image, maybe a 2nd line showing number rolled plus + PB + PB + Cha_mod. That part is ez $[[0]] $[[1]] $[[2]] $[[3]] = $[[4]] I am only using 3 images, 1=fail image, 2-28-good image, and 29=Epic image, because that will only happen on a 20. How do I get only the line # that is rolled displayed. I made 29 lines to try suggestion and have a {{[1](#)=You died.}} {{[2](#)=You did ok.}} ~ {{[29](#)=You did Epically well.}} The Overwrite script displays each line above 1. So if I use a d4 in it I get 4 lines and the #rolled line is blank. The reverse of what I am trying to do. I thought I figured something out by labeling them like (1d1)(#)=, (2d1)(#)=, (3d1)(#)=, (4d1)(#)=. That didn't work, it just changed lines that appeared in chat from 1-4 to 1d1-4d1. Sadly I can't use tables or API as the Host of the game does not have Pro. The components are there I just can't figure out how to call a number. TYVM for any help.
1713396350
Gauss
Forum Champion
TBH, I am not entirely sure what you are trying to do here. My suggestion was a simple one to avoid the whole 'range of numbers' problem.
I would if I could but the whole thing depends on it and I am just not getting how to do the &gt;= parts I think. For example I am just using 1d4 roll, goal is 1d20, to make testing easier. First part of macro: &amp;{template:default} [[ [[1d4]] + [[+@{selected|PB}]] + [[+@{selected|PB}]] + [[+@{selected|charisma_mod}]]]] {{name=Performance}} {{Roll=$[[0]] + $[[1]] + $[[2]] + $[[3]] = $[[4]]}} This section works perfectly. Rolls dice, adds PB, adds PB, adds Charisma mod, and gives total. Second part of macro: (The Nightmare) For example I am using the 1d4 number as source. Goal is $[[4]] the total but that will take lots of lines so just testing with 4. This should compare number rolled to &gt;# and trigger another macro labeled 1, 2, 3, 4. Those macros are just loading a image. {{ $[[0]]&gt;1|(#1) $[[0]]&gt;2|(#2) $[[0]]&gt;3|(#3) $[[0]]&gt;4|(#4)}} This is what I am stumped on. I ether need another way to call for the rolled number other than $[[0]] or I am just not writing the process out correctly or I am just missing something, like how to use the comparative &gt;= correctly. I just want to show roll + bonus' = Total, then show a pic depending on #. Kind of like here .
1713403217

Edited 1713403370
Gauss
Forum Champion
You (generally) cannot put reused rolls in a calculation. (RainbowEncoder might be able to but that is god level understanding.) So, $[[0]] can be used to display a result, but it (generally) cannot be used to calculate something.&nbsp; With that said, there may be a way to do what you want by changing how things are calculated and then displayed. The problem is, I really don't understand what you are trying to do with " {{ $[[0]]&gt;1|(#1) $[[0]]&gt;2|(#2) $[[0]]&gt;3|(#3) $[[0]]&gt;4|(#4)}}" Near as I can figure, if number 0 is greater than 1, it displays macro #1? What is in macro #1?&nbsp; If you are trying to replicate this post then accessing another macro is not how they did that.&nbsp; They used a variable within the url to generate multiple url outputs, then pulled that variable out of the url and displayed it.&nbsp; If that is what you'd like to do I think it can be done and still display the numbers as you want them displayed.&nbsp; Note: except for 1d4. That will have to be factored in mentally, unless RainbowEncoder comes in with his magic.&nbsp; Here is an example of the calculation:&nbsp; (Note: I compressed it all, but it can be spread out into multiple outputs if you want that like you have above.) &amp;{template:default} {{name=Performance}} {{roll}} {{[img]( <a href="https://not-real.fake.com/some-folder/[[[[[[[1d20]]" rel="nofollow">https://not-real.fake.com/some-folder/[[[[[[[1d20]]</a> +@{selected|PB}*2 +@{selected|charisma_mod}]] -@{selected|PB}*2 -@{selected|charisma_mod}]]].gif)}} {{roll=$[[1]] + [[1d4]]}} That works like the post above, where it rolls a 1d20, while at the same time performing and displaying all of the calculation you need it to perform (other than the 1d4 which I assume is Bless?)
1713404965

Edited 1713405214
Cron
Pro
Yes $[[0]]&gt;1|(#1) as trying to, if roll 1 on 1d4, load Image that is in macro #1, was just [ ]( <a href="https://imgur.com/some.gif" rel="nofollow">https://imgur.com/some.gif</a> ). &amp;{template:default} {{name=Performance}} {{roll}} {{[img]( <a href="https://not-real.fake.com/some-folder/[[[[[[[1d20]]" rel="nofollow">https://not-real.fake.com/some-folder/[[[[[[[1d20]]</a> +@{selected|PB}*2 +@{selected|charisma_mod}]] -@{selected|PB}*2 -@{selected|charisma_mod}]]].gif)}} {{roll=$[[1]] + [[1d4]]}} That works like the post above, where it rolls a 1d20, while at the same time performing and displaying all of the calculation you need it to perform (other than the 1d4 which I assume is Bless?) 1d4 was just for testing. So I didn't have to use 1d20 + PB + PB + Mod = 29 images/macros lol The problem with using the roll # in the url string is finding a host that does not change images links when you upload. I have not been able to find one. So was trying to go about it another way. Using macro #.
&amp;{template:default} {{name=Performance}} {{roll}} {{#[[[[[[[1d20]] +@{selected|PB}*2 +@{selected|charisma_mod}]] -@{selected|PB}*2 -@{selected|charisma_mod}]]]}} {{roll=$[[1]]}} This gets me: So, I made some macros [1], [2], ~[20]. With [ ](imageurl/file.gif) in them. If I hit any of them the image loads. But the script is not triggering the macros. Is there a format I am missing? Thank you so much Gauss , its sooooooooo close to working lol If I can only find a host that does not change path/file name or get #macro to work lol
1713446889
timmaugh
Pro
API Scripter
You are running into a problem of the order of operations . You are trying to use the result of a roll to drive the selection of a macro... but macros resolve before inline rolls are processed. The same thing will be true of attributes or abilities, if you tried to go that route. What you are limited to, based on the OoO, is anything that comes after &nbsp;roll resolution, since that is what you're using for driving the conditional output. That's why the tricks you posted work -- HTML rendering happens later, so you can rely on the result of the roll. Driving the selection of a GIF file based on the roll result is part of the HTML rendering, as is overwriting a template part. So, you can do it with the roll being a part of the GIF retrieval (1 GIF for each possible result), but you would have to solve the issue of where you host the images where you have control over the naming of the URL. (If scripts become available, this is a fairly trivial problem to solve using free hosting like imgur.)
1713451818
Gauss
Forum Champion
Cron, to clarify something, what you and I have been discussing is not a script. It is a macro. What timmaugh is referencing as scripts are Mods (API Scripts) which require the game owner to have a Pro account.&nbsp;
I know, I use Pro for my game on Fridays, but sadly the Host of the game I play in on Saturdays does not have it. So its the hard way lol. Thank you Gauss you, been been a great help and timmaugh too for letting me know OoO only allows it to be done the link trick way. I found a host site Cloudinary. Made one cirt fail gif, 18 normal gifs, and one crit success gif. Labeled them [1].gif - [20].gif and macro now works perfect. I may change some of the gifs to change things up, but as much fun as it was, I am happy to just not bang my head against the wall for a few days till I try to do the next impossible thing lol. Thanks again guys.