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] autoButtons - automatically generate damage & healing buttons for your clicking pleasure

1647955152

Edited 1677899758
Oosh
Sheet Author
API Scripter
[Script] - autoButtons v0.8.1 autoButtons v0.8.1 repo This was a originally a wee, test scriptlet from another thread a while back. It's grown up since then... IMPORTANT : This script requires TokenMod to apply damage & healing to tokens. IMPORTANT: Custom Buttons are currently broken in the main version. Only the default buttons are usable. This is due to a security update to the sandbox, so it affects all versions of autoButtons. This post has a link to a test version which will hopefully get custom buttons working again - it's still very much a test version though, and may or may not work. Some details here So... what's all this then? The script reacts to roll templates posted to chat, and posts back some damage buttons for simple application of damage/healing to the selected token(s). It's dead simple, really. Some moving pictures: Where do the damage numbers come from? I couldn't figure out how to deconstruct a roll object, so they're just randomly generated. Really??? No, not really! The script comes with a preset for 5e by Roll20, but you can customise it to work with any sheet or roll template. If you need it to do anything tricky (like picking up spells & higher level casting on the 5e sheet), you will need Javascript skills. But trickier operations aside, you can set the script up to watch for whatever roll templates and template properties you like. Here is the script helpfully spitting out the default 5e settings: So the script will post buttons for any roll it finds on the templates listed in the first box, and it will grab the roll totals for each of the template properties in the second box. These will then be available for the buttons to use to perform their own math on. In the case of the default 5e settings, the normal damage button will total all the damage from {{dmg1=...}} {{dmg2=...}} {{globaldamage=....}} and add on {{hldmg=...}} if a spell cast is detected. The crit button will add those crit fields on top for a new total. The default buttons for the 5e preset are: Crit: all damage and crit fields added together, plus upcast crit properties if applicable Full Damage: dmg1 + dmg2 + globaldamage, plus upcastDamage if applicable Half Damage: half of Full Damage, rounded down Healing: dmg1 + dmg2 + globaldamage, plus upcastDamage if applicable , applied as healing instead of damage There's a small title at the top - this is just to help identify the right buttons if two different rolls are close together or there's some chat lag. Those are the simplest buttons - there are more of them available, covered in the next post . If you wish to handle temporary HP, I recommend a slight modification to Aaron's script. I've covered that at the bottom of this post . Important Note on Advantage/Disadvantage/Crit damage:     Due to the way roll templates are constructed & displayed, character sheets can potentially be rolling a whole bunch of dice which don't end up being displayed in chat. This includes superfluous crit dice in 5e, and the damage template showing crit damage when it wasn't needed due to the player rolling two dice. This script has no way of reliably knowing whether a crit has actually landed when crit dice show up, so there's no way to automatically hide the crit button when it's not needed. You'll just need to figure it out yourself. The crit button will more than likely have some bizarre amounts on the tooltip, even when no crit damage is visible in the chat bar. Oosh, your buttons are stupid and you're stupid. How do I add buttons that don't suck? Aha! There's the clever bit. You'd use the Command Line Interface to do that. It follows the general Roll20 pattern of achieving stuff via API... The CLI So it turns out I'm both lazy and forgetful. I'm also not playing on Roll20 these days, so whenever I come back to a script (even my own) I've totally forgotten the CLI commands. For this reason I've used regular expression matches for all the commands, to make them easier for me to guess 24 hours later when my mind has been scrubbed clean by a few pan-galactic gargle blasters. If that makes no sense at all: end result is that none of the commands are case-sensitive, and most of them can be short-cut (or long-cut if you prefer!), or just out-right guessed if you forget them. I also forgot to actually put any useful information into the --help command. Although the commands are not case-sensitive , I'll stick to camelCase and full names for ease of reading. Important to note though: button names, template names and template property names are case-sensitive . These must be entered exactly. Keyword: !autoButton Commands: --listButtons / --buttons         Generates a list of buttons currently available for use, e.g: !autoButton --buttons          From left to right, the controls are "Show button", "Hide button", "Delete button". Controls are greyed out when nonsensical - you can't "Show" a button which is already shown on the button template, and you cannot "Hide" a button which isn't currently enabled. Buttons marked with an asterisk are default buttons - these cannot be deleted. Note that the asterisk is not part of the name - do not include it when referencing a default button (e.g. when trying to clone it) --showButton <button name> The same as clicking the "Show" button on the button list: this adds the button to the template spat out by the script after each damage roll. You'll probably want to do this after creating a new button, otherwise you can't click it. What good is a button that can't be clicked? And what of the mental state of a button that isn't getting clicked? --hideButton <button name >     Same as the "Hide" button in the list. Removes the button from the button template, but leaves it in the button pool if you want to add it back in later. --deleteButton <button name >     Delete a button entirely. This will also remove it from the button template. Default buttons cannot be deleted. --createButton <button data> Creates a new button to add to the pool. There's a button on the button list which will do this for you via prompts, but if you'd rather enter it in straight through the CLI, the required fields just need to be entered in moustache/handlebars format, like a roll template macro. To use the more advanced features like queries or multiple content layers, you will need to use the command line to either create the button, or edit it afterwards. This is covered in detail in the next post . --editButton <button data> This is also covered in detail in the next post . -- cloneButton <existing button name> <new button name> Clone an existing button - existing button name must be an exact match and new button name must be unique, e.g. !autobut --cloneButton damage --renameButto n <existing button name> <new button name> The same as cloneButton, but will remove the old button if the cloning is successful. Cannot be used on default buttons. --reorderButtons / --order     Reorder the buttons, left to right, with a comma-delimited list. The buttons are indexed from 1, left to right in their current order . So in the screenshot above with the halfCrit button, we have buttons 1 to 5 from left to right. If we want the half crit button in the second position (between the full crit and normal damage), we'd supply this: !autobut --order 1,5,2,3,4 (actually, we could just supply "1,5" as the order - any unlisted indices will be left in the current order and thrown on the end). -- listTemplates / --templates     List the roll template names the script listens for in chat. These should be prefilled for 5e by Roll20. This list can also be accessed via the --settings menu. --addTemplate <template name>     Add a roll template name to the listener list --removeTemplate <template name>     Remove a template name from the listener list --listProperties / --props     List the roll template properties the listener tries to grab inline rolls from. This can also be accessed via the --settings menu. --addProperty <prop category/prop name>     Add a roll template property to monitor for inline rolls.     IMPORTANT: properties must belong to a category, and cannot be added without one. If using the 5e sheet, all 4 categories above can be used, though the upcast ones are ignored if the damage didn't come from a spell. For custom sheets, only the damage and crit categories send data through to the button math functions, so you will want to use one of those.     For example, the screenshot above has a customDmg3 property added (doesn't exist on the 5e sheet and won't actually do anything obviously). To add that property, we'd type some letters thusly (with some shortcut commands!): !autobut --addprop damage/customDmg3 In short: any property added or removed must contain a forward slash '/' to denote the category and property. Any further slashes are no use - there's no nesting of properties. --removeProperty <prop category/prop name>     Remove a roll template property from the inline roll monitor . Subject to all the same conditions as --addProperty above. --hpBar / --bar < 1 | 2 | 3 >     Set the token bar to affect with HP changes. Default is 1. --loadPreset <preset sheet name>     Load the preset settings for a game system. Currently doesn't do a great deal since only 5e has settings coded in, though you can switch to 'custom' if you want a blank slate. Note that this will clear all settings, including the template listener array. The script won't do anything until you've added some templates & properties to listen for. --reset     Reload the current character sheet presets. Might be handy if something goes horribly wrong.   --uninstall     Remove all autoButton data from the [state] object. Restarting the sandbox will initiate a clean install of autoButtons. --help     Really not very useful . Leads to this thread. --settings     Opens the settings UI in the chat bar. This is the preferred way to modify the game settings. Toggles: these settings can be toggled by supplying no argument, turned on by supplying on, 1, or true or turned off with off, 0, or false. All of these can be modified via the --settings menu as of 0.6.0 --targetTokens     Use @{target} clicks to direct damage and healing instead of @{selected} token. Requires TokenMod setting to allow players to use character IDs . Default is off . --bump     Minor style edit to bump the buttons bar on top of the "who" chat message output, and reduce the bottom margin. Takes up less space. Default is on . --overkill     Allow HP to drop below 0. Default is off . --overheal     Allow HP to exceed max. Default is off . --ignoreAPI     Ignore any rolltemplates generated by the API. Default is on . --gmOnly     Button template is whispered to the GM. Default is on . Worth noting that the script only applies damage to selected tokens, so there's generally no real risk in allowing players to use it, though the buttons will post publicly if this setting is toggled off, and some people don't like that chat spam.     This does not allow players to use the CLI to change script settings - it merely posts the buttons to public chat so they can go click-crazy. Note that combining this with targetTokens would allow players to affect HP on tokens they don't own. --report     This turns on chat reporting each time a change is made by TokenMod from an autoButtons button click. The 'Character' option in here will attempt to find a token or character owner to send the report to, but will always still send it to the GM. It's best to change this through the --settings UI, but the internal values are [ 'off', 'gm', 'control', 'all' ]. Default is off . --darkMode     Switch on dark mode palette for the button bar. As with anything, this only affects button bars generated after toggling the setting. Default is off . --multiattack     When a button bar is generated for an NPC, this will attempt to resolve the label on the button bar into a reference to the NPC action that generated it - this allows the GM to click on the label in the bar to generate another attack. Default is off . --allowNegatives     Allow final values to be negative. This would allow a query modifier to turn a value negative (for example, HAM applying a 3 damage reduction on a 1 damage hit results in -2). The end result would be a damage that causes healing. Default setting is off which prevents this behaviour (and the inverse, of a modified healing spell causing damage). --autosort     Automatically sort the buttons by Unicode order when generating the button bar. Note that this does not permanently change the order of the buttons like a --reorderButtons would, if you switch it back off the buttons should return to their normal order. Default is off . --autohide     Automatically hide buttons where the value is 0. Note the limitations with the 5e sheet due to the way the sheet generates templates - crit is always rolled, so the crit buttons will never be hidden. --imageIcons      This will render the button labels as images instead of fonts, which will fix font alignment issues on MacOS / ChromeOS. Default is off Updates v0.4.4:     - fixed math functions not saving properly on buttons. The state object does not like storing functions!     - fixed NaN error in spells     - fixed bad reference to higher level casting fields, causing damage to not be added v0.4.5:     - fixed bad reference causing --createButton to crash v0.5.1:     - major rejiggifying of the scribbledywords. New structure, new button store, new config layout, new UI elements. Still no --help         documentation!     - added two toggles:          targetTokens to use token targets instead of selected (requires tokenMod to allow players to use the --ids flag)         bump nudges the button bar and reduces margins so it takes up less chat space. Turn this off if it conflicts with other CSS                           shenannigans you've got going on.     - minor security validation added to createButton: the math function cannot contain the word 'state' or  the operator '='     - crit.total and damage.total are no longer pre-added before being passed to buttons. So expressing full crit damage in a button now is         (crit.total + damage.total), instead of just (crit.total) - or, put another way, the { crit } object keys contain only the bonus crit damage v0.5.2:     - Bug fixes: bad default value in hpBar, issue with version number in checkInstall() preventing upgrade path v0.5.3:     - Bug fix: wrong key name in upgrade path for old versions from previous thread v0.6.0      See v0.6.0 release post v0.7.0      See v0.7.0 release post v0.7.2     - added --imageIcons setting to fix font render issues with MacOS or ChromeOS v0.8.0     - added apiMeta data     - --imageIcons now defaults to true     - submitted to one-click     
1647956345

