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

Number of Individual Damage Calculations Allowed in a Macro?

1592352567

Edited 1592352620
I'm using the D&D 5e Roll20 Character Sheet, but I don't feel bound to that template if it can't accomplish what I want to do.  I'm trying to write a Magic Missile spell as a token action that would both try to hold to a particular template, while at the same time letting me throw out multiple rolls of 1d4+1 in Force Damage for each missile that strikes, as each one can have it's own target.  The attempt I have is listed down below and is most definitely only working for asking if I want to Whisper (or not) and what spell level I'm casting at.  No output in chat menu occurs.  Is there a limit on the calculations the template can hold, and if so, what would be an alternative option to frame this macro in?  ?{Whisper?|Public Roll,|Whisper Roll,/w gm } @{Guilpen Schrivner|wtype}&{template:spell} {{level=evocation 1}} {{name=Magic Missile}} {{castingtime=1 action}} {{range=120 ft.}} {damage=1}} {{dmg1flag=1}} [[Cast at what level?|1}-1]] {{dmg1=[[1d4+1]] [[1d4+1]] [[1d4+1]] [[?{Cast at what level?|Level 1,[[1d4+1]] [[1d4+1]] [[1d4+1]]|Level 2,[[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]]|Level 3,[[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]]|Level 4,[[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]]|Level 5,[[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]]|Level 6,[[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]]|Level 7,[[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]]|Level 8,[[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]]|Level 9,[[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]]} }} {{v=1}} {{s=1}} {{description=You create three glowing darts of magical force. Each dart hits a creature of your choice that you can see within range. A dart deals 1d4 + 1 force damage to its target. The darts all strike simultaneously, and you can direct them to hit one creature or several.}} {{athigherlevels=When you cast this spell using a spell slot of 2nd level or higher, the spell creates one more dart for each slot level above 1st.}} {{ritual=0}} {{concentration=0}} {{charname=Guilpen Schrivner}}
1592353476
GiGs
Pro
Sheet Author
API Scripter
Your missing a bracket here: {damage=1}} should be {{damage=1}} You also have two queries with the same name, but different results. [[Cast at what level?|1}-1]] One of them will be ignored.
1592353640

Edited 1592354244
Thanks GiGs, appreciate it! Actually, hold on: what needs to be changed with the second query, the [[Cast at what level?|1}-1]] .. I apologize but I'm afraid I just don't understand where I need to go to fix the macro?
1592355033

