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 .
×
Advertisement Create a free account

[Script] Token Action Maker v.0.2.7

1613941846
GiGs
Pro
Sheet Author
API Scripter
That seems like a pretty simple and unobtrusive way to let people preserve their modified or custom TAs. Sounds good.
1613942519
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I also added a new command: "deleteallta" which will nuke the whole list, protected or not.
keithcurtis said: Last week's merge seems not to have happened, yet. In the meantime, I'd like to run this past those who use the script. Currently "!deleteta" deletes all token actions. This is useful for getting rid of all the actions created by TAM, but will also wipe out anything the user may have built. I am proposing a filter to protect specific token actions. The simplest method I can think of it adding a character to the name that protects it, but it needs to be as small and unobtrusive as possible. If no one sees any unforeseen consequences, then any Token Action that ends in a period will not be deleted by TAM. So "longsword" will be deleted, but if you have edited the token action to make a swooshing sound, rename it "longsword." Likewise, if you build an action to toggle your rage, or emote something or anything other than the default TAM actions, protect it by putting a period after the name. Before: After !deleteta I really like this way of allowing deletion of selected token actions. Easy to remember (add period to keep) and easy to execute.
keithcurtis said: Last week's merge seems not to have happened, yet. I don't think it's happened this week either. I tried to use !sortta in the middle of my Friday-evening session to put token actions on one of my baddies, and it gave me that same behavior, where the chat message said the actions had been created when in point of fact they hadn't. Looking forward to that fix coming soon!
1614497216
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Not sure what's going on. The script is correct on the Roll20 github repository, but it doesn't install or import to the latest verison on the One-click. I'll investigate, but until I can figure it out, if anyone needs the latest copy, it's here .
1614497769
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I figured out the issue, and it's on my end. Updated the main script, but not the one in the version number folder. At least not properly. Until I get it worked out, use the link I posted if you need the latest.
1614497842
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Still a bit mysterious. The readme is also from the previous version.
Would it be possible to split out saves as an option?  I find searching for the right save in the drop down slows down my game a little bit.
1615000156
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I'm loathe to mess with the basic functionality, but fortunately, the keyboard is your friend here. You need a con save? Just click on the drop down and start typing constitution. Since it comes right after charisma, you just have to type co and press enter. Ability checks can work the same way. You could also go with a  Chat Menu  approach here.
1615767351
This is a great script! As a DM I have dozens of monsters so this is  a huge time-saver for me. I made a trivial change to the script (I hope you don't mind): I prepended a 't-' for traits, and a 'r-' for reactions. It sorts better for me now.
1615788091
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Anybody is free to alter any script for their own games, sure!
1616346258
Just noticed a problem with generating traits. This is what I get when trying to use the various traits of a Drider. It doesn't seem to matter if it's an old creature (not just Driders) that I transmogrified or a new creature that gets the . on the trait button. Also does not matter if I used Sort or not.
1616354573
David M.
Pro
API Scripter
Danielle, I noticed something similar. I think (I hope?) it's related to a recent update that I heard messed with repeating entries on npc sheets due to some typo or incorrect parsing. Hopefully will be fixed soon. 
1616355087
Yeah, I've been watching Roll20's Twitter over the past week or so constantly rolling back some issue or other regarding attempted character sheet updates. I was in the process of setting up a bunch of monsters, but I'd rather wait until I know if it's going to be wasted effort. At least the ones I've already set up can remind me what traits they have, even if I can't use those buttons.
1616355503

Edited 1616357312
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
That is exactly the issue. I sincerely hope this is fixed. I am not going to update the script because I believe that such an egregious error will be soon corrected, but if you want to use the generation of traits in the meantime, you can install the script manually and change lines 336 and 399 from: createRepeating(/repeating_npctrait_[^_]+_name\b/, 'repeating_npctrait_%%RID%%_-npc_roll_output', a.id, usename); to createRepeating(/repeating_npctrait_[^_]+_name\b/, 'repeating_npctrait_%%RID%%_oll_output', a.id, usename); You could also skip generation of traits for the time being by listing everything but: traits, using the pc option for the macro: !ta pc Devs are aware of the roll issue . I am hoping for a Tuesday pull fix.
1616520963
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
It looks like the error has been fixed, but it has also fixed something that was  previously  broken. Previously: %{selected|repeating_npctrait_$0_-npc_roll_output} would work, but it was incorrect, or at least did not follow sheet style. I reported it at the time, but was told that was how it had to be. Notice that there is a hyphen in front of the word "npc" after the position number. It is now actually what it should have been all along: %{selected|repeating_npctrait_$0_npc_roll_output} Nothing else on the sheet had that niggling little hyphen in that position. For those using the Token Action Maker script, I have submitted a fix that will bring it up to the old, old, correct terminology.
1616521609
It looks like Reactions still haven't been updated. They are still using  %{selected|repeating_npcreaction_$0 _oll_output }
1616526145
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Well at least that was was correctly formatted before the glitch and should resolve itself automatically when the sheet is updated again.
1617057437
Still having issues with NPC traits.  Keith you had mentioned in another thread that you might need to make an adjustment to the API.  Is that still the case?  Thanks so much!
1617075998
keithcurtis said: Well at least that was was correctly formatted before the glitch and should resolve itself automatically when the sheet is updated again. Reactions and traits both had that rogue hyphen after the repeating number. I still have an old test copy game and saw it there, and it's listed on your gist on lines 335 - 340.                         if (args.includes("traits")) {                             createRepeating(/repeating_npctrait_[^_]+_name\b/, 'repeating_npctrait_%%RID%%_-npc_roll_output', a.id, usename);                         }                         if (args.includes("reactions")) {                             createRepeating(/repeating_npcreaction_[^_]+_name\b/, 'repeating_npcreaction_%%RID%%_-npc_roll_output', a.id, usename);                         } So once the character sheets get sorted, we'll definitely have to keep an eye on whether they keep that hyphen on the traits and reactions!
1617088751
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Wow, if I updated that gist, that was an error. I only update the copy on my fork of the Roll20 git and then submit a pull request. Not sure how that happened, but that's 0.3.3. The latest copy is on my fork , and now on the Roll20 repository . It's correct there, and should have propagated to one click already (just got the notification today). I should probably delete the gist, and sorry for any confusion that caused anyone.
1617089061

Edited 1617089430
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I'm not sure if I should just delete it (I've never been deeply educated as to how git works, so I don't know if that would screw anyone up, since some number of folks have bookmarked it), but I have replaced the contents of the readme file with a link to the latest code. I have also removed that link from the top post. Again, if you are using the One click version, it should work, but if you have created any macros using Roll20's old sheet code (notably, reactions and traits as Jarren mentions above), you will need to regenerate those.
So I just found this script, and it helps me out a lot - previously I had pre-set Monster sheets that I had Token actions in that I then had to manually name/ Not a massive issue, but this really speeds things up. One question - is it possible / how would I go about making Ability Token actions whisper their result to me, rather than have them just display in the chat?
1620938198
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
That is dependent on the sheet setting. If the monster is set to whisper, its actions will.
1622306089

Edited 1622306132
Hey @keithcurtis, very grateful for the mod, and have been putting it to very good use. I'm using it to craft token actions for my PC's, but when they level up and gain new actions, I've executed the "!ta" action and it seems to cause a few things: Duplication of some things that already have token actions (Quarterstaff 1H and 2H come to mind as having been duplicated) and any token actions that had been unchecked from "in bar" become rechecked. Just checking to see if there is a better way of my updating the token actions when a character reaches new levels, or if it is better to wipe the tokens and create them fresh. Thanks in advance!
1622306441

Edited 1622306540
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
There's some faulty logic in there that abbreviates  things like "One Handed" and then checks for duplicates rather than the other way around. I haven't gotten around to diving back into it. I have gotten into the habit of protecting the abilities I want to keep with a period at the end (see here ), wiping the others with the delete command and then regenerating. I use a macro with different setups for PC and NPC to generate the abilities I think would be most useful (Don't usually need traits on PCs, for instance).
1625034165
I'm posting a feature request to nest all of Token actions macros in either a query or like the spells button, a chat nesting.  I'd imagine it would get really complex if you tried to next the spells macro though.  But it would be pretty interesting if we could do that, cause players in my games tend to get 10+ buttons outside of Token action makers so anything to free up the clutter.  I don't even know if you can next token action macros.  
1625074742
They could uncheck the ones they don't want on their Token. Or just skip the traits for PCs entirely. I've played around with nesting token action macros, but it does get tricky and may not work depending on the syntax of the nested macros.
1625076394
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I definitely avoid using traits for PC actions. FWIW, here are my choices for actions: PCs !ta attacks spells saves checks NPCs !ta attacks spells saves checks reactions traits
1625091887
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hey folks. Quick update. I was unaware that Roll20 had not properly fixed the syntax of the reactions actions. I have reported this . Like before, it would be better to wait for the sheet to be correct than to fix the script to a malformed syntax. Details in the link.
1625167947
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Report: The sheet fix got backlogged, but has now been pushed up in priority.
1625866911
I stopped using the script for players sheets but heavily use it for npcs.  Also fyi about reactions, I actually almost always edit any npc reactions to be in the actions section because 9/10 of the time you want that option to roll in the fields below the text blurb that you only get in the actions section of the r20 npc sheets.  I just preface the name of the "reaction" as Reaction: in the actions section.  The 5e by r20 npc sheet has flaws but easy to dance around.   I stopped using the script for players cause players change their sheets too often and I wanted to have a foldered view of actions, bonus actions, and reactions for them so I am starting my own side project.  Essentially everything is stored on a sheet they can all access but is hidden in folders away so they don't mess with it.  Then I create all the custom templates and api features for various keys there and make sure that all calls to sheets are set with a "selected" syntax and when they add things to their sheet I can quickly just guess the syntax of the ability cause I have a naming scheme, so I'd know if they slotted Healing Word, to do %{Master|HealingWord} and they would then call the main setup for healing word when they want to cast it, which would also whisper them a "cast" macro with api support for adjusting a hitpoint bar and adjusting their spell slots.
1628984362
Is there no way to "folderise" Traits in the same way Spells are?
1628985999
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
If  you are talking about DM Eddie's post above, I'll let them answer. But to make a button that calls up a chat menu or drop down list? There probably is. I am waiting for the dust to settle on the dropdown nesting changes that were recently made before I investigate more changes on this yet. I am hoping it may allow me to fix the issues with advanced skill checks for PCs.
1628990647
My attempts at a workaround have revealed that I don't know what I'm doing at this level! 😋 I can't code an API so I figured to try and stack this as a chat menu macro on the basis that buttons would be obvious when no attribute was present, avoiding having to know how many attributes. Ugly, but I thought perhaps &{noerror} would bail me out. This is as far as I can get it - but it's not robust, something about the "Spellcasting" description syntax breaks it and pushes the description next to the button. I'm hopeful that the API can produce something more elegant. If not is anybody able to push this macro to the next level? /w gm &{template:npcaction} {{rname=@{selected|token_name} Traits}} {{description= [@{selected|repeating_npctrait_$0_name}](`/w gm @{selected|repeating_npctrait_$0_description}) [@{selected|repeating_npctrait_$1_name}](`/w gm @{selected|repeating_npctrait_$1_description}) [@{selected|repeating_npctrait_$2_name}](`/w gm @{selected|repeating_npctrait_$2_description}) [@{selected|repeating_npctrait_$3_name}](`/w gm @{selected|repeating_npctrait_$3_description}) [@{selected|repeating_npctrait_$4_name}](`/w gm @{selected|repeating_npctrait_$4_description}) &{noerror} }}  
1628995657
If you’re looking for a non-API option, you can check out this universal chat menu for D&D 5E.  
1629840990
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
keithcurtis said: Hey folks. Quick update. I was unaware that Roll20 had not properly fixed the syntax of the reactions actions. I have reported this . Like before, it would be better to wait for the sheet to be correct than to fix the script to a malformed syntax. Details in the link. As of this morning's update (8/24/21) the sheet issue with reactions has been fixed. Existing monsters and buttons should work automatically, but if they don't you might need to open and close the creature to force a sheet update.
1629841476
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
MykeMyke said: My attempts at a workaround have revealed that I don't know what I'm doing at this level!  I can't code an API so I figured to try and stack this as a chat menu macro on the basis that buttons would be obvious when no attribute was present, avoiding having to know how many attributes. Ugly, but I thought perhaps &{noerror} would bail me out. This is as far as I can get it - but it's not robust, something about the "Spellcasting" description syntax breaks it and pushes the description next to the button. I'm hopeful that the API can produce something more elegant. If not is anybody able to push this macro to the next level? The approach you are looking for has some limitations. The code you posted can be improved somewhat: /w gm &{template:npcaction} {{rname=@{selected|token_name} Traits}} {{description= [@{selected|repeating_npctrait_$0_name}](!
/w gm  @{selected|repeating_npctrait_$0_description}) [@{selected|repeating_npctrait_$1_name}](!
/w gm  @{selected|repeating_npctrait_$1_description}) [@{selected|repeating_npctrait_$2_name}](!
/w gm  @{selected|repeating_npctrait_$2_description}) [@{selected|repeating_npctrait_$3_name}](!
/w gm  @{selected|repeating_npctrait_$3_description}) [@{selected|repeating_npctrait_$4_name}](!
/w gm  @{selected|repeating_npctrait_$4_description})}} &{noerror} But it is still limited in that some characters in the description (like parentheses) will break the output. This video should help you with API script installation if you still want to try Token Action Maker: How to Install Roll20 API Scripts
1630092026
Hello everyone! Just wanted to know if it was possible to integrate !ta maker with token-mod or alterbars, that way the npc actions can auto deduct HP from target token if the attack hits? Or, If there was a way to input a custom format for the data pulled from the sheet by the API, and to make a custom format. The attack template I use is with Scriptcards: !scriptcard {{ --&name|Dagger --&die|1d4 --&type|piercing --=dmgMOD|0 --=hitMOD|0 --=attr|@{Andee|dexterity_mod} [DEX] --#title|[&name] Attack! --#titleFontSize| 40px --#bodyFontSize| 24px --#leftsub|Hybrid Attack --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --#emoteText|@{selected|token_name} attacks @{target|token_name} --=TargetAC|@{target|npc_ac} --?[$TargetAC.Total] -gt 0|DoneWithAC --=TargetAC|@{target|ac} --:DoneWithAC| --&RollType|?{Advantage or Disadvantage?|Normal,1d20|Advantage,2d20kh1|Disadvantage,2d20kl1} --=Roll|[&RollType] --=AttackRoll|[$Roll] + [$attr] + @{selected|pb} [PROF] + [$hitMOD] --+Attack|@{selected|token_name} rolls [$AttackRoll] vs AC [$TargetAC]. --?[$Roll] -eq 20|Crit --?[$Roll] -eq 1|Fumble --?[$AttackRoll.Total] -ge [$TargetAC.Total]|Hit --+Miss|The attack missed. --^Final| --:Fumble| --+Fumble!|The attack went horribly wrong. --^Final| --:Hit| --&sneakq|?{Sneak Attack?|Yes,Yes |No,No} --?[&sneakq] -eqi Yes|[ --=sneakdie|@{Andee|base_level}/2{ROUND} --=sneak|[$sneakdie]d6 --]|[ --=sneak|0 --]| --=Damage|[&die] + [$attr] + [$dmgMOD] + [$sneak] --+Hit!|The [&name] hit @{target|token_name} for [$Damage] [&type] damage. --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage] --^Final| --:Crit| --&sneakq|?{Sneak Attack?|Yes,Yes |No,No} --?[&sneakq] -eqi Yes|[ --=sneakdie|@{Andee|base_level}/2{ROUND} --=sneak|[$sneakdie]d6 --]|[ --=sneak|0 --]| --=Damage|[&die] + [$attr] + [$dmgMOD] + [&die] [CRIT] + [$sneak] + [$sneak] --+Critical Hit!|The [&name] hit @{target|token_name} for [$Damage] [&type] damage. --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage] --]| --:Final| }}
1630093042
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
All TAM does (by intent) is create links to actions built into the sheet (with the exception of checks and saves, due to the weird architecture of the D&D 5th Edition by Roll20 Sheet. I do not wish to put in anything that requires the API in any way. Although it requires the API to create the button, I want the buttons to work if the user later downgrades. Also, module creators are free to use this for added value in marketplace offerings, producing buttons that will work for all users, regardless of subscription level. If someone wants to fork something that does what you are describing, they can do so. And unfortunately, I don't use Script Cards, so I wouldn't be able to comment on how they could be integrated.
1630093189
Oh well, thanks for the info!
1631377004
Are !sortta commands broken right now? !ta seems to work but not the sorted version (with or without arguments)...
1631378231
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hmm. they seem to be working on my end. Here's a screen capture. Are you getting bad results, no results or a crash? And are you using the latest version installed by One Click?
1631378866
Yes I'm on 1 click, no crash and I'm getting the report line...
1631417193
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Can you tell me an example character to test with? I can't reproduce this.
1632076775
I'll get in touch with a game link
1632355764
Private message sent on this one Keith
1633049920
Is there a script or a macro I can add under the abilities tab on the Roll20 character Sheet that will roll superiority dice damage? Or maybe a simple 1d8 dice roller macro?
1633094082
The simplest way to do that is to add an ability and populate it with /r 1d8 [Superiority Die] If you want to get fancier, you can add an "attack" to the repeating attacks section, and TAM will create the button for you. You can also create an attribute that determines the size of the superiority die based on Fighter Level and use that attribute in place of 1d8 to update the roll dynamically.
1633364661
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Remember, with a custom ability, it's a good idea to end the name with a period, so that you can regenerate the token action buttons if need be without erasing your custom work.