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

Politely requesting help in prettying up a HP rolling macro.

1615899133

Edited 1615899387
Right now, I have gotten a macro that rerolls a character's (heavily homebrewed) lvl 5 HP to this form: Level **5** HP for **@{character_name}**: Higher of: [[@{Mor'rul|hp|max}+@{constitution_mod}]] | [[8 + 10 + {1d8, 1d10, 4+0d0}kh1 + {1d8, 1d10, 4+0d0}kh1 + {1d8, 1d10, 4+0d0}kh1 + {1d8, 1d10, 4+0d0}kh1 + 5 * @{constitution_mod}]] This has two problems. One, the way of accessing the character's hp will break if the character ever changes their name, which has happened. Two, ideally I would have the result be displayed as, for example, 8 + 10 + [6] + [4] + [8] + [8] + 5 * {2} = 54 , with hovering over the rolled ones showing how those numbers were arrived at, and the {2} would be tagged to be the constitution mod, but that'd require me to somehow split off those values and add them later, and I don't know how to do that. Perhaps one of you fine code carvers can help.
1615901964
The Aaron
Roll20 Production Team
API Scripter
Because of how you're referencing the other attributes, like @{constitution_mod}, you must have this in an ability.  If that's the case, you can omit the character's name. You can add a label after the Constitution to tell what it is using [Con].  You can surround internal calculations with [[ ]] to force just their result to be shown in the formula.  There's no way to surround them in [ ], but you can get something close by surrounding them in [] []: [[8 + 10 + [][[{1d8, 1d10, 4+0d0}kh1]][] + [][[{1d8, 1d10, 4+0d0}kh1]][] + [][[{1d8, 1d10, 4+0d0}kh1]][] + [][[{1d8, 1d10, 4+0d0}kh1]][] + 5 * @{constitution_mod} [Con] ]]
1615902134

Edited 1615902182
I should specify that I didn't mean literally putting a visual [box] around them, just to have the final result be obviously a rolled number you can hover over. Your way is definitely cleaner since it doesn't list out every single roll, but I kinda want to, at least for the hover-over. And yes, I'm using these as an ability.
1615904567
The Aaron
Roll20 Production Team
API Scripter
You can take out the nested inline rolls and still get some demarcation, but it's not as clean as it could be:
1615904661

Edited 1615905191
Hm. That -does- make it slightly easier to read, at least. From what I see the thing I want isn't doable without API access, alas. How'd you make it be on a nice blue field anyway? The only template I found a tutorial for is the unsightly purple header table default.
1615905590
The Aaron
Roll20 Production Team
API Scripter
That blue is just the background color for a message that you sent. The API would definitely make it easier to provide all this information in any number of different formats. =D There are some tricks you could play with inline rolls and breaking out all the data to several places, but I'm not sure it's worth it for what you're doing.  Just in general, you could format this into the default roll template, if you wanted it in a more structured format.
1615905677

Edited 1615905847
Ziechael
Forum Champion
Sheet Author
API Scripter
How about something like this: &{template:default} {{name=Level **5** HP for **@{selected|character_name}**}} {{Higher of=[[@{selected|hp|max}+@{selected|constitution_mod}]]}} [[ [[8]] + [[10]] + [[{1d8, 1d10, 4+0d0}kh1]] + [[{1d8, 1d10, 4+0d0}kh1]] + [[{1d8, 1d10, 4+0d0}kh1]] + [[{1d8, 1d10, 4+0d0}kh1]] + [[5 * @{selected|constitution_mod}]] ]] {{and= $[[1]]+$[[2]]+$[[3]]+$[[4]]+$[[5]]+$[[6]]+$[[7]]= $[[8]]}} It uses @{selected instead of relying on potentially changing character names or you could use @{target if you didn't want to have to select a token and instead preferred to be prompted to select one? Additionally there is likely something you could do with queries to not have it fixed to level 5 and apply to more than one character (such as the static 8 and 10 values etc) but without the full breakdown of the method used and variables between characters that is the best I can do.
1615906712

Edited 1615906845
Unfortunately, increasing the level would mean more of the    [[{1d8, 1d10, 4+0d0}kh1]]   which, as I understand it, I cannot do an arbitrary amount of times. I'd rather not tie it to either selecting or targeting a character as that makes it considerably less foolproof.   If you want the full formula, it's N + M for the first level, then the highest of 1dN, 1dM and "the lower of N and M, halved" for each level afterwards. 
It's possible to split the first part of the macro tooltip onto separate lines using  %NEWLINE%  in the roll labels/final comment. So the alt HP roll could look like [[8 + 10 [%NEWLINE%] + {1d8, 1d10, 4+0d0}kh1 [%NEWLINE%] + {1d8, 1d10, 4+0d0}kh1 [%NEWLINE%] + {1d8, 1d10, 4+0d0}kh1 [%NEWLINE%] + {1d8, 1d10, 4+0d0}kh1 [%NEWLINE%] + 5 * @{constitution_mod} [Con] %NEWLINE% ]] It'll give you a bit more logical separation of the different roll sections
Ooh, that IS an improvement!