Edited 1592355182
GiGs
Pro
Sheet Author
API Scripter
I cant see what this bit is actually doing:  [[Cast at what level?|1}-1]] I cant see what it is being used for, so you are probably fine deleting it. The second query with all the dice rolls is the one you want. Edit: actually I misread it. That's an inline roll, with some incorrect brackets - it will simply report a number if it even works. But since its not inside {{ }} brackets, it will never be displayed. So you should definitely delete it.
I guess the problem is that the spell template part works fine now, but I'm not getting any of the damage rolls to appear.  If I was to be honest, I would love to be able to have the damage rolls occur within the text of the spell itself, but it doesn't seem these templates work that way.  But thanks GiGs, I guess it's all a source of frustration until it works.
1592356570
GiGs
Pro
Sheet Author
API Scripter
Try switching to the default template while testing, to figure out what's going on. Also, does anything appear in chat when you run this? I'm puzzled by this bit: {{dmg1=[[1d4+1]] [[1d4+1]] [[1d4+1]] [[?{Cast at what level?| what are those first 3 rolls for before the query starts? Though thinking about it, you should probably reduce them to two, and the drop two of the rolls from every row of the query. That will show the right number of dice when you get it working.
Gotcha, and yeah, the spell is coming out (the spell template and text) but none of the rolls.  :shrugs.  
1592356829
GiGs
Pro
Sheet Author
API Scripter
I tested the roll query outside of the template, and it works fine, so there's something up with the formatting of the rolltemplate. I dont have that system set up so I do all my testing with the default spell template. Get it working in that, and you should be able to adapt it to the spell template.
1592357272
GiGs
Pro
Sheet Author
API Scripter
The following two fixes will get it working (just tested with default template): As I mentioned earlier, remove this part: [[Cast at what level?|1}-1]]  That will get things printing, but the rolls are broken. So the second fix - change this: [[?{Cast at what level?|Level 1, to this: ?{Cast at what level?|Level 1, That first set of inline roll brackets doesnt have a matching pair to close it, and you dont want the query inside a single set of inline roll brackets anyway. Make those two changes and your macro will work.
Okay, very cool, and thanks for the time you've given me working on this GiGs!  I have been able to get the 5e Roll Template to at least show the spell, but it still refuses to do any rolling.  I'm going to try it in the generic template as you suggested and see how that works out.
1592362098

Edited 1592362196
GiGs
Pro
Sheet Author
API Scripter
This works in the default template: ?{Whisper?|Public Roll,|Whisper Roll,/w gm } &{template:default} {{level=evocation 1}} {{name=Magic Missile}} {{castingtime=1 action}} {{range=120 ft.}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[1d4+1]] [[1d4+1]] ?{Cast at what level?|Level 1,[[1d4+1]]|Level 2,[[1d4+1]] [[1d4+1]]|Level 3,[[1d4+1]] [[1d4+1]] [[1d4+1]]|Level 4,[[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]]|Level 5,[[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]]|Level 6,[[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]]|Level 7,[[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]]|Level 8,[[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]]|Level 9,[[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]]} }} {{v=1}} {{s=1}} {{description=You create three glowing darts of magical force. Each dart hits a creature of your choice that you can see within range. A dart deals 1d4 + 1 force damage to its target. The darts all strike simultaneously, and you can direct them to hit one creature or several.}} {{athigherlevels=When you cast this spell using a spell slot of 2nd level or higher, the spell creates one more dart for each slot level above 1st.}} {{ritual=0}} {{concentration=0}} {{charname=Guilpen Schrivner}} I removed the @{Guilpen Schrivner|wtype} bit at the start since i didnt have a character of that name, that shouldn't make a difference.
1592362327
GiGs
Pro
Sheet Author
API Scripter
I wonder if part of the reason its not showing up in the non-default templates is because of the sections with are just 0 or 1: those It hink should be inline rolls, like so: {{damage=[[1]]}} {{dmg1flag=[[1]]}}  {{ritual=[[0]]}} {{concentration=[[0]]}} 
I gave it a try but while the default template works fine, the spell template does not.  I can only imagine it's an issue where the template itself is rigid and not allowing this.  I think I would have to try a different template (perhaps the attack / damage one) and see if that fixed it.  It's a source of frustration but not one worth giving up the entire day too.  But thanks @GiGs, sincerely, you put a lot of effort into helping me here and I really appreciate it. It's been a while since I had anything to do with some of these more in depth looks at how the macros and such were put together, so I couldn't have come across these solutions without you.
1592371275
GiGs
Pro
Sheet Author
API Scripter
You're welcome, good look finding a solution!
1592382656

Edited 1592383558
Oosh
Sheet Author
API Scripter
Edit - just to be clear, before you go any further: this is after you've fixed all the code errors that GiGs has posted Okay... so you're trying to use the spellcard template to roll damage. That CAN be done, but it's not what the template is designed for. It doesn't have a {{dmg1}} field. See here for more info. You need to either: - convert the whole macro to one of the templates that actually has a damage roll e.g. atkdmg or npcatk , which will read those fields in the macro: {{dmg1=}} {{dmg1flag=}} - move the entire damage roll & query into an inline roll contained within some [[ double squares ]] inside the description field of the spell template That template you're trying to use just isn't designed for damage rolls. I'd recommend moving to another template on the link above - this gives you inbuilt functions for a 2nd damage field, global damage, higher level cast and a whole bunch of stuff. You can use the spell template if you really like that output, but it does not support a bunch of fields that are potentially useful in these rolls. Post back if you need more help with that - but with GiGs' corrections to the math & queries, the code is all good you've just picked a template which doesn't have the fields you're calling. Edit 2 - If you want to see something really cool, run this: &{template:spell} {{level=evocation 1}} {{name=Magic Missile}} {{castingtime=1 action}} {{range=120 ft.}} {damage=1}} {{dmg1flag=1}} {{dmg1=[[1d4+1]] [[1d4+1]] [[1d4+1]] [[?{Cast at what level?|Level 1,[[1d4+1]] [[1d4+1]] [[1d4+1]]|Level 2,[[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]]|Level 3,[[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]]|Level 4,[[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]]|Level 5,[[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]]|Level 6,[[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]]|Level 7,[[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]]|Level 8,[[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]]|Level 9,[[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]] [[1d4+1]]} }} {{v=1}} {{s=1}} {{description= $[[1]] $[[2]] You create three glowing darts of magical force. Each dart hits a creature of your choice that you can see within range. A dart deals 1d4 + 1 force damage to its target. The darts all strike simultaneously, and you can direct them to hit one creature or several.}} {{athigherlevels=When you cast this spell using a spell slot of 2nd level or higher, the spell creates one more dart for each slot level above 1st.}} {{ritual=0}} {{concentration=0}} {{charname=Guilpen Schrivner}} That's your code with a couple of GiG's corrections, still run in the spell template, but those two bolded bits are calling on those same rolls that you can't see. They are still happening, but because the template doesn't have a {{dmg1}} field to print them to they are invisible unless you tell the template to print them somewhere it's allowed to. So... hopefully that highlights (in an amazingly cool way) that the code was fine, you're just trying to output it into a non existent field. If you don't think that's cool, it probably means you're a well-adjusted person and don't need to put underpants on your head.
1592391608
GiGs
Pro
Sheet Author
API Scripter
lol, it's probably a side effect of your hat-eating addiction. Thanks for explaining why that template wasnt working.
1592391922
Oosh
Sheet Author
API Scripter
It's not an addiction, you're a hat-feeder and I am the victim. Let's not paint it any other way. If you stop being so clever, I'll stop eating hats.
Honestly wish there was some little upvoting system the site had.  Thanks guys!