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

Jim's Magic Missiles Macro

1623695814

Edited 1623780091
Hello there, I am currently trying to get Jim's Magic Missiles [Link Removed by Admin] to work as a macro, however i find myself unable to get there. This is my first time ever trying to work with macros and some of my methods are probably not ideal so any input is appreciated. This is my main macro, #JMM: &{template:default} {{name=Jim's Magic Missile}} #crit {{attack1=$[[0]]}} {{damage1=[[2d4]]+$[[2]] Force}} #crit {{attack2=$[[4]]}} {{damage2=[[2d4]]+$[[6]] Force}} #crit {{attack3=$[[8]]}} {{damage3=[[2d4]]+$[[10]] Force}} And here is #crit: [[[[floor([[1d20cs20]]/20)]]*3d4[CRIT]]] Here is a screenshot of the chat output. Weirdly enough, it seems to me that the problem has to do with damage2=[[2d4]] as it doesn't show the 2d4 as the fancy square number that you can hover over but instead just shows the roll result. I have additionally started an attempt to make it work at higher levels (although this is low priority as I probably won't ever use it above 2nd level) which for now disregards crits and looks a little bit like this: {{attack4=[[(?{Cast at what level?|Level 1,0|Level 2,1|Level 3,1|Level 4,1|Level 5,1|Level 6,1|Level 7,1|Level 8,1|Level 9,1})*(1d20+7)]]}} {{damage4=[[(?{Cast at what level?|Level 1,0|Level 2,1|Level 3,2|Level 4,3|Level 5,4|Level 6,5|Level 7,6|Level 8,7|Level 9,8})*2d4]] Force}} Thank you for any input in advance!
Just a quick look: what happens if you put all three of the #crit calls together? I wonder if there's an issue with calling a roll result and then using another roll and then calling a roll result from the next roll. &{template:default} {{name=Jim's Magic Missile}} #crit #crit #crit {{attack1=$[[0]]}} {{damage1=[[2d4]]+$[[2]] Force}} {{attack2=$[[4]]}} {{damage2=[[2d4]]+$[[6]] Force}} {{attack3=$[[8]]}} {{damage3=[[2d4]]+$[[10]] Force}}
I like the approach. Tried it out and it seemed to fix some things but not all. More numbers are correct this time than previously. Here's another screenshot of what it looks like now. The numbers that I put a red dot next to are faulty. First one is the correct number, but again not with the square thing (idk what it's called) Second one picks Rolling floor(17/20) = floor(17/20) instead of Rolling 1d20cs20 And the third one is shown in the screenshot
1623708741