Edited 1664327802
Oosh
Sheet Author
API Scripter
Main Buttons These are the default buttons which will be enabled on a fresh install: crit: dmg1 + dmg2 + crit1 + crit2 + globaldamage + globaldamagecrit + hldmg + hldmgcrit (higher level damage/crit) critHalf: the total of the above crit , divided by 2 and rounded down damage : dmg1 + dmg2 + globaldamage + hldmg damageHalf: the total of the above damage , divided by 2 and rounded down healingFull: the total of the above damage , applied as + (healing) instead of - (damage) Extra Buttons There are a heap of extra buttons included since v0.7.0 , but disabled by default: damagePrimary: dmg1 + globaldamage + hldmg (if applicable) damageSecondary : dmg2 critPrimary: dmg1 + crit1 + globaldamage + globaldamagecrit + hldmg + hldmgcrit critSecondary: dmg2 + crit2 resist%: standard full damage, with an on-click multiplier query (note it's a multiplier, not actually a percentage, so enter "0.25" to apply quarter damage, or enter "2" to double damage for vulnerability. resistN: standard full damage, with an on-click flat damage reduction query. This is subtracted from the result, so just enter a positive number (e.g. "3" for Heavy Armor Master) resistCrit%: full crit damage with multiplier query resistCritN : full crit damage with flat reduction query resistPrimary%: the same as damagePrimary, with multiplier query resistPrimaryN: t he same as damagePrimary, with flat reduction query resistSecondary%: the same as damageSecondary, with multiplier query resistSecondaryN: the same as damageSecondary, with flat reduction query resistPrimaryCrit%: the same as critPrimary, with multiplier query resistPrimaryCritN: t he same as critPrimary, with flat reduction query resistSecondaryCrit%: the same as critSecondary, with multiplier query resistSecondaryCritN: t he same as critSecondary, with flat reduction query Pathfinder Although not part of the script at this stage, Sean R. has put together a bunch of buttons for the crazy number of possible attacks in a 3.5-based system. Custom Buttons When creating or editing buttons, use the handlebar syntax familiar from constructing roll queries. All create functions must have a {{name=<uniqueName>}} key/value property, and all edit functions must have a {{name=<existingName>}} kev/value property. Buttons names are case-sensitive and cannot contain whitespace (they will be camelised if you try to use spaces in the name). The following keys are valid for buttons: name: the name of the button. Used by the script and other settings, not displayed. First character must be a letter, stick to alpha-numeric unless you know what you're doing (this becomes a JS object key). If you have spaces in the name, it will be camelCased for you - you'll need to use the camelCase version in future to refer to the button. sheets: array of sheets which the button is designed for. Not currently very useful, just leave blank for now, this signifies 'all sheets'. tooltip: the tooltip displayed on mouseover of the button. % is a control character here, and will be replaced with the calculated value from the button's math function. content: the label on the button. The default buttons all use the pictos font and one or two characters. If you want to use a normal character, you'll need to edit the style as well content2, content3: two further layers of button content that will appear in front of content style: the inline CSS styles to use for the button label. You can supply a pre-built style from the script by key name (in the styles object around line 140) or a string containing your own CSS style2, style3: CSS styles for the matching content layers math: the tricky bit. This is still pretty basic, but you can use:         basic math operators & parenthesis: ( ) + - / *         round down, round up, round nearest: floor, ceil, round         references to the two objects passed in from the inline roll functions, and their child keys: damage and crit         if you know your JS Math library, you can use those functions directly as well     For the button to create successfully, the math function must compile successfully into a JS function, and a test run using integers must return a number. If these conditions aren't met the button will be rejected with a message. Negative values will inflict damage, positive values will cause healing.     The two inline roll objects, damage and crit , will contain a key for total , along with a key for each property listed under that category. See the output from !autobut --props for clarity if required, but the standard 5e preset would contain these keys:     damage.dmg1     damage.dmg2     damage.globaldamage     damage.hldmg     damage.total query: Queries can be added to the buttons which will run when clicked (not at math function time), so the same button can be used to give different numbers. The format is {{query=<operator>|<query string>}} . So if you want to subtract a number from the result, the syntax would be: {{query=-|Lower the damage by how much?|0}} The query string is that same as the Roll20 syntax, but without the surrounding ?{ } . So you can define a default (like above), or even define limited options if you prefer.         With multiplication and division, the script will default to rounding down . If you want to round up, you can supply a plus after the operator: {{query=*+|Multiply the damage by how much, rounded up?|0}}         Finally, the keyword %%MODIFIER%% can be use to insert the final result. You can use this to display the unmodified damage in the query. Putting that all together, here are a couple of example buttons, one to supply a flat Damage Reduction (like Heavy Armor Master), the other to supply a percentage Damage Multiplier (like a character with Evasion + Resistance getting a 0.25 multiplier due to two lots of resistance): !autobut --createbutton {{name=drPercent}} {{math=-(damage.total)}} {{query=*|Damage Resistance multiplier? (%%MODIFIER%% damage)|0}} {{content=DR%}} {{tooltip=Damage Resist % (%)}} {{style=font-family:sans-serif; font-weight: bold; color: darkblue; font-size: 0.9em;}} !autobut --createbutton {{name=drFlat}} {{math=-(damage.total)}} {{query=-|Damage Resistance amount? (%%MODIFIER%% damage)|0}} {{content=DR+}} {{tooltip=Damage Resist flat (%)}} {{style=font-family:sans-serif; font-weight: bold; color: darkblue; font-size: 0.9em;}} To handle cases of flat damage mitigation that could exceed the damage itself (causing a negative number, and the damage to do healing) there's a new options flag, --negatives. Example : We'll create a button which does half crit damage, rounded down: !autobut --createbut {{name=half crit}} {{content=k}} {{tooltip=Half Crit (%)}} {{style=crit}} {{math=floor(crit.total/2)}} We won't bother with {{sheets=...}} here. Note that I've been naughty and left a space in the button name. The script will fix that for us. So, I've pinched the style from the normal crit button, but only used a single heart in {{content}}. The button is now in the pool, but not added to the template. So we need to make it visible next, either through the --buttons menu, or directly via CLI: !autobut --showbut halfCrit Note the halfCrit name - this was automatically camelCased for us, since whitespace is naughty for the way the buttons are stored. Now, next time a damage roll is picked up, our new button appears on the end:      But.... RUH ROH! I've clicked the button and the pesky red lady is still on 11/11 HP. I've forgotten the negative sign in the math function, what a dunce! That brings us rather neatly to the editButton function! And that was a genuine stuff-up, I didn't even need to rehearse it! --editButton <button data>     This function is almost the same as the createButton function , with a couple of differences: {{name=}} must match (exactly) an existing button name, and all other keys are optional. If you only want to edit one property, you only need to enter that. Example: to fix my mistake above, I would just need to supply the CLI with: !autobut --editbut {{name=halfCrit}} {{math=-floor(crit.total/2)}} I've fixed up the camelised name, and just added the minus sign to the start of the math function. The result was a resounding success for us, and an unfortunate bed-shitting for the red lady, since my new roll was enough to knock her out of the competition:      IMPORTANT NOTE: All changes made by the script (like editing a button in the example above) are only applied to buttons generated afterwards. Once they're posted in chat, the buttons are static and will not be affected by any future script changes.
1647959766
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Dang! I installed the first iteration of this and haven't even gotten to sit in the Big Chair since then. Now a complete overhaul and coolification! Nice-looking script!
Man there are so many potential expansion ideas I have for you on this script. 1.  Add the health /fx that aura/tint api adds when hp bars are changed to each button press. 2.  Add functionality to allow full on macros in the buttons like for instance I have a "add every possible statusmarker I own" tokenmod macro that I would love to have a button for along that autobuttons list.   3.  An autokill script possibly for when they are reduced to 0 or lower.   4.  Auto death saves for when already at 0 or a button for a death save.   To be clear though, I think this script is one of the most used script in my session second only to Groupcheck.   A request for an example button would be: Something that makes Toll the Dead and versatile weapons work.  So divide damage 1 and damage 2 into seperate buttons instead of combining them.  
Can a target be added instead of selected token?. I know the intention is for the GM to apply the damage, but I allow my players to do the damage to the token they want to target. I do this with a Token-mod or alterbar, the difficulty is they need to enter the value every time, this API will be a lot quicker.
1647986251

Edited 1647986545
DM Eddie said: Man there are so many potential expansion ideas I have for you on this script. 1.  Add the health /fx that aura/tint api adds when hp bars are changed to each button press. 2.  Add functionality to allow full on macros in the buttons like for instance I have a "add every possible statusmarker I own" tokenmod macro that I would love to have a button for along that autobuttons list.   3.  An autokill script possibly for when they are reduced to 0 or lower.   4.  Auto death saves for when already at 0 or a button for a death save.   To be clear though, I think this script is one of the most used script in my session second only to Groupcheck.   A request for an example button would be: Something that makes Toll the Dead and versatile weapons work.  So divide damage 1 and damage 2 into separate buttons instead of combining them.   I agree this is the Best Quality of Life API for a DM, reduces that "+No." and "-No." we have to do. Less math and more Fun n_n . I see this API only seconded by TokenMod itself in usefulness. Surly you can make a custom Button that only calls Damage1 and Damage 2 Separately with the functions? I'm trying to figure it out myself as we speak. If I succeed I'll post the button commands.  
<a href="https://app.roll20.net/forum/post/7831600/listening-for-5e-ogl-damage-rolls" rel="nofollow">https://app.roll20.net/forum/post/7831600/listening-for-5e-ogl-damage-rolls</a> Here is the API use that is similar if you want to look at how they separate the damage from crit or not.
Hi Oosh,&nbsp; I was testing the script and for some reason when I cast a spell, I try it with Eldritch blast and shatter, the buttons said "NaN" instead of the damage rolled. Can you think on anything that can cause this?
1647991327
Andreas J.
Forum Champion
Sheet Author
Translator
I think a new era have just begun with this
1647991935

Edited 1647992709
Alright I have figured out a small oversight that should be mentioned. All new buttons created assume a positive, thus "healing" rather than "hurting". Simply add a "-" to the function, I'm choosing to use an extra set of brackets in the function to turn it into a negative result. For example. !autobut --createbut {{name=half crit}} {{content=k}} {{tooltip=Half Crit (%)}} {{style=crit}} {{math=floor(crit.total/2)}} becomes !autobut --createbut {{name=half crit}} {{content=k}} {{tooltip=Half Crit (%)}} {{style=crit}} {{math= -( floor(crit.total/2) ) }} As for the DMG1 , DMG2, Crit1, Crit2 Button creations I was successful in making them as well and here they are.&nbsp; !autobut --createbut {{name=DMG1}} {{content=D1}} {{tooltip=DMG1 (%)}} {{style=half}} {{math=-(floor(damage.dmg1))}}&nbsp; !autobut --createbut {{name=DMG2}} {{content=D2}} {{tooltip= DMG2 (%)}} {{style=half}} {{math=-(floor(damage.dmg2))}}&nbsp; !autobut --createbut {{name=Crit DMG1}} {{content=C1}} {{tooltip=Crit DMG1 (%)}} {{style=half}} {{math=-(floor(damage.dmg1+crit.crit1))}}&nbsp; !autobut --createbut {{name=Crit DMG2}} {{content=C2}} {{tooltip=Crit DMG2 (%)}} {{style=half}} {{math=-(floor(damage.dmg2+crit.crit2))}}
1647994942

Edited 1647994990
Oosh
Sheet Author
API Scripter
DM Eddie said: Man there are so many potential expansion ideas I have for you on this script. 1.&nbsp; Add the health /fx that aura/tint api adds when hp bars are changed to each button press. 2.&nbsp; Add functionality to allow full on macros in the buttons like for instance I have a "add every possible statusmarker I own" tokenmod macro that I would love to have a button for along that autobuttons list.&nbsp;&nbsp; 3.&nbsp; An autokill script possibly for when they are reduced to 0 or lower.&nbsp;&nbsp; 4.&nbsp; Auto death saves for when already at 0 or a button for a death save.&nbsp; Something that makes Toll the Dead and versatile weapons work.&nbsp; So divide damage 1 and damage 2 into seperate buttons instead of combining them.&nbsp;&nbsp; 1. I'll have a look, but my experience with /fx has been "don't bother". Should be easy enough to add a toggle though. 2. Complicated... would need some good integration with a specific script to handle all the status stuff, but possible. 3. Should be fairly straight forward 4. So far, the script doesn't do anything with character sheets. Probably tied in with number 2 - doing complex, system-specific stuff to the target is a whole new thing. Not to say it's impossible, of course! Nox said I agree this is the Best Quality of Life API for a DM, reduces that "+No." and "-No." we have to do. Less math and more Fun n_n . I see this API only seconded by TokenMod itself in usefulness. Surly you can make a custom Button that only calls Damage1 and Damage 2 Separately with the functions? I'm trying to figure it out myself as we speak. If I succeed I'll post the button commands.&nbsp;&nbsp; edit - hahaha ninja'd! :) This should do the trick (basic damage 1, no crit): !autoButton --createButton {{name=damage1}} {{content=1}} {{tooltip=Damage 1 (%)}} {{math=-(damage.dmg1 + damage.globaldamage)}} {{style=font:serif;color:black}} For the crit version, you'd want to add crit.crit1 inside the parenthesis in {{math}}. Damage 2 is easy enough to figure out :) Kilter said: <a href="https://app.roll20.net/forum/post/7831600/listening-for-5e-ogl-damage-rolls" rel="nofollow">https://app.roll20.net/forum/post/7831600/listening-for-5e-ogl-damage-rolls</a> Here is the API use that is similar if you want to look at how they separate the damage from crit or not. Yep, the issue is not with detecting a crit. It's with 5e's advantage mechanic - if a player is rolling two dice, the script has no idea if the player has advantage, disadvantage or neither. So if one roll is a crit and the other isn't (fairly common) the script has no way of knowing what to do - hence I didn't bother with the detection. It relies on all players accurately using query/toggle for advantage.
Man this script is absolutely genius.&nbsp;&nbsp;
1647995264

Edited 1647995365
Oosh
Sheet Author
API Scripter
Warlord said: Hi Oosh,&nbsp; I was testing the script and for some reason when I cast a spell, I try it with Eldritch blast and shatter, the buttons said "NaN" instead of the damage rolled. Can you think on anything that can cause this? Yep, that was a big booboo when I refactored some stuff. It's fixed in 0.4.4 which is now on the pastebin. Thanks for the report! I'll move it over to github soon, might need to some cleaning up there first :) Warlord said: Can a target be added instead of selected token?. I know the intention is for the GM to apply the damage, but I allow my players to do the damage to the token they want to target. I do this with a Token-mod or alterbar, the difficulty is they need to enter the value every time, this API will be a lot quicker. Should be easy enough - will default to 'off', of course, for security reasons. But if you're happy your players are sober &amp; grown-up enough to play with targeting, there's no reason to not allow it :)
1647995539
Oosh
Sheet Author
API Scripter
I recommend grabbing autoButtons v0.4.4 - pastebin immediately - the button math function weren't saving to the API state properly. All your saved buttons will most likely need the math function updated after installing 0.4.4 &amp; restarting, by using the edit function: !autoButton --editButton {{name=myButton}} {{math=(original function)}} They should then save properly on a sandbox restart.
Creating new buttons with v0.4.4 gives me this error.&nbsp;
1648003338

