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

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

hello, i've been working on making some spells whit the smartaoe but also each whit there own uniqe controle token. this brings me to my problem at hand, i'm making cloud of daggers whit a dagger based controle token however when i use the macro it summons the controle token but whiteout the options to trigger it in the corner. when i use !smarttrigger it does trigger the spell but also effects the controle token. did i miss something  or is there something wrong whit the token it self? my script: !smartaoe {{   --title|Cloud of Daggers   --leftsub|Slot level ?{Cast at what level?|2,2|3,3|4,4|5,5|6,6|7,7|8,8|9,9}   --titlecardbackground|linear-gradient(blue, white)   --oddrowbackground|#00ccff   --evenrowbackground|#edfcfc   --oddrowfontcolor|#000000   --tablebgcolor|#edfcfc     --controlTokName|AoEControlTokenCloudofDagger   --controlTokSize|1   --aoeColor|#ffffff   --aoeOutlineColor|#ffff00   --aoeType|square, float   --radius|3ft   --forceIntersection|0   --minGridArea|0.25   --minTokArea|0.25   --fx|bomb-blood   --noSave|1   --damageFormula1|[[[[?{Cast at what level?|2|3|4|5|6|7|9}*2]]d4]]   --damageType1|slashing   --autoApply|1   --bar|1   --zeroHPmarker|dead   --desc|You fill the air with spinning daggers in a cube 5 feet on each side, centered on a point you choose within range. A creature takes 4d4 slashing damage when it enters the spell's area for the first time on a turn or starts its turn there. At Higher Levels: When you cast this spell using a spell slot of 3rd level or higher, the damage increases by 2d4 for each slot level above 2nd. }} thanks in advance for anyonce time
1704231504
David M.
Pro
API Scripter
Xinx, since you are using a custom control token, you will need to manually add a character ability (macro) for the !smarttrigger command and make it a token action for that character sheet. The default control token already has this added during the script install. Be sure to put it on the character sheet in the attributes and abilities tab and not as a general collections macro. Otherwise, the token action will show up for every token in the game.
Hi and Happy new Year ! I can't seem to find my answer in the forum or in the wiki. I thought i read somewhere that it was now possible to affect a width to a line AoE. Am I wrong ? (Gust of wind Spell use...) I'd prefer to use a 2u line from the caster than a 2u wall with the 2 tokens to move to definbe the Aoe... Or could we use a controltoken|self to define this Aoe ?
1704415758
David M.
Pro
API Scripter
Denis, unfortunately the only way to do this is with a "wall" type. I couldn't come up with a satisfactory solution for a wide line emanating from the caster token. The wall control token can be made to lie on an intersection (enabling a 2-sq region), but that is obviously not appropriate for a caster token. A control token lying within a square could make an odd width, but even width lines would not work. Sometimes you'd want the extra width above and sometimes below, and wouldn't necessarily know this when cast. That's a long-winded explanation, but to summarize: I don't see this being an option any time soon. 
ok thanks for the answer.
David M. said: Xinx, since you are using a custom control token, you will need to manually add a character ability (macro) for the !smarttrigger command and make it a token action for that character sheet. The default control token already has this added during the script install. Be sure to put it on the character sheet in the attributes and abilities tab and not as a general collections macro. Otherwise, the token action will show up for every token in the game. thank you for pointing that out i've added them to the token however after doing so the following error is given everytime i try to use set macro TypeError: Cannot read properties of undefined (reading '0') TypeError: Cannot read properties of undefined (reading '0') at apiscript.js:6886:156 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) is this because of the macro or a interaction between other AIP's? to incluse the other API's i use: apply damage, concentration, liblnline, smartAOE, inisative tracker plus and aura/tint healthcollors thanks in advance for any time and help
1704660924
David M.
Pro
API Scripter
Hmm, that error does not seem to be coming directly from SmartAoE. I've seen that ProcessTicksAndRejections error before, but I thought it was somehow related to character sheets. I tried your macro in my test game after creating a and it seemed to work fine. Do you get the error if you just use the default control token?
no indeed i found what was giving me the error. i used a spell token i bought from the market place and used that one but it doesn't wanna register it. after having downloaded the art of the same token using the url then plasing down the downloaded version it works as intened whit one drawback that when i trigger the daggers it also effects the 'controle token' itself even if i place the ignore command down but i can live whit that.
1704867461

Edited 1704867738
Ergo
Pro
I am having trouble with the script. It works on one of my other game, but when In stalled it on a new game it seems to not be working. I am sure the problem exists between the elbows and the keyboard. I run a a macro and it asks for the level and damage type.... then nothing. No errors, no token....nothing. The control token is in the same folder as the players and has sight enabled. I am at a loss here, any help would be appreciated. TIA I just got this error: Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your script's code and click the "Save Script" button. We will then attempt to start running the scripts again.  More info...  If this script was installed from the Mod Library, you might find help in the Community API Forum. For reference, the error message generated was:  Possible infinite loop detected, shutting down.
1704888103
David M.
Pro
API Scripter
Ergo, yep your sandbox crashed. Not necessarily SmartAoE related. It was likely already crashed before running your macro. If crashed, you will still get query prompts since queries are processed before api commands due to Roll20 order of operations.  When you restart the sandbox does it keep crashing when you run your macro?
1704901431

Edited 1704923948
Ergo
Pro
David M. said: Ergo, yep your sandbox crashed. Not necessarily SmartAoE related. It was likely already crashed before running your macro. If crashed, you will still get query prompts since queries are processed before api commands due to Roll20 order of operations.  When you restart the sandbox does it keep crashing when you run your macro? Alright it works on other pages. I have one page it refuses to work on.
1704925374
David M.
Pro
API Scripter
Do you have the grid enabled on the problem page? Grid is required for this script. If you don't want it visible, you can turn the opacity slider to 0.  If the grid isn't the issue, try making a copy of the problem page and testing it on the copy.
David M. said: Do you have the grid enabled on the problem page? Grid is required for this script. If you don't want it visible, you can turn the opacity slider to 0.  If the grid isn't the issue, try making a copy of the problem page and testing it on the copy. You my friend are a genius. Told you it was between the elbows and the keyboard.
Hey all, I am working with this script for few hours and can't figure out how to make it calculate dmg and saving throws. !smartaoe {{   --title|Fireball   --leftsub|Slot level ?{Cast at what level?|3|4|5|6|7|8|9}   --rightsub|DC @{selected|spell_save_dc} DEX   --titlecardbackground|linear-gradient(red, orange)   --oddrowbackground|#ff6600   --evenrowbackground|#edfcfc   --oddrowfontcolor|#000000   --tablebgcolor|#edfcfc      --controlTokName|AoEControlToken   --controlTokSize|1      --aoeColor|#ff3300   --aoeOutlineColor|#ffcc00   --aoeType|circle, float   --radius|20ft   --minGridArea|0.5   --minTokArea|0.25      --fx|burst-fire   --saveFormula|?{SaveType|Normal,5eDEX|Advantage,<<2d20kh1 + a{dexterity_save_bonus}>>|Disadvantage,<<2d20kl1 + a{dexterity_save_bonus}>>}     --damageFormula1|[[(?{Cast at what level?}+5)d6]]   --damageType1|Fire   --instant|1   --autoApply|yes   --bar|1   --zeroHPmarker|dead      --desc|A bright streak flashes from your pointing finger to a point you choose within range and then blossoms with a low roar into an explosion of flame. Each creature in a 20-foot-radius sphere centered on that point must make a Dexterity saving throw. A target takes 8d6 fire damage on a failed save, or half as much damage on a successful one. The fire spreads around corners. It ignites flammable objects in the area that aren't being worn or carried. At Higher Levels. When you cast this spell using a spell slot of 4th level or higher, the damage increases by 1d6 for each slot level above 3rd. }} When I cast fireball in empty space, it works. I get info with dmg and fx is working. If other player or monster is inside radius this is when I get this error: SmartAoE: Something went wrong when processing rolls. The error message generated by Roll20 is: SyntaxError: Expected "(", "f" or [0-9] but "E" found. It doesnt matter if this is player token, my custom token or token from ingame monster manual. I can't find solution anywhere and I am stuck on this for few hours and it drives me crayzy.
1705176097