Edited 1623708838
I'm guessing if you just do a quick check you'll see you're simply referencing the wrong rolls: &{template:default} {{name=Jim's Magic Missile}} #crit #crit #crit {{Roll1 = $[[0]]}} {{Roll2 = $[[1]]}} {{Roll3 = $[[2]]}} {{Roll4 = $[[3]]}} {{Roll5 = $[[4]]}} {{Roll6 = $[[5]]}} {{Roll7 = $[[6]]}} {{Roll8 = $[[7]]}} {{Roll9 = $[[8]]}} {{Roll10 = $[[9]]}} I notice that the #crit macro has three rolls in it, but your main macro #JMM is only increasing by 2 -- $[[0]] to $[[2]] to $[[4]] etc. [[[[floor([[1d20cs20 ]] /20) ]] *3d4[CRIT ]] ] The easiest way to 'count' rolls is to just look count each pair of closing brackets in order (but ignore any closing brackets from an indexed/referenced roll using $[[ ]]): Roll 1: [[1d20cs20]] Roll 2: [[floor([[1d20cs20]]/20)]] Roll 3: [[[[floor([[1d20cs20]]/20)]]*3d4[CRIT]] Repeat that 3 times so you'll have Rolls #1 - 9 in the three #crit macros, then any additional rolls in the #JMM macro, e.g.  damage1=[[2d4]]  will be roll #10, etc.
Hey! Thanks for the roll test idea. I've now got all the right numbers in all the right places and my $[[]] look like this: &{template:default} {{name=Jim's Magic Missile}} #crit #crit #crit {{attack1=$[[0]]}} {{damage1=[[2d4]]+$[[2]] Force}} {{attack2=$[[3]]}} {{damage2=[[2d4]]+$[[6]] Force}} {{attack3=$[[4]]}} {{damage3=[[2d4]]+$[[11]] Force}} For some reason it rolles like this: Roll 1: [[1d20cs20]] Roll 2: [[floor([[1d20cs20]]/20)]] Roll 3: [[[[floor([[1d20cs20]]/20)]]*3d4[CRIT]] Roll 4: [[1d20cs20]] Roll 5: [[1d20cs20]] Roll 6: [[floor([[1d20cs20]]/20)]] Roll 7: [[[[floor([[1d20cs20]]/20)]]*3d4[CRIT]] Roll 8: [[floor([[1d20cs20]]/20)]] Roll 9: [[[[floor([[1d20cs20]]/20)]]*3d4[CRIT]] Not sure why it is in this order but it appears to reliably be in this order so I can work with that. Now the only remaining kink is the very first damage roll ignoring the brackets around the 2d4 and just putting in the number without being able to hover it. {{damage1=[[2d4]]+$[[2]] Force}} I dunno if this an easy error on my end that I'm overlooking or just the game being funny at this point. I'll include another screenshot from the chat output just in case.
1623768810
GiGs
Pro
Sheet Author
API Scripter
There is some wonkiness in the way this technique works, in the ordering when you have a lot of nested inline rolls. It should be that it orders inline rolls from left to right, and in nested rolls, inner to outer. But as you have found, that ordering doesn't always work with complex rolls. But for the same roll, it's always wrong in the same, consistent way. So with a bit of trial and error you can figure out the ordering you need.
Brooshii said: Hey! Thanks for the roll test idea. I've now got all the right numbers in all the right places and my $[[]] look like this: &{template:default} {{name=Jim's Magic Missile}} #crit #crit #crit {{attack1=$[[0]]}} {{damage1=[[2d4]]+$[[2]] Force}} {{attack2=$[[3]]}} {{damage2=[[2d4]]+$[[6]] Force}} {{attack3=$[[4]]}} {{damage3=[[2d4]]+$[[11]] Force}} For some reason it rolles like this: Roll 1: [[1d20cs20]] Roll 2: [[floor([[1d20cs20]]/20)]] Roll 3: [[[[floor([[1d20cs20]]/20)]]*3d4[CRIT]] Roll 4: [[1d20cs20]] Roll 5: [[1d20cs20]] Roll 6: [[floor([[1d20cs20]]/20)]] Roll 7: [[[[floor([[1d20cs20]]/20)]]*3d4[CRIT]] Roll 8: [[floor([[1d20cs20]]/20)]] Roll 9: [[[[floor([[1d20cs20]]/20)]]*3d4[CRIT]] Not sure why it is in this order but it appears to reliably be in this order so I can work with that. Now the only remaining kink is the very first damage roll ignoring the brackets around the 2d4 and just putting in the number without being able to hover it. {{damage1=[[2d4]]+$[[2]] Force}} I dunno if this an easy error on my end that I'm overlooking or just the game being funny at this point. I'll include another screenshot from the chat output just in case. Ah yeah I haven't played with longer nested inline rolls, so there is definitely some wonkiness like GiGs mentioned. I just tried this out and it appears to work to add the [[2d4]] to the crit macro and simply call those rolls as: #crit [[[[floor([[1d20cs20]]/20)]]*3d4[CRIT]]] [[2d4]] #JMM &{template:default} {{name=Jim's Magic Missile}} #crit #crit #crit {{attack1=$[[0]]}} {{damage1=$[[3]]+$[[2]] Force}} {{attack2=$[[4]]}} {{damage2=$[[5]]+$[[8]] Force}} {{attack3=$[[6]]}} {{damage3=$[[9]]+$[[11]] Force}}
1623777157

Edited 1623777211
GiGs
Pro
Sheet Author
API Scripter
One thing you can also try is reduce the number of inline brackets, you'll need to recalculate numbers. But that crit macro has more inline brackets than needed. You can do this: [[floor([[1d20cs>20]]/10)*3d4[CRIT]]] I guess that extra set of brackets might be there to simplify reading the result when you mouse-over. You have to decide if that's important enough.
1623778614

Edited 1623778634
GiGs
Pro
Sheet Author
API Scripter
You could also do this &{template:default} {{name=Jim's Magic Missile}} [[ [[2d4]]+ [[[[floor([[1d20cs20]]/20)]]*3d4[CRIT]]]]] [[ [[2d4]]+ [[[[floor([[1d20cs20]]/20)]]*3d4[CRIT]]]]] [[ [[2d4]]+ [[[[floor([[1d20cs20]]/20)]]*3d4[CRIT]]]]] {{attack1=$[[1]]}} {{damage1=$[[0]]+$[[3]]=$[[4]] Force}} {{attack2=$[[6]]}} {{damage2=$[[5]]+$[[9]]=$[[11]] Force}} {{attack3=$[[10]]}} {{damage3=$[[7]]+$[[13]]=$[[14]] Force}} A bit more readably, thats &{template:default} {{name=Jim's Magic Missile}} [[ [[2d4]]+ [[[[floor([[1d20cs20]]/20)]]*3d4[CRIT]]]]] [[ [[2d4]]+ [[[[floor([[1d20cs20]]/20)]]*3d4[CRIT]]]]] [[ [[2d4]]+ [[[[floor([[1d20cs20]]/20)]]*3d4[CRIT]]]]] {{attack1=$[[1]]}} {{damage1=$[[0]]+$[[3]]=$[[4]] Force}} {{attack2=$[[6]]}} {{damage2=$[[5]]+$[[9]]=$[[11]] Force}} {{attack3=$[[10]]}} {{damage3=$[[7]]+$[[13]]=$[[14]] Force}} That gives results like this: (The damage is high because I changed the /20 to /10 during testing to make it easier to identify which roll was which) The number ordering got wonky, so you'll want to check it is correct for you.
Thanks a lot for all the help! Both your versions are working wonderfully and I chose to take both of them. That way if I ever approach macros again in the future I'll have more material for reference. Is there a way to close this thread as resolved?
1623824591
GiGs
Pro
Sheet Author
API Scripter
No there isn't. Om roll20, every thread closes itself after 2 months of inactivity.