Edited 1648003582
DM Eddie said: 3.&nbsp; An autokill script possibly for when they are reduced to 0 or lower.&nbsp;&nbsp; I use the Script from this for auto bloody and death. Community Forums: Bloodied and Dead script gone? | Roll20: Online virtual tabletop
1648004868
Oosh
Sheet Author
API Scripter
Nox said: Creating new buttons with v0.4.4 gives me this error. Who coded this garbage??? /eyeroll Fixed, thanks!
1648007803

Edited 1648007824
Your doing fine "insert Thumbs up Emoji here". I barely understand it, let alone know what half the code means.
Oosh said: Nox said: Creating new buttons with v0.4.4 gives me this error. Who coded this garbage??? /eyeroll Fixed, thanks! Good quick pickup on the fix though.&nbsp; I never even noticed it.&nbsp;&nbsp;
Thanks, For the quick reply. This is one of the best API's on the system right now. two thumbs up.
1648209926

Edited 1648211551
Andreas J.
Forum Champion
Sheet Author
Translator
Suggestion: Making a separate "default" button for Temporary HP could make sense, given it's a thing in D&amp;D 5E &amp; many other games. In the 5E sheet, it's hp_temp . Temp HP could be represented by a yellow plus symbol, or maybe the Up arrow(Pictos "{" character), to represent it being a boost. Questions: Would it be possible to create buttons that as the user what stat should be healed? In systems here you might be able to take ability damage and it's tracked on the sheet (like 3.5E &amp; PF), having an option to create a dropdown to select which ability score is healed/take damage would have massive utility over having to hardcode every alternative, especially as ability damage is often rare but useful enough for creating the automation. Have you tried if using emojis work for the buttons, or are they stripped out? For those wondering about the available symbols, the list of Pictos, Pictos Custom, and Pictos Three can be found here: <a href="https://wiki.roll20.net/CSS_Wizardry#Pictos" rel="nofollow">https://wiki.roll20.net/CSS_Wizardry#Pictos</a> Great symbols: Pictos Custom's "fire" and "impact"(kinda like a star) Pictos Three's "radioactive" symbol
1648257653
Oosh
Sheet Author
API Scripter
Andreas J. said: Suggestion: Making a separate "default" button for Temporary HP could make sense, given it's a thing in D&amp;D 5E &amp; many other games. In the 5E sheet, it's hp_temp . Temp HP could be represented by a yellow plus symbol, or maybe the Up arrow(Pictos "{" character), to represent it being a boost. Questions: Would it be possible to create buttons that as the user what stat should be healed? In systems here you might be able to take ability damage and it's tracked on the sheet (like 3.5E &amp; PF), having an option to create a dropdown to select which ability score is healed/take damage would have massive utility over having to hardcode every alternative, especially as ability damage is often rare but useful enough for creating the automation. Have you tried if using emojis work for the buttons, or are they stripped out? I'm currently just using tokenMod to modify token bars, not interacting with the character sheet at all. I could change that, but currently refactoring the whole script so we'll see :) Ditching tokenMod just for editing token bars 1 - 3 is not that much effort, but achieves nothing. Adding the character sheet functionality and sheet-specific stuff like temp_hp checking is a bit more work, and that'll probably be quite difficult to implement into custom buttons - I'd need to create parsing options for character sheet attributes. Maybe I should handball the script to The Metamancer and walk away at that point :) Or maybe I can leverage the meta toolbox to do that work for me? Most likely I can, autoButtons is a well-behaved script and on fires after on('ready')... it'll be fun constructing meta strings as button functions, that's for sure... As for Q2 - that is an excellent question, and it turns out you can! Quick test, I just pasted&nbsp;the first one I googled into an --editbutton {{content=}} command: Andreas, you're a genius!
1648366478
Andreas J.
Forum Champion
Sheet Author
Translator
Yeah, using Meta-Toolbox would probably be sensible to check out, no reason why you'd need to code everything from scratch. Meta-Toolbox summarizes each of the related scripts, giving you an example of which might be useful. And ofc once autoButtons is in the install menu, people installing it will automatically install any dependencies.
1648990052

