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 .
×
We're investigating unusual elevated traffic on voice and video servers that is affecting connectivity. We are working towards a solution as quickly as possible! Sorry for the trouble!
Create a free account

[Script] SmartAoE - graphical interface for implementing AoE's on gridded maps

David M. said: Version Update v0.23 - found  here Minor bug fix that affected an edge case of a small AoE (e.g. 1x1) vs. a huge token (e.g. 3x3 or greater) where depending on AoE placement the target token may or may not have been filtered out of the valid targets array. The --bar| subcommand now accepts multiple bar values! This is useful if the target has temporary hp (5e), or other ablative health pool (e.g. stamina in Starfinder). Thanks Erik M.! No, thank you! I shall add you a place in my virtual scripter shrine. :D
1638227006
Surok
Roll20 Production Team
I added the final query for half or none damage. Also I changed the status icons to correspond to the default ones found in the Combat Master API. !smartaoe {{ --rightsub|DC @{selected|spell_save_dc} --leftsub| @{selected|token_name} --aoeType|?{AoE Shape?|square|circle|5econe|Line}, float --radius|?{Radius?|10}ft --fx|?{TypeFX|bomb|bubbling|burn|burst|explode|glow|missile|nova}-?{ColorFX|acid|blood|charm|death|fire|frost|holy|magic|slime|smoke|water} --DC|@{selected|spell_save_dc} --saveFormula|5e?{Save Type?|STR|DEX|CON|INT|WIS|CHA} --damageFormula1|[[?{Damage?|10}]] --damagesaverule|?{Save Damage Rule?|Save for half,*0.5|No damage on Save,*0} --damageType1|?{damageType|none|acid|bludgeoning|cold|fire|force|lightning|necrotic|piercing| poison|psychic|radiant|slashing|thunder} --autoApply|1 --conditionFail|?{Status|None, |Red,red|Blue,blue|Green,green|Orange,orange|Purple,purple|Pink,pink|Yellow,yellow|―, |Blue,blue|Concentrating,stopwatch|―, |Prone,back-pain|Restrained,fishing-net|Grappled,grab|―, |Incapacitated,interdiction|Stunned,fist|Unconscious,sleepy|―, |Charmed,broken-heart|Frightened,screaming|―, |Poisoned,chemical-bolt|Blinded,bleeding-eye|Deafened,edge-crack|Paralyzed,pummeled|Petrified,frozen-orb|―, |Invisible,ninja-mask|―, } }}
Great script. What's the easiest way to reduce a spell slot or resource?
1638272135
David M.
Pro
API Scripter
Thanks Todd! Integrated resource management is actually something I've been wanting to add, but for now the easiest way is probably to tack on a !modattr call to your macro using the ChatSetAttr script. 
Hi all, does anyone know if it is possible to make a 60ft x 15ft line (for wall of fire) with this script? Having no issues with any other spells, but it's my warlock's go-to and would love to use the template for him
1638537504

