Advertisement Create a free account

Issue with calculated command button label

1568229534
I'm trying to setup some command buttons for my spell macros. I'm putting these into the 3.5 spell templates, within the spell text, so that there are clickable buttons for any of the parts of a spell that may need a roll. Some spells scale with caster level, and I find I'm happily able to use @{casterlevel} in these macros in calculations that apply to both the label and the command. Some spells have a limit to their scaling (either limiting the number of added dice or the added modifier). I am able to use dh1 (drop highest one) so I use the lowest of either @{casterlevel} or the max I put into the macro. It works for both the label and the command, as before. Here is an example, say for the roll done for 3.5's Blight (I'm using 16 instead of @{casterlevel}, so you can easily test just by pasting into roll20 chat). [[[{16,15}dh1]]d6](!
/r [[{16,15}dh1]]d6) If we had a similar spell that scales dice but has some static modifier: [[[{16,15}dh1]]d6+1](!
/r [[{16,15}dh1]]d6+1) Still works! The issue I have the situation in which I have a scaling modifier. Let's say Cure Light Wounds! [1d6+[[{16,5}dh1]]](!
/r 1d6+[[{16,5}dh1]]) For whatever reason, the above errors out: SyntaxError: Expected "d", "k", "m", "mt", "x", [0-9] or [>|<|=] but "]" found. Does anyone have some insight as to why this last one fails? I've tried replacing some of the []{} characters with html entity codes but haven't been able to get it to work as intended, it either still errors, or it prints the label without evaluating the [[]] content. Maybe there's some combination I've missed. I should note that the command portion works find, it's just the label portion that doesn't. I'm sure what I'm doing is some sort of obscure unintended functionality, I guess it is the case that only the ones opening in [[[ allow me to do calculations inside the label and have arbitrary text as the end of the label, but I want arbitrary text at the beginning, too!
1568231575
The Aaron
Forum Champion
API Scripter
The fact that that works at all is actually kind of surprising to me.  The reason it works has to do with the parser seeing [[ at the beginning.  When it isn't there, there are problems.  If you use: [[1d6+[[{16,5}dh1]]](!
/r 1d6+[[{16,5}dh1]]) It will work, albeit with an extra [ hanging out at the beginning.  You might experiment with other values there, but if it doesn't start in [[, I suspect it won't work.  Not that you can change the order: [[[{16,5}dh1]]+1d6](!
/r 1d6+[[{16,5}dh1]]) And it will work fine.