Edited 1648991777
Oosh
Sheet Author
API Scripter
v0.5.1: &nbsp;&nbsp;&nbsp; - major rejiggifying of the scribbledywords. New structure, new button store, new config layout, new UI elements. Still no --help documentation! &nbsp;&nbsp;&nbsp; - added two toggles: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --targetTokens to use token targets instead of selected (requires tokenMod to allow players to use the --ids flag) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --bump nudges the button bar and reduces margins so it takes up less chat space. Turn this off if it conflicts with other CSS &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;shenannigans you've got going on. &nbsp;&nbsp;&nbsp; - minor security validation added to createButton: the math function cannot contain the word 'state' or&nbsp; the operator '=' &nbsp;&nbsp;&nbsp; - crit.total and damage.total are no longer pre-added before being passed to buttons. So expressing full crit damage in a button now is &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(crit.total + damage.total), instead of just (crit.total) - or, put another way, the { crit } object keys contain only the bonus crit damage Script has been updated. Funcionality-wise only a couple of small changes That said, the code has been pretty thoroughly wrangled. If there are any issues bringing old buttons over to the new v0.5.x store, there should be some logs in the API log. The old buttons won't be deleted, but there's currently no way apart from the update process to copy them over. Let me know if you lose any old buttons, and I'll add in a function to copy them over once I've figured out what went splat. Small validation added to button functions - you can't use the word 'state' or the operator '='. The function obviously runs from within the sandbox, so can't really do much damage, but could potentially cause destruction of user settings. If you have custom buttons involving crit calculations, they'll probably be wrong now as crit.crit1 / crit.total etc. only contain the bonus damage. They now need to be added to the respective { damage } key to get the full crit damage i.e. crit.crit1 + damage.dmg1 would give you the full crit damage for a crit on dmg1. @DMEddie: do you have some examples of macros you'd like to attach to a button? You mentioned it further up thread..
1649000166
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Sweet! I look forward to using this!
1649077509