Edited 1638538118
David M.
Pro
API Scripter
Hmm, the script doesn't currently support "wide" walls out of the box. I'll have to think about how best to implement that. Off the top of my head, it's possible that a new aoeType ("wall, <width>") might not be too hard, with the idea that it would create two endpoint control tokens, use the "line" algorithm, and add squares to left/right or top/bottom depending on the relative positioning of the control tokens.  Until I can figure something out, the only thing I can think of is an extremely fiddly and non-ideal solution. 1) Spawn three copies of AoEControlToken using the SpawnDefaultToken script, e.g !Spawn {{ --name|AoEControlToken --qty|3 --offset|1,-1 --placement|grid 1 }} 2) For each of these, make a SmartAoE line effect. You'd have to explicitly note the character name for the DC or hardcode it, as using @{selected...} wouldn't work. The example below uses 5e attributes (I'm not sure which system you are using). EDIT - Looks like I left the --ignore subcommand in there that I use for my personal games (my players like to roll their own saves). You can delete this or replace with your own "ignore" attribute/val.  !smartaoe {{ --title|Wall of Fire --leftsub|Slot level ?{Cast at what level?|4|5|6|7|8|9} --rightsub|DC @{Trix|spell_save_dc} DEX --aoeColor|#99000050 --gridColor|#99000050 --aoeType|line --radius|60ft --fx|burn-fire --dc|@{Trix|spell_save_dc} --saveFormula|5eDEX --damageFormula1|[[(1+?{Cast at what level?})d8]] --damageType1|Fire --ignore|SmartAoE_Ignore,1 --autoApply|1 --bar|1 --zerohpmarker|dead }} Lots of clicking, and you'd have to trigger each "line" separately. Like I said, very fiddly and probably not worth it IMO, but here's an example of what I'm describing (click to play gif)
Hey David,  Another question/feature request: I've been using this awesome stuff for all my AOEs but some of my conditions have random durations, so is it possible to put an inline roll in the fail condition like:  --conditionFail|fishing-net@[[2d4]] Thanks!
1638632936
David M.
Pro
API Scripter
Erik, that seems to work for me, though the same random number will be added to each token. Also, if it is a persistent AoE it will not recalculate for each triggering event as the inline roll is processed before it is sent to the script.
David M. said: Hmm, the script doesn't currently support "wide" walls out of the box. I'll have to think about how best to implement that. Off the top of my head, it's possible that a new aoeType ("wall, <width>") might not be too hard, with the idea that it would create two endpoint control tokens, use the "line" algorithm, and add squares to left/right or top/bottom depending on the relative positioning of the control tokens.  Until I can figure something out, the only thing I can think of is an extremely fiddly and non-ideal solution. 1) Spawn three copies of AoEControlToken using the SpawnDefaultToken script, e.g !Spawn {{ --name|AoEControlToken --qty|3 --offset|1,-1 --placement|grid 1 }} 2) For each of these, make a SmartAoE line effect. You'd have to explicitly note the character name for the DC or hardcode it, as using @{selected...} wouldn't work. The example below uses 5e attributes (I'm not sure which system you are using). EDIT - Looks like I left the --ignore subcommand in there that I use for my personal games (my players like to roll their own saves). You can delete this or replace with your own "ignore" attribute/val.  !smartaoe {{ --title|Wall of Fire --leftsub|Slot level ?{Cast at what level?|4|5|6|7|8|9} --rightsub|DC @{Trix|spell_save_dc} DEX --aoeColor|#99000050 --gridColor|#99000050 --aoeType|line --radius|60ft --fx|burn-fire --dc|@{Trix|spell_save_dc} --saveFormula|5eDEX --damageFormula1|[[(1+?{Cast at what level?})d8]] --damageType1|Fire --ignore|SmartAoE_Ignore,1 --autoApply|1 --bar|1 --zerohpmarker|dead }} Lots of clicking, and you'd have to trigger each "line" separately. Like I said, very fiddly and probably not worth it IMO, but here's an example of what I'm describing (click to play gif) Hi David, Thanks so much for your reply! The issue with this work-around is that the damage rolls separately for all 3 lines, rather than for the spell as a whole. I know absolutely nothing about code or API writing but is there any way to create a rectangle template? A 15x60ft rectangle would cover the spell AoE perfectly. Thanks again for your help
1638650908
David M.
Pro
API Scripter
Andy, correct that is one of the reasons why I mentioned that it probably wasn't worth the trouble :). It was just the closest that we could get without changes to the code. My current plan is to create a "wall" aoeType (or possibly a "line, float"?) which would also include a width parameter. The radius parameter would work as normal for the length of the line. The thought was that the script would create two  control tokens (one for each endpoint of the wall) which could be positioned independently. I should be able to start working on it tomorrow, and I'll know more at that point what kind of "gotcha's" I might be facing. Stay tuned!
David M. said: Erik, that seems to work for me, though the same random number will be added to each token. Also, if it is a persistent AoE it will not recalculate for each triggering event as the inline roll is processed before it is sent to the script. Hmm, I'll make sure my code is correct then. Thanks!
Another quick question, does anyone have a full list of the FX types and colours in this script?
1638743444
David M.
Pro
API Scripter
The colors can be found here: The types (also found in that fx dialog) that work for all aoeTypes are Bomb, bubbling, burn, burst, explosion, glow, and nova. For line AoE types, the others will also work (though they are not very accurate or flexible, imo), so I would avoid them
Erik M. said: David M. said: Erik, that seems to work for me, though the same random number will be added to each token. Also, if it is a persistent AoE it will not recalculate for each triggering event as the inline roll is processed before it is sent to the script. Hmm, I'll make sure my code is correct then. Thanks! Hah! I forgot to set autoapply to true to mark everybody.  So another fun one for you (and feel free to tell me that this is too much to put in the script and to just go away LOL): I am using this for some automatic fire weapons as they are basically just cone AOEs. I've set the attack roll as the DC and the AC as the save roll (--dc|[[1d20 + 6]] --saveformula|<<0d0 + a{eac}>>), but would there be a way to have a separate attack roll (DC) for each target in the AOE?
1638834141

Edited 1638834158
Is it possible to set the color of the AOE based on the players default Roll20 color?
1638839889
David M.
Pro
API Scripter
@Erik , Multi-attack is something that I eventually wanted to look into with this script, but I've avoided it so far because though it sounds very simple it surprisingly will be kind of a pain with the current workflow. It's also likely something of an edge case for most tables, so I think there are some other things that would be a bigger bang for the buck ahead of it on the list. TLDR - I'll most likely tackle this but just not in the immediate near term.  @Will , That shouldn't be too hard. I'll look at rolling this into my walls update*** *** FYI I hammered out the walls code all Sunday afternoon and then realized after getting it "working" that my shortcut approach (adding "width" to line AoE's) was flawed from a geometric standpoint (producing skewed parallelogram-like AoE's when non-orthogonal) so I had to scrap it. Sigh. Gonna have to go the rectangle route and start rotating coordinate systems, etc. Will probably be next weekend before I get this out. 
David M. said: @Erik , Multi-attack is something that I eventually wanted to look into with this script, but I've avoided it so far because though it sounds very simple it surprisingly will be kind of a pain with the current workflow. It's also likely something of an edge case for most tables, so I think there are some other things that would be a bigger bang for the buck ahead of it on the list. TLDR - I'll most likely tackle this but just not in the immediate near term.  Thanks, David. I'll just stick with my scriptcard for now or just avoid giving out those weapons! :D
1638896816
Surok
Roll20 Production Team
Hey Dave sorry if this is too much scope creep but I wondering if this API could be adopted to perform melee attacks that automatically references the target's AC and then handle the attack rolls, finally apply the damage.
1638900555
David M.
Pro
API Scripter
This is technically already possible for single targets, using the approach that Erik M. gave above. See the caveats for multiple targets above in Erik's post and my response.  For SmartAoE, the "DC" would be the target armor class and the saveFormula would be the selected token's attack formula. Then you would create an aoe with the appropriate range and using   --controlTokName|self. Then, to trigger, use something like this, requiring you to select the target token again: !smartquery @{target|Choose a Target|token_id}  This being said, I think there are easier methods, as there is a lot of overhead in this approach (every token would have these AoE squares following them around on the map, plus a fair amount of clicking).  If you are looking for more weapon attack automation, I might recommend a Scriptcards solution instead. Here's an example of a longsword scriptcard macro from the wiki. This particular one uses alter bars but could easily be modified for token-mod if you wanted. I will also PM you a scriptcard for an example 5e Firebolt spell that takes into account target resistance/vulnerability, etc. Not posting it here to avoid sidetracking this thread.
Yeah I only use the attack roll this way because there are some AOEs in Starfinder that use a single attack roll for all targets in the area. I used to have a  huge ScriptCard for this, but with David's script it shrinks it to just a couple lines. 
David M. said: @Will , That shouldn't be too hard. I'll look at rolling this into my walls update*** *** FYI I hammered out the walls code all Sunday afternoon and then realized after getting it "working" that my shortcut approach (adding "width" to line AoE's) was flawed from a geometric standpoint (producing skewed parallelogram-like AoE's when non-orthogonal) so I had to scrap it. Sigh. Gonna have to go the rectangle route and start rotating coordinate systems, etc. Will probably be next weekend before I get this out.  Ooof, sorry David, didn't mean to cause too much extra work for you. Thank you so much for all your help with this script, it's made my life as a DM much easier and my Warlock is super stoked to burn things!
1639337784

Edited 1639338026
David, this script is fantastic! And thank you for including support for Pathfinder measurements. Those can be tricky to deal with, especially since smaller AoE's behave a little differently than larger ones. If you don't mind, may I suggest changing the terminology for some of the shapes for PF so it's clear what each shape is intended for? For example, Circles that center on a corner are referred to as Bursts in PF, and the accompanying size refers to the radius rather than the diameter, so the 10ft-PF-Circle would better be listed as 5ft-PF-Burst. Caster-centered circles are called Emanations in PF, so I also changed all the __ft-PF-Circle-Caster abilities to __ft-PF-Emanation. I set up my menu to list the most common sizes for these AoEs, shown in the screenshot below: I also made a few adjustments to the smaller AoEs so they behaved as intended, namely the 5ft-Emanation and the 15ft-Cone. The emanation was only highlighting the squares orthogonally adjacent to the caster token. I changed it to highlight all eight adjacent squares: 5ft-PF-Emanation !smartaoe {{ --aoeType|PFcircle, float --controlTokName|self --radius|6ft --minGridArea|0.5 --forceIntersection|0 --fx|burn-fire }} The 15-ft cone is a bit different from larger cones. It originates from the nearest corner or face, rather than just the nearest corner, so I set it up as follows: 15ft-PFCone !smartaoe {{ --aoeType|PFcone --radius|15ft --origin|nearest, face --forceIntersection|0 --minGridArea|0.50 --fx|burn-fire }} Again, thanks for your hard work and I hope this feedback is helpful!
1639342860
David M.
Pro
API Scripter
Thanks, Persephone! I didn't really expect folks to use the auto-installed AoEGenerator macro as-is. It's more of a soft introduction to the script and a general template for people to modify and tailor to their own needs if they want. Your PF-specific chat menu is a perfect example of that!. Regarding naming, I intentionally kept the macro's category header language generic and relative to the script's syntax to try get people more comfortable with how the different aoeTypes relate to each other. I know there is already a lot to wrap one's head around when first using the script. The "PFcircle" type is always going to apply the same mathematical rules regardless of radius, which is not always going to jive with actual PF AoE's because they are not actually mathematically consistent. For a 5ft emanation in PF, I would actually just use the standard "circle" aoeType and adjust the minGridArea, like this: !smartaoe {{ --aoeType|circle, float --controlTokName|self --radius|5ft --minGridArea|0.25 --forceIntersection|0 --fx|burn-fire }} This keeps the AoE overlay radius from extending out past one square like it does with a 6ft radius. I should probably update the default chat menu PF 5ft circle ("emanation") to this to avoid future "bug reports". Also, thanks for the heads-up about the 15ft cone. I'll be sure to update the default chat menu code for that one to the macro you listed. I appreciate the comments!
Oh, that makes sense! and thanks for that fix for the emanation, that's a much cleaner solution :)
I'm not sure what's going wrong but when I use a rollable table in the damage formula it ignores the table and outputs the part before it. For example, I created a rollable table called d6min2 so it would roll 1s and 2s as 2s for damage; [[ (4+3)t[d6min2] ]] and it works perfectly fine in chat but the output from the script macro only gives 7 damage.
1639592677
David M.
Pro
API Scripter
Doug, you aren't doing anything wrong. I switched to using the libInline utility script to process inline rolls rather than my usual method, as it provided some additional capability that SmartAoE required. It was my first using it, however, and I think I need to use some additional functions from that utility script to also handle rollable tables. I'll put it on the to-do list!
1639593624
David M.
Pro
API Scripter
On another note: I *am* still working on the "wall" AoE type. Without going into details, I'm currently trying to manage some inconsistent behavior caused (I believe) by floating point rounding errors. Just wanted to give an update since I had previously implied that this would likely be done by now.
No worries. For now I'll use the keep highest formulae. Loving the script, BTW. David M. said: Doug, you aren't doing anything wrong. I switched to using the libInline utility script to process inline rolls rather than my usual method, as it provided some additional capability that SmartAoE required. It was my first using it, however, and I think I need to use some additional functions from that utility script to also handle rollable tables. I'll put it on the to-do list!
1639709534
David M.
Pro
API Scripter
Nick O. YouTube video is live! Hey guys, Nick Olivo created a video on his channel that gives a great intro to the script and a walkthrough of simulating a specific 5e spell effect (Shatter). Check it out  here !
I just installed  SmartAoE.js   --bar now accepts multiple values. Minor bug fix for large tokens 18 days ago --bar now accepts multiple values. Minor bug fix for large tokens 18 days ago as well as    libInline SmartAoE.js --bar now accepts multiple values. Minor bug fix for large tokens 18 days ago Upon starting the game the api crashes with the following message. SyntaxError: Invalid or unexpected token
1639743236
David M.
Pro
API Scripter
Daryl, I just want to clarify: You only installed install two scripts, right? SmartAoE.js, found here libInline, from the one-click repository You linked the GitHub changelog a few times. Just want to make sure that you didn't try to install those :) If you keep having issues, I can take a look for you if you invite me to your game and promote me to GM.
Dave, Thanks for the help. Replaced the script I had with the script from above and seems to be working. The api basically only does graphics until I enter a macro for each spell. A couple questions. Once I get the macro set up does the spell slot tracking still track? And if I am setting up cantrips are they represented as o as far as level.
1639779527
David M.
Pro
API Scripter
The current version does not reduce spell slots, but resource management is something that is on my list of things to add. Stay tuned for updates, as I plan to start working on this after the next release (which is looking like this weekend). 
hello im super new to this. i love this script and i'm trying to make a macro for the spike growth spell. can anyone help please.  this is what i've done so far !smartaoe {{   --title|Spike Growth   --leftsub|Slot level 2   --rightsub|no save   --titlecardbackground|linear-gradient(#af70c2, #e0cce6)   --oddrowbackground|#af70c2   --evenrowbackground|#e0cce6   --oddrowfontcolor|#000000   --tablebgcolor|#e0cce6   --aoeColor|#bd39e650   --aoeOutlineColor|#9611bf   --aoeType|square, float   --radius|20ft   --minTokArea|0.25   --fx|Explosion-smoke   --noSave|1    --damageType1|Piercing   --damageformula1|[[2d4]]   --ignore|SmartAoE_Ignore,1   --autoApply|1   --bar|1   --zeroHPmarker|dead   --desc|The area becomes difficult terrain for the duration. When a creature moves into or within the area, it takes 2d4 piercing damage for every 5 feet it travels. Any creature that can't see the area at the time the spell is cast must make a Wisdom (Perception) check against your spell save DC to recognize the terrain as hazardous before entering it.. }} mostly cutting and pasting 
Oh nice. For now, I'm making the spells in the spell tab output to Spellcard and my token action macro calls the spell macro, so the companion script deducts the spell slot (or gives the warning if you are all out of spell slots for that level), then runs the !smartaoe macro. This has the advantage that the spell can be aborted if no spell slots are available. I'll be posting some of my macros to share with people this weekend. David M. said: The current version does not reduce spell slots, but resource management is something that is on my list of things to add. Stay tuned for updates, as I plan to start working on this after the next release (which is looking like this weekend). 
1639832202
David M.
Pro
API Scripter
Christian, I was waiting for the first question about Spike Growth, lol. Spike Growth is one of those "weird" mechanics spells that doesn't quite blend nicely within the structure of this script at the moment. Just adding a query for num squares moved to damageFormula1 doesn't work because the query gets processed before it is sent to the script. My recommendation would be one of the following: 1) Just use the script for creating the AoE and use a separate macro that calculates [[[[2*?{Num squares?|1}]]d4]] 2) Use what you have, but remove the desc portion of the output to reduce the footprint. Then when a creature moves through the area, select the AoEControlToken and use the "Trigger Target" token action to apply the damage to only that creature. Caveats are that you would have to trigger it before they leave the Area, and you'd have to repeat the process once for each square they went threw. Obviously that could be tedious, clicky, and chat-spammy for a creature that ran through a bunch of squares. Option 1 is honestly how I would do it for now. At some point I'm going to look into adding the delayed parsing ability using deferral characters that --saveFormula uses to allow syntax say like this  --damageFormula1|<<<<2*Q{Num squares?|1}>>d4>> , where "Q{" would be replaced with "?{" for the trigger event, "<<" becomes "[[", etc. Interestingly, this would also enable a multi-attack type AoE (like a shotgun) that would use individual AC's for each creature (see Erik M.s comments at the end of this post  for more info on that).
1639832352

Edited 1639834399
David M.
Pro
API Scripter
Doug E. said: Oh nice. For now, I'm making the spells in the spell tab output to Spellcard and my token action macro calls the spell macro, so the companion script deducts the spell slot (or gives the warning if you are all out of spell slots for that level), then runs the !smartaoe macro. This has the advantage that the spell can be aborted if no spell slots are available. I'll be posting some of my macros to share with people this weekend Another option until this capability is added would be to use a Scriptcard to check and deduct spell slots, then call SmartAoE from the scriptcard if resources were available. EDIT - It would look like a god-awful mess, though, since Scriptcards doesn't support multi-line processing of the triggered script. So, you could have 20+ params all jammed up in a single wrapped line. EDIT 2 -  Actually, just chatted with Kurt and he came up with a clever way to allow multi-line support using Scriptcards with the current version. I'll make a post this weekend with an example, but it basically uses a string variable substitution for the "inner" double brackets. Which reminds me, Will M had asked for a Scriptcard example a while ago which fell off my radar. Sorry, Will!
Hi all,  I found this script due to Nick Olivo's video and i like what it does.  I have a question, which i may have missed being answered elsewhere.  I'm trying to set up the Icestorm from the wiki but want to use a custom token.  I set up a character sheet called Ice Storm and used a spell token i had picked up from the market place but i get the following error    Unable to find imgsrc for default token of (iceStorm) You must use an image file that has been uploaded to your Roll20 Library So are we only able to use token images we upload ourselves or am I missing something from my setup (which is likely as i am new to this)
1639834058
David M.
Pro
API Scripter
Yes, that is a limitation for any API script. Roll20 only allows image files from your personal library to be generated on the map. You *could* drop the image on a map, press "Z", and right click -> "Save As", then re-upload to your art library. A bit tedious if you have a bunch of art you want to convert, but it works.
thanks for confirming David
thank you so much David. i'll use op 1 the script is cool man thanks again..
1639926558

Edited 1639926821
David M.
Pro
API Scripter
Version Update v0.24 - Walls! - found  here 1) Added the "wall" aoeType . This keyword will spawn two control tokens: one will act as the "origin" and one will act as a normal control token (determining angle of the wall).      --aoeType|wall The default width of the wall is 1square. To change the wall to a larger value, use the --width subcommand, something like this:     --width|15ft     --width|3u Depending on the width of the wall, certain default behaviors are established. These can be overriden by the --forceIntersection subcommand, but I don't recommend it, as it will probably result in a larger area than you want.      ---> For a width of an odd number of squares, the control tokens will snap to the center of the grid square, and the AoE will originate from the nearest face or corner of the "origin" control token.      --->  For a width of an even number of squares, the control tokens will snap to nearest intersection  of the grid squares, and the AoE will originate from the center of the origin token. Example for 5e Wall of Fire. The wall is technically only 1ft wide, but it affects creatures within it's square and within 10ft of one side, giving it an effective width of 15ft. Click to play animation: !smartaoe {{ --title|Wall of Fire --leftsub|Slot level ?{Cast at what level?|4,4|5,5|6,6|7,7|8,8|9,9} --rightsub|DC @{selected|spell_save_dc} DEX --aoeType|wall --offset|1,0 --minGridArea|0.5 --radius|30ft --width|3u --fx|burn-fire --dc|@{selected|spell_save_dc} --aoeColor|player --aoeOutlineColor|#990000 --damageFormula1|[[(1+?{Cast at what level?})d8]] --saveFormula|5eDex --autoApply|1 --bar|1 --zeroHPmarker|dead }} 2) Added the ability to set the AoE outline and fill colors to the default "player" color . For example:     --aoeColor|player     --aoeOutlineColor|player 3) Bug fix for line AoE's passing through large tokens. Previously in some cases (typically orthogonal or near-orthogonal angles), tokens of size 3x3 or greater were not being included in effect. 4) Bug fix for certain instances where using an --offset would incorrectly fail to spawn the control token, giving an error msg of "The provided offsets would spawn the controlToken off the map!"   5) Support for inline rollable tables. e.g.   --damageFormula1|[[ 1t[tableName] ]] 6) Changed the pre-configured ability for 15ft PF cone (called by the auto-installed "AoEGenerator" macro) to more accurately reflect the ruleset. If you already have installed the script and want the ability updated, you will have to delete your AoEControlToken character and restart your sandbox with the latest script version to have the script generate a new one.
1639954924
David M.
Pro
API Scripter
SmartAoE via Scriptcards Ok, I finally got around to getting a SmartAoE via Scriptcard example. I decided to use the 5e spell Dragon's Breath, as it can produce a variable damage type (cold, fire, poison, etc.). Based on the damage type, the color of the AoE and the SmartAoE title card will vary, as well as the fx spawned. Also, this scriptcard will check for remaining spell slots of the appropriate level and deduct them using the ChatSetAttr script (useful until SmartAoE can support resource management on its own. You can use a similar process to substitute whatever variable you want with your scriptcard logic. Prerequisite api scripts: SmartAoE (libInline), Scriptcards, SelectManager, ChatSetAttr Note:  I used the << >> substitutions for [[ ]] in the damageFormula1 subcommand in order to preserve the tooltip. !script {{ --&brace|{ --&cbrace|} --#emoteState|0 --#sourcetoken|@{selected|token_id} --#title|Spell Slots Remaining --:USER QUERIES --&level|?{Cast at what level?|1,1|2,2|3,3|4,4|5,5|6,6|7,7|8,8|9,9} --&damageFormula1|<<(?{Cast at what level?}+2)d6>> --&damageType1|?{Damage Type?|acid,acid|cold,cold|fire,fire|lightning,lightning|poison,poison} -->GetAndCheckSlotInformation| --:CHANGE COLORS AND OUTPUT BY DAMAGE TYPE --?[&damageType1] -eq acid|[ --&aoeColor|#00ff0050 --&aoeOutlineColor|#00ff00 --&fx|burn-acid --&titlecardbackground|linear-gradient(lime, black) --]| --?[&damageType1] -eq cold|[ --&aoeColor|#00ffff50 --&aoeOutlineColor|#00ffff --&fx|burn-frost --&titlecardbackground|linear-gradient(#00ffff, black) --]| --?[&damageType1] -eq fire|[ --&aoeColor|#ff000050 --&aoeOutlineColor|#ff0000 --&fx|burn-fire --&titlecardbackground|linear-gradient(red, black) --]| --?[&damageType1] -eq lightning|[ --&aoeColor|#4a86e850 --&aoeOutlineColor|#4a86e8 --&fx|burn-frost --&titlecardbackground|linear-gradient(#4a86e8, black) --]| --?[&damageType1] -eq poison|[ --&aoeColor|#20872850 --&aoeOutlineColor|#208728 --&fx|burn-acid --&titlecardbackground|linear-gradient(#208728, black) --]| --:BUILD SMARTAOE MACRO AND TRIGGER --@forselected|smartaoe [&brace][&brace] _title|Dragon's Breath _leftsub|Slot level [&level] _rightsub|DC @{selected|spell_save_dc} DEX _subtitlefontcolor|#ffffff _titlecardbackground|[&titlecardbackground] _aoeType|5econe _radius|15ft _origin|nearest, face _minGridArea|0.25 _minTokArea|0.25 _fx|[&fx] _dc|@{selected|spell_save_dc} _saveFormula|5eDEX _aoeColor|[&aoeColor] _aoeOutlineColor|[&aoeOutlineColor] _damageFormula1|[&damageFormula1] _damageType1|[&damageType1] _instant|1 _ignore|party_member,1 _autoApply|1 _bar|1 _zeroHPmarker|dead _desc|You touch one willing creature and imbue it with the power to spew magical energy from its mouth, provided it has one. Choose acid, cold, fire, lightning, or poison. Until the spell ends, the creature can use an action to exhale energy of the chosen type in a 15-foot cone. Each creature in that area must make a Dexterity saving throw, taking 3d6 damage of the chosen type on a failed save, or half as much damage on a successful one. [&cbrace][&cbrace] --X|End Macro --:PROCEDURES| --:GetAndCheckSlotInformation| --=SlotLevel|[&level] --=SlotsTotal|[*S:lvl[$SlotLevel]_slots_total] --=SlotsExpended|[*S:lvl[$SlotLevel]_slots_expended] --?[$SlotsExpended.Total] -eq 0|>NoSlotsLeft --?[$SlotsExpended.Total] -gt [$SlotsTotal.Total]|>NoSlotsLeft -->DeductSpellSlot| --<| --:DeductSpellSlot| --=SlotsExpended|[$SlotsExpended] -1 --@setattr|_charid [*S:character_id] _lvl[$SlotLevel]_slots_expended|[$SlotsExpended] _silent --=SlotsRemaining|[$SlotsTotal] - 1 --+|[c][b]Level [$SlotLevel] Spell Slots Left: [/b][$SlotsExpended][/c] --<| --:NoSlotsLeft| --+|[b][*S:character_name] has no level [$SlotLevel.Total] spell slots available.[/b] --X|NoSlotsLeftStop --<| }} Example output cold damage, level 2 slot poison damage, level 1 slot
Oh how sweet - This lets you combine all the capabilities of Scriptcards with the output and mechanics of AoE!
I should start by saying I was doing coding before windows (Dos, fttp, c+) due to being leagally blind, sugering form tbi and cancer treatments. I am not as sharp as when I was younge. I was able to get my first 3 Spells to work but this one is bafleing me.  That being said any help would be appriciated. Can any one tell me why this macro dosen't work.  !smartaoe {{   --title|Mind Sliver   --leftsub|Slot level ?{Cast at what level?|1|2|3|4}   --rightsub|DC @{selected|spell_save_dc} INT   --titlecardbackground|linear-gradient(purple, cyan)      --oddrowbackground|#00ccff   --evenrowbackground|#edfcfc   --oddrowfontcolor|#000000   --tablebgcolor|#edfcfc      --controlTokName|AoEControlToken   --controlTokSize|1      --aoeColor|#00ccff50   --aoeOutlineColor|#0099ff   --aoeType|circle, float   --radius| 05ft   --minGridArea|0.25   --minTokArea|0.25      --fx|glow-magic   --dc|@{selected|spell_save_dc}   --saveFormula|?{SaveType|Normal,5eINT|Advantage,<<2d20kh1 + a{intelligence_save_bonus}>>|Disadvantage,<<2d20kl1 + a{intelligence_save_bonus}}>>}      --damageFormula1|[[(?{Cast at what level?})d6]]   --damageType1|Magic   --instant|1      --autoApply|yes   --bar|1   --zeroHPmarker|dead      --desc|You drive a disorienting spike of psychic energy into the mind of one creature you can see within range. The target must succeed on an Intelligence saving throw or take 1d6 psychic damage and subtract 1d4 from the next saving throw it makes before the end of your next turn. This spell's damage increases by 1d6 when you reach certain levels: 5th level 2d6, 11th level 3d6, and 17th level 4d6. }}
1639970764
David M.
Pro
API Scripter
Daryl, looks like the problem is in your --saveFormula. Within a query like that, you'll need to use the html replacement  }  for the closing brackets  }  of the attribute. Otherwise the Roll20 parser thinks you've reached the end of the query prematurely. I'm assuming you copied this part from Nick's YouTube video Shatter spell. When he pasted his macro code into GitHub, it converted the html replacements without his knowledge. I think he's corrected it, but you may have grabbed it before it was corrected. Try the following:    --saveFormula|?{SaveType|Normal,5eCON|Advantage,<<2d20kh1 + a{intelligence_save_bonus}>>|Disadvantage,<<2d20kl1 + a{intelligence_save_bonus}>>}  Although, personally I just go with the simpler  --saveFormula|5eINT  route, to avoid ugly html replacements and the typos/auto-conversion that often accompanies them. It's also less clicking 99% of the time by removing that query. I'd rather spend 30seconds rolling again and manually correcting the hp once every 10 sessions than deal with the extra clicks every other time. Though in my games it is the rare exception that saving throws are modified, so your mileage may vary.  On another minor note, if you want there to be an actual line break in your description field before the "higher level casting" line, use the code %br%  once or twice to insert the linebreak(s), as otherwise typed carriage returns are ignored. So your description field might read like this: --desc|You drive a disorienting spike of psychic energy into the mind of one creature you can see within range. The target must succeed on an Intelligence saving throw or take 1d6 psychic damage and subtract 1d4 from the next saving throw it makes before the end of your next turn. %br%%br% This spell's damage increases by 1d6 when you reach certain levels: 5th level 2d6, 11th level 3d6, and 17th level 4d6.
1639971303

Edited 1639971878
David M.
Pro
API Scripter
To follow up on the "Dragon's Breath" scriptcard&nbsp;above, I've made some custom title backgrounds that I uploaded to my library and added to the conditionals section to spice up the chat output. Here's another option if folks want to play with it. I believe it should work unless I delete them from my library (which I don't plan on doing)&nbsp; &nbsp; --?[&amp;damageType1] -eq acid|[ --&amp;aoeColor|#00ff0050 --&amp;aoeOutlineColor|#00ff00 --&amp;subtitlefontcolor|#000000 --&amp;fx|burn-acid --&amp;titlecardbackground|url('<a href="https://s3.amazonaws.com/files.d20.io/images/261004638/sSCZDmBZmes3V1Ewlbv-Cg/max.jpg?1639962320');background-size" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/261004638/sSCZDmBZmes3V1Ewlbv-Cg/max.jpg?1639962320');background-size</a>: 100% 100%; background-repeat: no-repeat --]| --?[&amp;damageType1] -eq cold|[ --&amp;aoeColor|#00ffff50 --&amp;aoeOutlineColor|#00ffff --&amp;subtitlefontcolor|#000000 --&amp;fx|burn-frost --&amp;titlecardbackground|url('<a href="https://s3.amazonaws.com/files.d20.io/images/261004637/4EFuFHt5OlXpSJy7ZfeA2Q/max.jpg?1639962320');background-size" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/261004637/4EFuFHt5OlXpSJy7ZfeA2Q/max.jpg?1639962320');background-size</a>: 100% 100%; background-repeat: no-repeat --]| --?[&amp;damageType1] -eq fire|[ --&amp;aoeColor|#ff000050 --&amp;aoeOutlineColor|#ff0000 --&amp;subtitlefontcolor|#000000 --&amp;fx|burn-fire --&amp;titlecardbackground|url('<a href="https://s3.amazonaws.com/files.d20.io/images/253615223/QhQiZxJ2ufS_ry8uXVYPLQ/max.png?1635890238');background-size" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/253615223/QhQiZxJ2ufS_ry8uXVYPLQ/max.png?1635890238');background-size</a>: 100% 100%; background-repeat: no-repeat --]| --?[&amp;damageType1] -eq lightning|[ --&amp;aoeColor|#4a86e850 --&amp;aoeOutlineColor|#4a86e8 --&amp;subtitlefontcolor|#000000 --&amp;fx|burn-frost --&amp;titlecardbackground|url('<a href="https://s3.amazonaws.com/files.d20.io/images/261004639/m2UaTAp9gpMAFGX32BgySQ/max.jpg?1639962320');background-size" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/261004639/m2UaTAp9gpMAFGX32BgySQ/max.jpg?1639962320');background-size</a>: 100% 100%; background-repeat: no-repeat --]| --?[&amp;damageType1] -eq poison|[ --&amp;aoeColor|#20872850 --&amp;aoeOutlineColor|#208728 --&amp;subtitlefontcolor|#ffffff --&amp;fx|burn-acid --&amp;titlecardbackground|url('<a href="https://s3.amazonaws.com/files.d20.io/images/261004636/pbs4ElLQsK4cTfYlr4gg1g/max.jpg?1639962320');background-size" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/261004636/pbs4ElLQsK4cTfYlr4gg1g/max.jpg?1639962320');background-size</a>: 100% 100%; background-repeat: no-repeat --]| This would also require changing the _titlecardbackground line of the actual SmartAoE call to this: &nbsp; _titlecardbackground|[&amp;titlecardbackground] If you want to make your own backgrounds in GIMP or Photoshop, I recommend using a 6:1 aspect ratio. Then upload to your art library, drag to the map, select the token and run this api script written by TheAaron by typing&nbsp;!GetTokenUrl in chat. Then, just paste that URL between the single quotes in my example above. I have this as a button on my macro bar.
Dave,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Thanks that woks. Not sure why but the roll20 interface appearantly does not like the code&nbsp; &amp;#125;&nbsp; . I had noticed thes before.I put it in and save the macro. great everything works until I open the macro for any reason and it resets/replaces thhe code with the bracket.&nbsp; Dave, Thanks that woks. Not sure why but the roll20 interface appearantly does not like the code } . I had noticed thes before.I put it in and save the macro. great everything works until I open the macro for any reason and it resets/replaces thhe code with the bracket. Even here when I copy and paste the line roll20 resets the line.
Hi, I've installed the script and te token is in the character list...but when I attempt to use it nothing happens, I've trialled all athe sample macros and the token doesn't pop onto the map screen.
1640003626
GiGs
Pro
Sheet Author
API Scripter
Daryl C. said: Dave,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Thanks that woks. Not sure why but the roll20 interface appearantly does not like the code&nbsp; &amp;#125;&nbsp; . I had noticed thes before.I put it in and save the macro. great everything works until I open the macro for any reason and it resets/replaces thhe code with the bracket. This is a thing about roll20. If you use any html entities like &amp;125; they will work fine. But if you open the macro cojtaining them, roll20 will parse them and convert them into the characters they represent. So when using such characters in a macro, do not reopen the macro. Alternatively, if you save the macro in a character ability, roll20 doesnt do this. This is one reason lots of people use a "macro mule" character. rework your macros so they work in the context of a character, and save them as abilities on a character called something like Macros. If you make this character Editable by All PCs, but Visible to none, players can use the abilities (calling them with %{macros|macro-name}), but can't edit the character. Another advantage of this method: you can transfer macros from one campaign to another by just transferring the character over, which means you don't have to recreate the macros in each campaign.