Edited 1705176250
David M.
Pro
API Scripter
Ogapix, I think the problem is you are running into is related to your saveFormula query. Html substitutions are needed for the closing curly bracket at the end of each attribute reference. The Roll20 chat parser is seeing the first closing bracket and thinking it is the end of your query. This all happens before the SmartAoE script even runs, and the text string being sent to the script is malformed as currently written. Try this: --saveFormula|?{SaveType|Normal,5eDEX|Advantage,<<2d20kh1 + a{dexterity_save_bonus&#125>>|Disadvantage,<<2d20kl1 + a{dexterity_save_bonus&#125>>} EDIT - Unrelated, but I'd also recommend adding some transparency to your aoeColor so that you will still be able to see terrain and other features on your map layer. Something like this: --aoeColor|#ff3300 50
You were right and it is working now. Thank You very much. Do You know why spell save dc is not working properly? It always marks all saves as passed. Sorry to bother You so much. I have just started using API scripts and it's a bit overwhelming. For example when I chenged code and saved like You showed me, everything works. But when I open this macro again, code looses &#125 part and it looks like this:  --saveFormula|?{SaveType|Normal,5eDEX|Advantage,<<2d20kh1 + a{dexterity_save_bonus}>>|Disadvantage,<<2d20kl1 + a{dexterity_save_bonus}>>}  It goes back to the way it was before. And this is happening for brand new macro too. I have to copy whole thing again to make it working which leaves me puzzled.
Ok I have figured it out. Somehow I deleted line  --dc|@{selected|spell_save_dc} and did not see t at first :D It is working as intended, thank You for Your help!
1705238099
David M.
Pro
API Scripter
Glad you got the DCs working again. The html replacements reverting back to curly braces sounds like you are storing this macro on the Collections tab. That is an interesting quirk of Collections macros. They will use the html replacements as long as you never open the macro again, even if you don't save it . If the macro is stored as an ability on a character sheet, then the html replacements are preserved when opening again to view or edit. This is one reason why many people utilize the macro mule concept.
1705713415

Edited 1705715557
First - I love this script's interface and application. Thank you for your hard work in developing it! I have what most likely ends up as a niche question. Is there a method for either reading out the tokens selected to another script or calling a damage formula from "elsewhere". Long story short, I am looking at the spell Prismatic Spray (D&D 5E using OGL sheet). Prismatic Spray 7   evocation Casting Time:  1 action Range:  Self (60-foot cone) Target:  Each creature in a 60-foot cone Components:  V S Duration:  Instantaneous Classes:  Bard, Sorcerer, Wizard Eight multicolored rays of light flash from your hand. Each ray is a different color and has a different power and purpose. Each creature in a 60-foot cone must make a Dexterity saving throw. For each target, roll a d8 to determine which color ray affects it. 1. Red. The target takes 10d6 fire damage on a failed save, or half as much damage on a successful one. 2. Orange. The target takes 10d6 acid damage on a failed save, or half as much damage on a successful one. 3. Yellow. The target takes 10d6 lightning damage on a failed save, or half as much damage on a successful one. 4. Green. The target takes 10d6 poison damage on a failed save, or half as much damage on a successful one. 5. Blue. The target takes 10d6 cold damage on a failed save, or half as much damage on a successful one. 6. Indigo. On a failed save, the target is restrained. It must then make a Constitution saving throw at the end of each of its turns. If it successfully saves three times, the spell ends. If it fails its save three times, it permanently turns to stone and is subjected to the petrified condition. The successes and failures don’t need to be consecutive; keep track of both until the target collects three of a kind. 7. Violet. On a failed save, the target is blinded. It must then make a Wisdom saving throw at the start of your next turn. A successful save ends the blindness. If it fails that save, the creature is transported to another plane of existence of the DM’s choosing and is no longer blinded. (Typically, a creature that is on a plane that isn’t its home plane is banished home, while other creatures are usually cast into the Astral or Ethereal planes.) 8. Special. The target is struck by two rays. Roll twice more, rerolling any 8. While I have Script Card script that will do the job programmatically, SmartAOE has a much cleaner interface for the player to see who is inside the cone of effect and who is not. Since each target has a chance to be hit by a different ray, the "Dragon's Breath" spell method would not work unless I can either read in different damages or read out the target selection. If not possible, I understand. As I said, I have a working solution. Just trying to make it the best solution that i can.  Thank you in advance for any help that you may provide!
1705762852
David M.
Pro
API Scripter
Yeah, the Prismatic spells are definitely an outlier in terms of mechanics. Unfortunately, I don't have an elegant SmartAoE-only solution for you. Depending on how your scriptcards macro is set up, one possibility could be a hybrid approach in which you generate the cone with SmartAoE using a custom control token (it could be a copy of the default reticle or custom art). That control token's sheet could have a token action that calls a scriptcard macro to perform the logic. A couple caveats with this method: there is a possibility that due to a difference in how SmartAoE determines which squares are affected vs how you are determining affected tokens via your Scriptcard, you could have times where a token is "in" the visible AoE but not in the Scriptcards AoE or vice versa. The other thing is a minor one in that you'd have to manually delete the control token after calling the Scriptcard. Yet another (more "clicky") option is similar to that mentioned above, but the control token uses a modified Scriptcard that uses an @{target} approach to resolve the spell for a single token. The advantage is that you can ensure that all/only the tokens you perceive to be in the AoE are affected. The disadvantage obviously is that it is more clicks, which is a variable annoyance factor depending on how densely populated the AoE is.
David M. said: Yeah, the Prismatic spells are definitely an outlier in terms of mechanics. Unfortunately, I don't have an elegant SmartAoE-only solution for you. Depending on how your scriptcards macro is set up, one possibility could be a hybrid approach in which you generate the cone with SmartAoE using a custom control token (it could be a copy of the default reticle or custom art). That control token's sheet could have a token action that calls a scriptcard macro to perform the logic. A couple caveats with this method: there is a possibility that due to a difference in how SmartAoE determines which squares are affected vs how you are determining affected tokens via your Scriptcard, you could have times where a token is "in" the visible AoE but not in the Scriptcards AoE or vice versa. The other thing is a minor one in that you'd have to manually delete the control token after calling the Scriptcard. Yet another (more "clicky") option is similar to that mentioned above, but the control token uses a modified Scriptcard that uses an @{target} approach to resolve the spell for a single token. The advantage is that you can ensure that all/only the tokens you perceive to be in the AoE are affected. The disadvantage obviously is that it is more clicks, which is a variable annoyance factor depending on how densely populated the AoE is. I figured that would be the case but wanted to make sure. Thank you for taking a look at it.
Hey folks, I've tracked down this script as the culprit of crashing my sandbox with an "infinite loop detected" any time I try to use it. Anyone know if it could be a different script interfering or some browser settings being off? Edit: It was the page having no grid! Any way to block it from running in gridless pages instead of crashing?
1708264932
David M.
Pro
API Scripter
Ah, sorry about that.  Though in my test game it doesn't crash the sandbox, it's just nonresponsive.  I should add some extra error handling for that with some chat output.
I'm having a bit of trouble with this script: Could anyone help? I have set up shatter in a mostly similar way to the github repo, but when I use my version of it every creature automatically fails its save, even though they roll high enough to pass. I'm not the most tech-savvy person around, so I don't really know what other information to include in this reply. I really would appreciate some help here; Shatter is my warlock PC's most common spell!
1708746988
David M.
Pro
API Scripter
@Chaotier, can you post your macro so I can test?
1708870726

Edited 1708870884
Thanks for having a look ^^ My warlock's name is Ophelia, and I call on the character for the save DC, as well as setting the spell's level automatically and using a spell slot. Replace those bits, of course :p !smartaoe {{   --title|Shatter   --leftsub|DC @{Ophelia|spell_save_dc} CON   --titlecardbackground|linear-gradient(#87dcaf, #699c96)   --oddrowbackground|#99cc99   --evenrowbackground|#87dcaf   --oddrowfontcolor|#000000   --evenrowfontcolor|#000000   --tablebgcolor|#e0dbc0   --aoeColor|#87dcaf50   --aoeOutlineColor|#87dcaf   --gridColor|#00000000   --fx|nova-smoke   --triggerSound|Shatter   --hidenames|true --forceintersection|false --radius|10ft --aoetype|circle,float --instant|true --mingridarea|0.25 --mintokarea|0.5 --affectsCaster|true --dc|{Ophelia|spell_save_dc} --saveFormula|5eCON --damageformula1|[[[[{floor((@{Ophelia|level}+1)/2),5}kl1+1]]d8]] --damagetype1|Thunder --bar|1,3 --autoapply|true --zerohpmarker|dead --resource|lvl[[{floor((@{Ophelia|level}+1)/2),5}kl1]]_slots_expended,1,Level [[{floor((@{Ophelia|level}+1)/2),5}kl1]] Slots --desc|A sudden loud ringing noise, painfully intense, erupts from a point of your choice within range. Each creature in a 10-foot-radius sphere centered on that point must make a Constitution saving throw. A creature takes 3d8 thunder damage on a failed save, or half as much damage on a successful one. A creature made of inorganic material such as stone, crystal, or metal has disadvantage on this saving throw. A nonmagical object that isn’t being worn or carried also takes the damage if it’s in the spell’s area. }}
1708872352
David M.
Pro
API Scripter
I was able to replicate with your macro. Looks like you are missing the @ symbol when setting your spell DC, so --dc|{Ophelia|spell_save_dc} should be --dc|@{Ophelia|spell_save_dc} Starting working for me when I made this change.
Wow that is such a simple error... I feel a fool. Thank you tons for looking at this for me, you're a legend! <3
Greetings! I have followed all the instructions to properly implement SmartAOE in my game. I decided to test things using Shatter. I created the macro and copied and pasted the macro from the GitHub collection of spell macros. Everything appears to work fine, until I click the TriggerAll button. I then see this in chat: Something went wrong when processing rolls. The error message generated by Roll20 is: SyntaxError: Expected "(", ".", "[", "abs(", "ceil(", "d", "floor(", "round(", "t", "{", [ |\t], [+|\-] or [0-9] but "C" found. Can anyone decipher this? Thanks!
Can you post the whole macro? There is probably a simple copy error either from the original post or your copy. This error message is in effect "Something happened". GM Jim said: Greetings! I have followed all the instructions to properly implement SmartAOE in my game. I decided to test things using Shatter. I created the macro and copied and pasted the macro from the GitHub collection of spell macros. Everything appears to work fine, until I click the TriggerAll button. I then see this in chat: Something went wrong when processing rolls. The error message generated by Roll20 is: SyntaxError: Expected "(", ".", "[", "abs(", "ceil(", "d", "floor(", "round(", "t", "{", [ |\t], [+|\-] or [0-9] but "C" found. Can anyone decipher this? Thanks!
Hi! I love this script, it's something I've been needing for a long time in my games and I'm glad I've stumbled upon it. Is there any way to make it work for an isometric grid layout? I didn't see anything in the Roll20 Wiki but I maybe just missed it.  Thanks for your support!
1709594806
David M.
Pro
API Scripter
Sorry, the script only supports square grids. I agree that isometric (and hexes) would be cool, but it's a pretty daunting task. There is a pretty significant amount of math going on behind the scenes as it is.  
As I've gotten other macros to work, I guess it was the original post. I checked and what I had copied was an exact match to the original. Thanks anyway. al e. said: Can you post the whole macro? There is probably a simple copy error either from the original post or your copy. This error message is in effect "Something happened". GM Jim said: Greetings! I have followed all the instructions to properly implement SmartAOE in my game. I decided to test things using Shatter. I created the macro and copied and pasted the macro from the GitHub collection of spell macros. Everything appears to work fine, until I click the TriggerAll button. I then see this in chat: Something went wrong when processing rolls. The error message generated by Roll20 is: SyntaxError: Expected "(", ".", "[", "abs(", "ceil(", "d", "floor(", "round(", "t", "{", [ |\t], [+|\-] or [0-9] but "C" found. Can anyone decipher this? Thanks!
I've been having issues in my two recent games. I ignored it during my last game, assuming I messed something up somehow. Now I'm having the same issue in my new game. I've used SmartAOE in 3 campaigns now and it worked perfectly in the first one, the only difference in my new campaigns is I'm using less Scripts than before. (Got rid of a few I didn't like) Every part of SmartAOE works like a charm except the default From Caster, Pathfinder Circle/Sphere at 15ft and 20ft. I get an error that says " No ability was found for %{AoEControlToken|15ft-PF-Circle-Caster}" and it posts in chat as if I'm saying " AoEControlToken|20ft-PF-Circle-Caster" I understand very little when it comes to messing with the Script APIs and have absolutely no idea how I could possibly have messed it up or fix it.
1712917411
David M.
Pro
API Scripter
Thanks for bringing this to my attention. There is in fact a typo in the generation of those two abilities. Good news is that you can fix this manually and not have to wait for a new release to be pushed out. If you navigate to the AoEControlToken character in your journal and go to the abilities tab, you will see the following two abilities: 15ft-PF-PF-Circle-Caster 20ft-PF-PF-Circle-Caster You can manually rename them to the following: 15ft-PF-Circle-Caster 20ft-PF-Circle-Caster I'll update the script to fix the typos, but I think it will only affect initial installs. My guess is that those two abilities are incorrectly named in your other games as well but just went unnoticed. 
1712918487
David M.
Pro
API Scripter
Version 0.30 available - found  here  (Note Manual install required for this development version) Summary Fixed typos in the names of two of the default abilities on the automatically-generated AoEControlToken character Previously, when using the AoEGenerator macro, buttons for "From Caster -> ____PF Circle / Sphere____ -> 15ft" and ".... 20ft"  would result in chat errors due to ability naming typos.  I created a pull request which should go live next week.
I appreciate the quick response. Was able to fix it right quick! Thank you.