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

Add image/gif to sneak attack query

1611956844

Edited 1611958390
Hi All, I have a question about sending an image or .gif to chat as part of a sneak attack query. I have a simple sneak attack query for a rogue's weapons: ?{Sneak Attack|No,0|Yes,1d6} I would like to also post an image to chat when sneak attack is yes. I can add the image in the description section of the weapon, but it will post it every time regardless of the query. I appreciate any advice!
1611960459

Edited 1611960565
Oosh
Sheet Author
API Scripter
What's the rest of your macro? We'd need to know where that Query is in the full macro, and where you've got your .gif appearing.
Sorry. The query is placed in the Damage2 section of each of the rogue's weapons in the attacks section of the 5e OGL sheet. I ran an attack with sneak attack selected and hit the up arrow and got the following, but it does not show the query itself: %{-MRaGmc-vqYuyoFKiagv|repeating_attack_-MRb0LfjjkhHKyW-DbZM_attack_dmg} For various spells (cast both through token actions and from the spell sheet itself) I have been successfully using [alttext] (URL.gif) to display animated images in chat, but none of these token actions or spell listings contain any queries.  So, to summarize, I not running a stand alone macro, I just want to add an image that shows in chat whenever the character selects sneak attack in the text query assigned to Damage2 for their weapons. If this is possible. Thanks.
1611963929

Edited 1611977504
Oosh
Sheet Author
API Scripter
Ok, there's a couple of options. The damage 2 section isn't much good, as it's a bit early in the macro order and if we cram any tricks in there they get overwritten. So there's a few options, really - I'd say the first one will probably be best. 1) Upside Down - we want to stuff a {{desc=[img]( <a href="http://www.image.com/1.png" rel="nofollow">www.image.com/1.png</a> )}} description property in the damage 2 section, inside a Query. The problem here is that the way the sheet outputs the macro the {{desc}} field (pulled from the "DESCRIPTION:" box in the attack's settings) comes after the {{dmg2}} field, so the sheet's version will overwrite anything we try to do in the {{dmg2}} section. So we do it upside down - disable the DAMAGE2: section on the sheet, and add the damage 2 data to the description area so we overwrite the sheet's {{dmg2}} property from within the Query. It boils down to putting this into the DESCRIPTION field in the attack settings (example just uses the Roll20 logo): ?{Sneak Attack?|No,&amp;rcub;&amp;rcub;{{|Yes,[&amp;nbsp;](#"&gt;&lt;img src="<a href="https://app.roll20.net/v2/images/roll20-logo.png?v=2" rel="nofollow">https://app.roll20.net/v2/images/roll20-logo.png?v=2</a>" style="display:block; margin:auto;)&amp;rcub;&amp;rcub; {{dmg2flag=1&amp;rcub;&amp;rcub; {{dmg2type=Sneak&amp;rcub;&amp;rcub;{{dmg2=[[1d6]]} I'd say this is your best bet. edit - if you already have content in the DESCRIPTION box, just paste this after it. 2) Global Modifier - use a global modifier instead of the DAMAGE2 field. Global damage mods are annoying because you need to enable &amp; disable them all the time. But they're great because they come right at the end of the macro, so you can overwrite any other property you like. In this case, we only need to insert the {{desc}} property with the image link - you can keep using the DAMAGE2 section on the sheet. So this goes in the damage section on a global damage modifier: ?{Sneak Attack?|No,0|Yes,1d6]]&amp;rcub;&amp;rcub;{{desc=[&amp;nbsp;](#"&gt;&lt;img src="<a href="https://app.roll20.net/v2/images/roll20-logo.png?v=2" rel="nofollow">https://app.roll20.net/v2/images/roll20-logo.png?v=2</a>" style="display:block; margin:auto;)&amp;rcub;&amp;rcub; {{[[0 This is a little cleaner, but potentially involves making your main attack more of a pain to use due to the clicking on and off of the global. Not ideal. 3) Custom Macro - This gives you full control over the output - with this method you can output the image as its own post, or in its own template - whatever you like. You can't run this from the sheet, and you said you didn't want to go in this direction, but it does give the most flexibility. edit - I've used an extra trick to get the image centered in the template. If you don't care about that, you can just use a normal image link, so: [img](<a href="https://app.roll20.net/v2/images/roll20-logo.png?v=2" rel="nofollow">https://app.roll20.net/v2/images/roll20-logo.png?v=2</a>) - instead of - [&amp;nbsp;](#"&gt;&lt;img src="<a href="https://app.roll20.net/v2/images/roll20-logo.png?v=2" rel="nofollow">https://app.roll20.net/v2/images/roll20-logo.png?v=2</a>" style="display:block; margin:auto;) There's also a lot of characters in the above tricks that stop the rest of the template from breaking - all the trailing [ { characters are needed, so make sure you paste the whole lot in
Thanks for the help, I really apprecate it. I agree that option 2 is too much of a bother. I tried option 1 but it asks for sneak attack both when the attack is made and then again when damage is assigned, and then it does not roll the sneak attack damage. So, I just created a little macro just to post the gif when my player has a successful sneak attack and added it to my bar, works fine. Thanks again!
1611977669
Oosh
Sheet Author
API Scripter
Whoops I forgot the {{dmg2flag=1}} part. Also forgot the atk &amp; dmg templates both send the same description to chat, which is a truly baffling decision.