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

Can't add single pair of square brackets in my macro?

Hi everyone! I have this macro for a basic melee attack in a D&D4e game. I use square brackets within the equations of my macros to keep them easier to read. It works in every other equation, (even works in the  the "{attack=" portion of this macro!), but I can't seem to put them ANYWHERE in the "{damage=" portion. I'd like to have a pair of visible square brackets around every number, starting with the "[[floor(@{level}/21)]]" portion so it reads as "[0] [Epic Destiny Bonus]" in the end. However, adding a single square bracket anywhere in the "{damage=" portion will run the macro up to the "(**@{target|Creature within weapon range|character_name}**)", but refuse to resolve do anything else. Any ideas? &{template:dnd4epower} {{atwill=1 }}{{emote=**@{character_name}** lashes out with a simple attack from a **@{weapon-1-name}** }}  {{name=Basic Melee }} {{level=Basic Attack }} {{type=At-Will ♦}} {{keywords=Weapon }} {{action=Standard Action🏹}} {{range=Melee Weapon}} {{target= One Creature  (**@{target|Creature within weapon range|character_name}**) }} {{attack= Strength ([[1d20 + [[[@{strength-mod}]]] [STR Mod] +[[[@{halflevel}]]] [Half Level] [[[@{weapon-1-attack}]]] [Weapon Bonus]]]) vs. AC }} {{damage=[[ [[ [[ [[floor(@{level}/21)]] * @{weapon-1-num-dice}]]d@{weapon-1-dice}]] [Epic Destiny Bonus] + [[@{weapon-1-num-dice}]]d[[@{weapon-1-dice}]] [Weapon Die] + [[@{weapon-1-damage}]] [Weapon Damage Bonus] ]] }}
1568175964

Edited 1568176045
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
I believe you've got an extraneous set of opening inline roll brackets there. Additionally, I think some of yourtags are inside nested inline rolls, which means they won't show up. Edit: also in your attack section you're using triple brackets for some reason; that might cause problems as well
Thanks. Not sure where the extra attack brackets came from, but I cleaned that up, and I think I fixed my damage section.  However, while my tags (Epic Destiny Bonus, Weapon Die and Weapon Damage Bonus) appear, I still cannot put square brackets around my numbers. It either stops the macro from resolving or won't be included as part of the equation. Any ideas how to do it? {{damage= [[ [[ [[floor(@{level}/21)]] * @{weapon-1-num-dice}d@{weapon-1-dice}]] [Epic Destiny Bonus] + [[@{weapon-1-num-dice}d@{weapon-1-dice}]] [Weapon Die] + @{weapon-1-damage} [Weapon Damage Bonus] ]] }}{{special=I can use an unarmed attack as a weapon to make a melee basic attack.}}{{special=I can use an unarmed attack as a weapon to make a melee basic attack.}}
1568240948
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
A single set of square brackets is a roll tag, and will never be included in the equation. Double square brackets are inline rolls of course. Where are you trying to bracket a number?
Scott C. said: A single set of square brackets is a roll tag, and will never be included in the equation. Double square brackets are inline rolls of course. Where are you trying to bracket a number? You're absolutely right, I don't know what I was thinking. As it stands, the macro is perfect other than the weapon die portion resolves the die roll immediately, rather than display the "1d4" first. How do I fix this?
1568243996
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Not sure I understand what your asking. Do you want it to display 1d4 (7), aka the die rolled and then the result, or something else? Also, I just noticed you've got the special field repeated.
Apologies for not being clear. I'd like it to display 1d4, then the result of that roll on the other side of the equals sign. So it would read:  Damage= 0 [Epic Destiny Bonus] + 1d4 [Weapon Die] + 1 [Weapon Damage Bonus] = 0 + 4 + 1 = 5. Currently, it doesn't display "1d4". it gives the result of that die roll right away.  I noticed the special field being repeated as well. Thanks. I was very  tired when posting the OP :P
1568303921
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Ah, then you just need to repeat the formula but without inline roll brackets (note that the destiny bonus won't be quite the same as you can't reuse roll results. {{damage= [[floor(@{level}/21) * @{weapon-1-num-dice}d@{weapon-1-dice}]] [Epic Destiny Bonus] + @{weapon-1-num-dice}d@{weapon-1-dice} [Weapon Die] + @{weapon-1-damage} [Weapon Damage Bonus] = [[ [[floor(@{level}/21) * @{weapon-1-num-dice}d@{weapon-1-dice}]] [Epic Destiny Bonus] + @{weapon-1-num-dice}d@{weapon-1-dice} [Weapon Die] + @{weapon-1-damage} [Weapon Damage Bonus] ]]}}{{special=I can use an unarmed attack as a weapon to make a melee basic attack.}} Note that you can also take advantage of the inline roll hover activated tooltip to get this without having it take up a bunch of room in chat by not nesting things quite so deeply: {{damage= [[ [[floor(@{level}/21) * @{weapon-1-num-dice}d@{weapon-1-dice}]] [Epic Destiny Bonus] + @{weapon-1-num-dice}d@{weapon-1-dice} [Weapon Die] + @{weapon-1-damage} [Weapon Damage Bonus] ]]}} {{special=I can use an unarmed attack as a weapon to make a melee basic attack.}}
The second one is exactly what I was after, thank you!!
1568470674
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Glad it works for you, happy rolling.