Edited 1649077540
I believe there is a bug in version 0.5.1 as follows: First time, fresh install from github copy into named script "autoButtons.js". 5E OGL is the character sheet. Active script "dumpMsg.js" as: on('ready',f =&gt;{ &nbsp; &nbsp;log('API is Up.'); &nbsp; &nbsp;log(`=========================id: ${state.autoButtons} | obj: ${JSON.stringify(state.autoButtons)}`); }); Output from dumpMsg.js script is: "=========================id: [object Object] | obj: {\"version\":\"0.5.1\",\"settings\":{\"sheet\":\"dnd5e_r20\",\"templates\":{\"names\":[\"atkdmg\",\"dmg\",\"npcfullatk\",\"npcdmg\"],\"damageProperties\":{\"damage\":[\"dmg1\",\"dmg2\",\"globaldamage\"],\"crit\":[\"crit1\",\"crit2\",\"globaldamagecrit\"],\"upcastDamage\":[\"hldmg\"],\"upcastCrit\":[\"hldmgcrit\"]}},\"enabledButtons\":[\"damageCrit\",\"damageHalf\",\"healingFull\",\"dmgFull\"],\"gmOnly\":true,\"hpBar\":true,\"ignoreAPI\":true,\"overheal\":false,\"overkill\":false,\"targetTokens\":false,\"bump\":true},\"store\":{\"customButtons\":{\"dmgFull\":{\"name\":\"dmgFull\",\"sheets\":[],\"tooltip\":\"This is a button\",\"style\":\"color: darkred; font-size: 2.1rem;\",\"content\":\"k\",\"mathString\":\"damage.total\",\"default\":false}}}}" Bug is that state.autoButtons.hpBar is set to true. With, e.g., a damage value of 3 for a rolled attack, the buttons have links that look like &lt;a href="!token-mod --set bar true _value|-3!" ... &gt;kk&lt;/a&gt; (italics mine). When I execute !autoButtons --bar 3 I see the chat reply Same result for bar 2 or 1. When I execute !autoButtons --bar 6 I see Parts of a possible fix: After I execute&nbsp; !autoButtons --uninstall edit autoButtons.js line 26 (hpBar initializer) to: hpBar: 1, and then restart the sandbox, I can execute !autoButtons --bar 3 to get and href links look like &lt;a href="!token-mod --set bar3_value|-17!" ...&gt;kk&lt;/a&gt; The script now behaves as expected. I don't grok your code well enough to know if there are additional changes required in checkInstall(), and I suspect that past users might already have integer values in hpBar so might not see this bug after upgrading. Thank you for the script (and others), your work provides a lot of utility.
Hi Oosh,&nbsp; I get the following message
1649082782

