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

Frustrating problem in a complex macro

So, I've been tinkering away on a macro for a rather complex macro for rolling X magic missiles against Y targets with minimal amount of queries and no possibility of assigning more missiles than you have. But, on the home stretch, I've ran across a particular problem:  The [1](#) is not rendering as a link, for whatever reason. It is not a number called from roll index, and it should not be being called anywhere from the roll index - it works as written isolated in a test macro, and I am out of ideas of what is making fail. Here's the macro components: magic-missile &{template:default} {{name=Magic Missile }} {{=Number of missiles: ?{spell level|1,3|2,4|3,5|4,6|5,7|6,8|7,9|8,10|9,11} [First target](`/w gm %{@{character_name}|mmrange?{spell level}} [[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]] %{@{character_name}|mm-follow}[[[[1]]]] {{Left=[[?{spell level}-?{missiles to target}]]}} {{[[[{0,?{missiles to target}}>?{spell level}]]](#)= test }} )}} mm-follow &{template:default} {{name=Magic Missile }} {{Missiles=[[[[?{missiles to target}]]]] }} {{[1](#)=[Next target](`/w gm %{@{character_name}|mmrange$[[13]]} {{storage= [[$[[1]]]][[$[[2]]]][[$[[3]]]][[$[[4]]]][[$[[5]]]][[$[[6]]]][[$[[7]]]][[$[[8]]]][[$[[9]]]][[$[[10]]]][[$[[11]]]]}} %{@{character_name}|mm-follow}[[$[[12]]+1]][[$[[13]]-?{missiles to target}]]) }} {{Count=$[[12]] }} {{Left=$[[13]] }} mmrange1-11 these are all abilities containing the query ?{missiles to target} with plain numbers as options. As the macro is currently set up, the problem row is only present on the second template, not the recursive ones (because I didn't add it to that one yet).
I'm not immediately seeing where the error is but I suspect you may be falling foul of a bug in the parser around determining the depth of a nested roll. When you have runs of brackets such as ]]]] the parser reads that as 3 pairs of brackets rather than 2, it seems to incorrectly reuse brackets when done this way. When that happens it can treat rolls after it as being less nested than they are which can cause a roll that should be replaced by a plain number to instead be replaced by the HTML instead. There are a few conditions that have to be met to trigger the ill effect so it doesn't crop up that often. This bug is actually the reason template overriding using the link syntax works at all (The parentheses aren't actually required).
Oof, if that is the case, I'm not sure there's anything I can do to fix it, other than drastically change the setup and dropping features. I need the double pairs for my recursion ticker, and in recursion, to store the numbers.
1728612033
vÍnce
Pro
Sheet Author
I have no clue if it matters in regards to your hidden roll witch craft... but there has been an issue in the past when making "lots" of inline rolls without using white space inside the innermost square bracket.  The macro would spit out part of the macro text instead of completing all the rolls.  Adding white space would solve the output issue. ie [[ [[ 1d20 ]] ]] instead of [[[[1d20]]]]
1728617293
GiGs
Pro
Sheet Author
API Scripter
I was just about to suggest the white space idea. I always put a space after each set of brackets, as in Vince's example.
Digging into it the problem appears fixable with whitespace In magic-missle where you have %{@{character_name}|mm-follow}[[[[1]]]] should be changed to %{@{character_name}|mm-follow}[[ [[1]] ]] In mm-follow where you have Missiles=[[[[?{missiles to target}]]]] if changed to Missiles=[[ [[?{missiles to target}]] ]] allows the link to behave correctly. These changes shouldn't affect any of your intended behaviour.
Thank you so much, everyone! With that, I managed to put everything together and make it work - I could probably polish up the presentation some more, but as far as the puzzle of making it functional, I'm satisfied. The complete macro is as follows: magic-missile &{template:default} {{name=Magic Missile }} {{=Number of missiles: ?{spell level|1,3|2,4|3,5|4,6|5,7|6,8|7,9|8,10|9,11} [First target](`/w gm %{@{character_name}|mmrange?{spell level}} [[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]][[0]] %{@{character_name}|mm-follow}[[ [[1]] ]] {{Left=[[?{spell level}-?{missiles to target}]]}} {{[[[{0,?{missiles to target}}>?{spell level}]]](#)= [Results](`/ooc &{template:default} {{name=Magic Missile: results}} {{[1](#)=[[?{missiles to target}d4+?{missiles to target}]]}}) }} {{[0](#)=}})}} mm-follow &{template:default} {{name=Magic Missile }} {{Missiles=[[ [[?{missiles to target}]] ]] }} {{[1](#)=[Next target](`/w gm %{@{character_name}|mmrange$[[13]]} {{storage= [[$[[1]]]][[$[[2]]]][[$[[3]]]][[$[[4]]]][[$[[5]]]][[$[[6]]]][[$[[7]]]][[$[[8]]]][[$[[9]]]][[$[[10]]]][[$[[11]]]]}} %{@{character_name}|mm-follow}[[$[[12]]+1]][[$[[13]]-?{missiles to target}]]{{[[[{0,?{missiles to target}}>$[[13]]]]](#)= [Results](`/ooc &{template:default} {{name=Magic Missile: results}} {{[1](#)=[[$[[2]]d4+$[[2]]]]}} {{[[[{$[[12]]-9,1}kh1]]](#)=[[$[[3]]d4+$[[3]]]]}} {{[[[{$[[12]]-8,1}kh1]]](#)=[[$[[4]]d4+$[[4]]]]}} {{[[[{$[[12]]-7,1}kh1]]](#)=[[$[[5]]d4+$[[5]]]]}} {{[[[{$[[12]]-6,1}kh1]]](#)=[[$[[6]]d4+$[[6]]]]}} {{[[[{$[[12]]-5,1}kh1]]](#)=[[$[[7]]d4+$[[7]]]]}} {{[[[{$[[12]]-4,1}kh1]]](#)=[[$[[8]]d4+$[[8]]]]}} {{[[[{$[[12]]-3,1}kh1]]](#)=[[$[[9]]d4+$[[9]]]]}} {{[[[{$[[12]]-2,1}kh1]]](#)=[[$[[10]]d4+$[[10]]]]}} {{[[[{$[[12]]-1,1}kh1]]](#)=[[$[[11]]d4+$[[11]]]]}} {{[[[{$[[12]],1}kh1]]](#)=[[$[[13]]d4+$[[13]]]]}} ) }} {{[0](#)=}}) }} {{Count=$[[12]] }} {{Left=$[[13]] }} mmrange X ?{missiles to target|X|...|1}