Edited 1649086162
Oosh
Sheet Author
API Scripter
Hi Fluffy, Thanks for spotting that - you're 100% right about the cause, have fixed it. I must have messed that up when I added the new keys in. Late at night... Warlord, I'm a little bit baffled how that could happen. I've added a backup path to create &amp; copy the new button store to the new version on the Git - see if you have any luck with that. I'll see if I can figure out how the script managed to skip creating that missing object... Never mind, found a fairly nasty bug and squashed it. Now I'm confused how I didn't have that happen when I did a test update from 0.4 =&gt; 0.5 Hopefully it's all working now.
Hi Oosh, I install the new version, which it was working in the sense that I could see the buttons and use them as GM. now I activate the target Tokens and as GM it ask me to select a target and it worked. No the problem, I use the !autoButton --gmOnly false, and I log in as a player when I do an attack I cannot see the autobuttons, I tried to change the gmonly var on the API and still cannot see the buttons as player and after I add everything back I even re copied the script from the grithub I get this message: for some reason it said that the version is undefined. I installed on a new campaign and it work except the gmonly does not turn off. but on this campaign it does not work. I will try deleting the cache of the page and see.
I found the mistake. The mistake only happen on the campaign I used uninstall. something broke. My fix was I install previous version, and change gmonly to off. install the new version and now all work as intended. Don't know why it did not change the gmonly setting even when I change on the script itself. Anyway thanks for this script is awesome. my players will love it, great job!!!.&nbsp;
I just wanna say thank you once again without you my campgain would have suffered so much more you are an incredible coder and wish you the best of luck in all your future endevors
1654556788
Nick O.
Forum Champion
This script is fantastic, thanks for building it, Oosh! I do have one question though - when creating my own button, what's the correct syntax for the predefined styles? I've tried&nbsp;{{style=crit}} and {{style=styles.crit}}, but I got a plain white button each time. (I was able to successfully use a css string {{style=color: red; font-size: 1.5rem;}}) Thanks again for a great script!
Hi Oosh, Quick question, can you check if it is possible to make api work with the concentration api. for some reason when I apply the damage using the autobutton api to a character that has concentration the damage does not trigger the auto concentration check. If i take one point manually then the concentration API works.
1655291766
Oosh
Sheet Author
API Scripter
Nick O. said: This script is fantastic, thanks for building it, Oosh! I do have one question though - when creating my own button, what's the correct syntax for the predefined styles? I've tried&nbsp;{{style=crit}} and {{style=styles.crit}}, but I got a plain white button each time. (I was able to successfully use a css string {{style=color: red; font-size: 1.5rem;}}) Ah yep, that is a bug in the editButton() function. It doesn't check the styles object for the keyname, sorry about that. Not sure when I'll get time to fix it. Your syntax was correct though - it will work on addbutton, but not on editbutton. In the meantime, pasting the css string will have to be a workaround. The inbuilt styles are: &nbsp; &nbsp; crit : `color: red; font-size: 1.5rem;` , &nbsp; &nbsp; full : `color: darkred; font-size: 2.1rem;` , &nbsp; &nbsp; half : `color: black; font-family: pictos three; font-size: 2rem; padding-top:1px;` , &nbsp; &nbsp; healFull : `color: green; font-size: 2rem;` , Thanks for reporting that. Will fix it when I get time. Warlord said: Hi Oosh, Quick question, can you check if it is possible to make api work with the concentration api. for some reason when I apply the damage using the autobutton api to a character that has concentration the damage does not trigger the auto concentration check. If i take one point manually then the concentration API works. Do you have a link to the Concentration script just so I know I'm looking at the right one? Autobuttons just sends tokenMod commands - does the concentration script normally work if you use tokenMod to subtract the HP?
Does the button click send a whisper to the DM that the damage or heal was applied.&nbsp;&nbsp;&nbsp; Example DM pressed the button to apply the damage/heal, group takes a break for 10 and comes back, is there something that tells the DM he applied the damage before the break in the chat window?
Hi Oosh, Thanks a ton for this awesome script! Question: I can't figure the right syntax for HalfCrit button. The thing is, it's just doesn't do the math right, unfortunately :( The current syntax I'm using is&nbsp;{{math=-floor(crit.total + damage.total/2)}} Please, let me know if this one is correct. Thank you!
1656166451
Nick O.
Forum Champion
The current syntax I'm using is&nbsp;{{math=-floor(crit.total + damage.total/2)}} Try adding another set of parens&nbsp; {{math=-floor((crit.total + damage.total)/2)}} I think that will do it for you.
Nick O. said: The current syntax I'm using is&nbsp;{{math=-floor(crit.total + damage.total/2)}} Try adding another set of parens&nbsp; {{math=-floor((crit.total + damage.total)/2)}} I think that will do it for you. It works perfectly.
1656291867
Oosh
Sheet Author
API Scripter
Rouse said: Does the button click send a whisper to the DM that the damage or heal was applied.&nbsp;&nbsp;&nbsp; Nope, nothing in there, but trivial to add whenever I do get time to do anything Roll20 related. I'll add it to the list. I'd imagine it'll just be a toggle which can be set to Chat / API log / Silent [default]. I can't imagine most DM's wanting all that spam in the chat window, but I can also see the use case with walking away from the table - my group always has to post something to chat when XP is awarded at the end of a session as a reminder.
How to i enable public rolls from NPC to players to show in chat so that the players can alternativelly click the buttons bellow for their damage or heals?
So I have a rogue monk with 2 attacks. Because of this I have him add the sneak attack damage after he makes his attacks, that way it is only added once. However the autobutton does not recognize global damage modifiers if rolled separately. The only other way of doing this is adding it as a separate attack. Is there a way for AutoButton to recognize the global damage modifiers?
1656427878
Oosh
Sheet Author
API Scripter
Nova said: How to i enable public rolls from NPC to players to show in chat so that the players can alternativelly click the buttons bellow for their damage or heals? The --gmOnly flag should toggle this on and off. It means the buttons will be posted publicly instead of whispered to the GM, and should also be triggered from all damage rolls, not just NPC ones. Post back if it isn't working as expected. RadioFlier said: So I have a rogue monk with 2 attacks. Because of this I have him add the sneak attack damage after he makes his attacks, that way it is only added once. However the autobutton does not recognize global damage modifiers if rolled separately. The only other way of doing this is adding it as a separate attack. Is there a way for AutoButton to recognize the global damage modifiers? Can you explain how you're rolling the globals 'separately'? autoButtons recognises a limited number of roll templates - if you're not using one of those for the sneak attack, the damage will be ignored. Global damage should be picked up when it's rolled as part of a recognised damage template - let me know if that isn't the case. If you post back the macro you're using for sneak attack damage that will narrow down the issue.
Nick O. said: The current syntax I'm using is&nbsp;{{math=-floor(crit.total + damage.total/2)}} Try adding another set of parens&nbsp; {{math=-floor((crit.total + damage.total)/2)}} I think that will do it for you. Works like a charm! Thank you, Nick!
Hey Oosh, here is the &nbsp;Api for the concentration api that warlock was talking about I’m also wondering the same thing: on('ready', () =&gt; { const TOKEN_CONCENTRATING_STATUS_MARKER = "status_" + "Concentrating::35390"; on("change:graphic:bar1_value", function(obj, prev) { &nbsp; &nbsp; if (obj.get(TOKEN_CONCENTRATING_STATUS_MARKER)) { &nbsp; &nbsp; &nbsp; &nbsp; log ("status marker is " + obj.get(TOKEN_CONCENTRATING_STATUS_MARKER)); &nbsp; &nbsp; &nbsp; &nbsp; //let playerPage = Campaign().get("playerpageid"); &nbsp; &nbsp; &nbsp; &nbsp; //let tokenPage = obj.get("_pageid"); &nbsp; &nbsp; &nbsp; &nbsp; if (prev["bar1_value"] &gt; obj.get("bar1_value")) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let final_conc_DC = 10; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let calc_conc_DC = (prev["bar1_value"] - obj.get("bar1_value")) / 2; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (calc_conc_DC &gt; final_conc_DC) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; final_conc_DC = Math.floor(calc_conc_DC); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let tokenName = obj.get("name"); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let theMessage = "/w gm &amp;{template:npcaction} {{rname=Concentration Check "+tokenName+"}} {{name="+tokenName+"}} {{description=[DC " +final_conc_DC + " Constitution](~selected|constitution_save)"+ "&amp;#10;" +"*[Toggle Concentration Marker](!token-mod --sel --set statusmarkers|!Concentrating)*}}"; sendChat("Concentration",theMessage );&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; } }); });
Jon said: Hey Oosh, here is the &nbsp;Api for the concentration api that warlock was talking about I’m also wondering the same thing: on('ready', () =&gt; { const TOKEN_CONCENTRATING_STATUS_MARKER = "status_" + "Concentrating::35390"; on("change:graphic:bar1_value", function(obj, prev) { &nbsp; &nbsp; if (obj.get(TOKEN_CONCENTRATING_STATUS_MARKER)) { &nbsp; &nbsp; &nbsp; &nbsp; log ("status marker is " + obj.get(TOKEN_CONCENTRATING_STATUS_MARKER)); &nbsp; &nbsp; &nbsp; &nbsp; //let playerPage = Campaign().get("playerpageid"); &nbsp; &nbsp; &nbsp; &nbsp; //let tokenPage = obj.get("_pageid"); &nbsp; &nbsp; &nbsp; &nbsp; if (prev["bar1_value"] &gt; obj.get("bar1_value")) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let final_conc_DC = 10; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let calc_conc_DC = (prev["bar1_value"] - obj.get("bar1_value")) / 2; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (calc_conc_DC &gt; final_conc_DC) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; final_conc_DC = Math.floor(calc_conc_DC); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let tokenName = obj.get("name"); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let theMessage = "/w gm &amp;{template:npcaction} {{rname=Concentration Check "+tokenName+"}} {{name="+tokenName+"}} {{description=[DC " +final_conc_DC + " Constitution](~selected|constitution_save)"+ "&amp;#10;" +"*[Toggle Concentration Marker](!token-mod --sel --set statusmarkers|!Concentrating)*}}"; sendChat("Concentration",theMessage );&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; } }); }); I am running into the same problem. I love using the auto button and kind of in a habit of it now. But when I have a player concentration we now forget about the con save half the time. has there been any fix to the problem?
1660480465

Edited 1660480638
Oosh
Sheet Author
API Scripter
Yeah sorry, I still haven't quite got around to updating the script. I would suggest changing the Concentration script as the best solution - if we register it with TokenMod, it will work with autoButtons, tokenMod and any other script that hooks into tokenMod. A minor reorganisation of the script should do it: on('ready', () =&gt; { const TOKEN_CONCENTRATING_STATUS_MARKER = "status_" + "Concentrating::35390"; const sendConcentrationCheck = (obj, prev) =&gt; { if (obj.get(TOKEN_CONCENTRATING_STATUS_MARKER)) { log("status marker is " + obj.get(TOKEN_CONCENTRATING_STATUS_MARKER)); //let playerPage = Campaign().get("playerpageid"); //let tokenPage = obj.get("_pageid"); if (prev["bar1_value"] &gt; obj.get("bar1_value")) { let final_conc_DC = 10; let calc_conc_DC = (prev["bar1_value"] - obj.get("bar1_value")) / 2; if (calc_conc_DC &gt; final_conc_DC) { final_conc_DC = Math.floor(calc_conc_DC); } let tokenName = obj.get("name"); let theMessage = "/w gm &amp;{template:npcaction} {{rname=Concentration Check " + tokenName + "}} {{name=" + tokenName + "}} {{description=[DC " + final_conc_DC + " Constitution](~selected|constitution_save)" + "&amp;#10;" + "*[Toggle Concentration Marker](!token-mod --sel --set statusmarkers|!Concentrating)*}}"; sendChat("Concentration", theMessage); } } } setTimeout(() =&gt; { if (typeof(TokenMod) === 'object') TokenMod.ObserveTokenChange(sendConcentrationCheck); }, 500); on("change:graphic:bar1_value", sendConcentrationCheck); }); There's a bit of a delay on registering with token mod, on the off chance anyone has autoButtons installed before tokenMod. Let me know if it doesn't work, though.
1660497405
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Thanks Oosh. I use that scriptlet for its simplicity, and share it when I see that someone is looking for that kind of solution. It's so old, I'm not even sure where I got it. But that's a good addition.
1660498048

Edited 1660498324
Hello, Love the addon! I was just wondering if I could get your help. How do I have the damage and healing done reported publicly to the chat? I DM on a toaster with a group of 6 so if they use something like mass cure wounds it would take me forever to do. I have whoever cast the spell heal the group instead but I would like it to report publicly so I can ensure the healing was done for the correct amount and only once. For example: Hank the barbarian hits Creature A with his sword for 10 damage. It was not a crit and the creature doesn't have resistance. I click the button to apply the 10 damage and Creature A loses 10 hp. I would like AutoButtons to report publicly to chat that "Creature A" has taken [10] points of damage. or if healing "Creature A" was healed for [10] points.
Warlord said: Hi Oosh, Quick question, can you check if it is possible to make api work with the concentration api. for some reason when I apply the damage using the autobutton api to a character that has concentration the damage does not trigger the auto concentration check. If i take one point manually then the concentration API works. Same issue here. Is there a chance to make this work with the "official" Concentration script?&nbsp; <a href="https://app.roll20.net/campaigns/scripts/13232893" rel="nofollow">https://app.roll20.net/campaigns/scripts/13232893</a>
1660533204

Edited 1660533677
Oosh
Sheet Author
API Scripter
Chad/Pyrias said: Hello, Love the addon! I was just wondering if I could get your help. How do I have the damage and healing done reported publicly to the chat? I DM on a toaster with a group of 6 so if they use something like mass cure wounds it would take me forever to do. I have whoever cast the spell heal the group instead but I would like it to report publicly so I can ensure the healing was done for the correct amount and only once. For example: Hank the barbarian hits Creature A with his sword for 10 damage. It was not a crit and the creature doesn't have resistance. I click the button to apply the 10 damage and Creature A loses 10 hp. I would like AutoButtons to report publicly to chat that "Creature A" has taken [10] points of damage. or if healing "Creature A" was healed for [10] points. Yeah, someone did request this 6 weeks ago and I haven't got around to it, sorry. I'll hopefully get some time over the next week to add that and a few other things. Vas said: Same issue here. Is there a chance to make this work with the "official" Concentration script?&nbsp; <a href="https://app.roll20.net/campaigns/scripts/13232893" rel="nofollow">https://app.roll20.net/campaigns/scripts/13232893</a> I'm not hugely interested in touching someone else's one-click repo, but I see Aaron is listed as a contributor. I'll run it past him and see what the thinks of a TokenMod observer. You're welcome to test this modified version if you wish, to see if it works. Disable your one-click version before manually installing it - also, if you grab code from pastebin, scroll right to the bottom and click the Copy icon next to the RAW Paste Data heading - the main prettified version occasionally does bad things to some punctuation. keithcurtis said: Thanks Oosh. I use that scriptlet for its simplicity, and share it when I see that someone is looking for that kind of solution. It's so old, I'm not even sure where I got it. But that's a good addition. Looks like you've attributed it to Three of Swords originally . Lucky keithcurtis1 is good at the record keeping!
1660537393
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Oosh said: Looks like you've attributed it to Three of Swords originally . Lucky keithcurtis1 is good at the record keeping! Three of Swords? Now there's a name I haven't heard in a long time. A long time.