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] Token Action Maker v.0.2.7

So npcaction won't need to be changed to  npcfullatk  in macros that this script makes?
1596661645
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I don't know yet. The sheet just got patched and has not yet gone live. Let me know if you see any issues after the next push, which should be sometime tomorrow.
1596754185

Edited 1596754786
Just had something interesting happen.  As I mentioned in the thread I linked above, I noticed issues with output on actions that have attack rolls, no damage, but have a description.  Only the attack roll is outputting in chat, and not the description.  The example I mentioned was a Giant Spider's web attack in 5e.  So I just fired up a Mad Mage campaign I'm running tonight.  Just for kicks, I opened the character sheet and clicked on the Giant Spider web attack from the sheet.  The output was fine- attack rolls and description.  Now this was a token I haven't used yet in that game and haven't used TA on, so I then dropped one and used Token Action Maker on it.  Now it does not output properly, either from the macro or the character sheet. Here's the code of the macro that TA made: %{-LNGAFfpJSN0N8-Z1LR-|repeating_npcaction_-LNGAFt9PiMTZgMikQ5R_npc_action} So it appears that the issue is fixed in Roll20, but the macros that Token Action Maker makes are not working properly and are affecting the sheet itself. Wanted to give that feedback. EDIT: Even when I !deleteta and click off of the character sheet, it still does not output correctly.  So again, this action on this character sheet was working properly before I used TA, but is no longer working after I used TA on it.
1596756186

Edited 1596756692
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I was getting a lot of seemingly inconsistent results, so I created a brand new pristine game using the D&D 5th Edition by Roll20 Sheet—no script. I dragged a giant spider in. When I click the web action, I get a roll template with the attack button linked to the damage template. As soon as I switch over to auto roll crit and damage, I get no description. It seems to be that if there is no damage, there is no description. So I don't think it is necessarily the script here. I have reported the behavior to the sheet thread with repro steps.
1596756789

Edited 1596756864
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
The odd behavior might have resulted from physically opening the sheet, which would force any sheetworkers or conversions to occur. It would convert the monster to the new sheet configuration. Not sure if running the script would generate the same behavior, but apparently so. BTW, thanks for finding this. I ran some rough tests this morning, and all looked fine, but didn't test that particular case of an attack roll with no damage.
1596766854

Edited 1596766996
No problem and thanks for checking it all out! I'm not getting a difference when I turn off auto-roll damage.  I saw in the other thread that that was a fix, but it makes no difference on my end.  I'll interact over there maybe.
1596770033
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Yeah, once it's bollixed, it's bollixed.
I love this script, it really makes Roll20 more playable. I think I was using the old version of this from before Keith updated it, but you would need to delete and re-run !ta after leveling up because spells wouldnt update.  Is that still the case?   My players will most likely level up in the next week or so and I usually need to remind them to erase and re-run !ta
1597118266

Edited 1597118504
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Yeah, the menu is built from the spells. You don't need to delete, though. Just running !ta spells should re-write that macro. You could put it on a button for your spellcasters.
Great, Thanks!
keithcurtis said: Yeah, once it's bollixed, it's bollixed. Sorry for the late follow up, but what does this mean?  That even though it is fixed it will stay broken in my game and would need to start a new one?  The abilities (attack roll with a description but no damage) still only show attack rolls and nothing else.  I have way too much work done on this campaign to start it from scratch.  Do I just need to live with it for these types of abilities?
1597424043
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
No, I meant once the character has updated to the newest version of a sheet, it's a done deal. If the sheet changes again (which it has) it will update to that new sheet version. Try opening and closing a character that had an issue (to force the update).Use the Giant Spider example from above. It should behave normally now. (It may not even require opening and closing. I'm not 100% certain how the D&D 5th Edition by Roll20 Sheet does everything it does.)
1597528270

Edited 1597529192
The Giant Spider attack still doesn't work properly.  I guess I'll post over there again. EDIT: Fiddled around, and I just have to delete any of character sheets that use those types of attacks and redrop them from the MM.  Works properly now.  I'll see if it works from scratch as well.
1597529366
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Opening and closing the sheet did not force a change in behavior? Oh well, there are very few creatures that have an attack roll and no damage, thankfully.
Shout out to Keith and Kevin for this script. It has cut my game prep time significantly and well worth the upgrade to Pro. 
1597967578
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Thank you, and repeated thanks to Kevin.
1599770945
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
For folks following the thread, the Giant Spider issue above was a problem with the D&D 5th Edition by Roll20 Sheet that has since been addressed by the devs.
1603886033
David M.
Pro
API Scripter
Thought I posted this last night, but the forum seems to have eaten my post, so trying again: Are Global Skill & Global Save mods supposed to be implemented now? Reference this older post for details - I'm having the same issue. Toggling these in the character sheet does not affect the output when using the "Check" or "Save" token actions created by the script. It seems that Global Att/Dam is working fine. I thought it was because I had it manually installed and maybe had an older version, but grabbing it from the one-click did not solve. Apologies if this was addressed earlier and I missed it.
1603898557
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
In most cases, the script merely creates a custom action that calls an existing action created by the sheet: %{-Lhhv9OU5gTEdZiX_iCs|repeating_attack_-Lhi2rM-sEHR8SBFc7dD_attack} Unfortunately, some of these are impossible to code into a drop down query, notably, saves and checks. Checks are especially difficult since the current sheet resolves these to an attribute instead of an action, which expands before the query is called and absolutely wreck the code. I have discussed this with a couple of folks, but haven't found a decent solution. I'm loath to move to a Chat Menu (there are better solutions for a Chat Menu approach), and don't want to move to an API-assisted roll, since the goal is to create something that does not require the continued presence of the API to function. (A player should be able to move their character into a non-API game and still have the buttons work.) It's something I am aware of, but do not yet have a good solution for, given the sheet architecture.
1603900459
David M.
Pro
API Scripter
Got it, thanks for the explanation, Keith!
1603944266

Edited 1604028872
Oosh
Sheet Author
API Scripter
I've rejiggified the way the macro is put together, just for testing - it's now in a looped template literal so it's extremely easy to make future changes. It's just the player macros, and currently just outputs to Console so you can copy paste into chat. It has inline labels for everything and the global field is working. Let me know what you think and I can do the NPC ones and see if Keith is keen to update the script. Reliable Talent is the only thing not working. I've got a slightly broken version working (there's an extra 3d die roll for single rolls), and think I'm going to have to admit defeat on that one - happy to throw it in here if anyone wants to test it though. It would be a separate macro (very easy to do with the looped template literal) so it would only affect rogues. Added bonus of the global field applying to straight-up Ability Checks, which the official sheet doesn't do. I've probably whined about that enough though. Anyway, just uncomment one of the bottom 2 lines to generate the macro to console (regular console.... remove the "console." as well for API console, obviously): let skillLabels = ['Acrobatics','Animal Handling','Arcana','Athletics','Deception','History','Insight','Intimidation','Investigation','Medicine','Nature','Perception','Performance','Persuasion','Religion','Sleight Of Hand','Stealth','Survival']; let skillArray = skillLabels.map(a => a.replace(/\s/g,'_')) let abilityArray = ['Strength','Dexterity','Constitution','Intelligence','Wisdom','Charisma']; let skillMacroArray = []; let abilityMacroArray = []; let saveMacroArray = []; // player ability checks for (i=0; i < skillArray.length; i++) { skillMacroArray.push(`|${skillLabels[i]}, +@{selected|${skillArray[i]}_bonus}@{selected|pbd_safe}[${(skillLabels[i]+' ').slice(0,skillLabels[i].indexOf(' '))}]]]}} {{rname=${skillLabels[i]}}} {{mod=@{selected|${skillArray[i]}_bonus}}} {{r1=[[ @{selected|d20} + @{selected|${skillArray[i]}_bonus}@{selected|pbd_safe}[${(skillLabels[i]+' ').slice(0,skillLabels[i].indexOf(' '))}]]]`) } for (i=0; i < abilityArray.length; i++) { abilityMacroArray.push(`|${abilityArray[i]}, +@{selected|${abilityArray[i]}_mod}@{selected|jack_attr}[${abilityArray[i].slice(0,3).toUpperCase()}]]]}} {{rname=${abilityArray[i]}}} {{mod=@{selected|${abilityArray[i]}_mod}@{selected|jack_bonus}}} {{r1=[[ @{selected|d20} + @{selected|${abilityArray[i]}_mod}@{selected|jack_attr}[${abilityArray[i].slice(0,3).toUpperCase()}]]]`); } let pcAbilityMacro = `@{selected|wtype}&{template:simple} @{selected|rtype}?{Ability${skillMacroArray.join('')}${abilityMacroArray.join('')}}}} {{global=@{selected|global_skill_mod}}} @{selected|charname_output}` // player saves for (i=0; i < abilityArray.length; i++) { saveMacroArray.push(`|${abilityArray[i]}, +@{selected|${abilityArray[i]}_save_bonus}@{selected|pbd_safe}[${abilityArray[i].slice(0,3).toUpperCase()} SAVE]]]}} {{rname=${abilityArray[i]} Save}&#125 {{mod=@{selected|${abilityArray[i]}_save_bonus}}} {{r1=[[@{selected|d20}+@{selected|${abilityArray[i]}_save_bonus}@{selected|pbd_safe}[${abilityArray[i].slice(0,3).toUpperCase()} SAVE]]]`); } let pcSaveMacro = `@{selected|wtype}&{template:simple} @{selected|rtype}?{Saving Throw${saveMacroArray.join('')}}}} {{global=@{selected|global_save_mod}}} @{selected|charname_output}` //console.log(pcAbilityMacro); //console.log(pcSaveMacro); Anyways, if anyone feels like making sure I didn't break anything, that would be handy!
1603975299

Edited 1603977593
David M.
Pro
API Scripter
Groovy, Oosh! Just spot checked briefly, but looks like it is working well. One minor cut& paste typo: pcSaveMacro is currently pulling in the global skills modifier {{global=@{selected|global_skill_mod}} should be: {{global=@{selected|global_save_mod}} Also, a minor cosmetic point: the mouseover ToolTip in chat for one-word skills (no space) is truncated by one character, e.g. "Acrobatics" reads "Acrobatic". Something to do with the .slice(0,skillLabels[i].indexOf(' ') part, maybe since indexOf returns -1 when no space exists? Otherwise this is great and I'll be using it, thanks! 
1603985291
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
If it stands up, I'll put it into an update. Thanks Oosh! This is something I've wanted to do for some while, just lacked the block of time I would need to set aside for it.
1604029118
Oosh
Sheet Author
API Scripter
Awesome, thanks David! Have edited the above. If you're looking for something to ponder, I'd be happy to throw the Reliable Talent version at you, too :) Maybe you'll see something I've missed. I've come up with a minor improvement: I could bury the second d20 roll so it never rolls the 3d die. That would mean Adv & Dis both only roll a single animated die, that's probably better than having an extra roll for ordinary rolls? In all cases the template output is correct, anyway.
Awesome can't wait for the updated Version as i have the same Problem
1608617435

Edited 1608617466
Oosh
Sheet Author
API Scripter
Right, finally got around to looking at redoing the drop-down menus properly. Here is a test version - it's not the full script, just a few functions pinched out of it to support the new drop-down generation. It's very basic for now, with some rough chat logging and no arguments or other functionality - all it does is generate Ability Check and Saving Throw drop-downs. So if you type !rtTest with something selected (linked to a character sheet, of course) it will do a couple of checks - are you an NPC, and do you have any class or multiclass levels in Rogue? If Rogue levels are found, it will apply the RT version of the macro. This has a couple of issues which make it less than ideal for general use. Firstly, it will only roll one 3d die, regardless of how many go to chat. Unfortunately, I can't see a way around this without some assistance from a sheetworker, which we unfortunately have no control over. The other option was to always roll two 3d dice, regardless of the chat results - I figured that was even worse, but happy to hear opinions. Secondly, the tooltip info is a little uglier. I've made it as attractive as I can without obscuring the actual die roll, but it's still unnecessary clutter if you're not a Rogue. There's no harm in using it if you don't have RT though - it does check if RT is activated, and also checks if you are proficient in the skill. There shouldn't be any mechanical issues with using the RT version full-time, it's just those two cosmetic factors. Anywho, any feedback is welcome - RT related or otherwise. Is there anything else in the script that could do with a spit & polish while I'm in here? Requested features? Bugbears? I was also trying to decide on the best way to integrate this with the main script. Current thinking is: - If Bob has Rogue levels, but Reliable Talent is not switched on: create both Ability Check menus. Normal one is a token action, RT one is not , so by default it won't show up as a button. An alert is whispered to the character and the GM that the RT version is available on the character sheet if required - just tick the "token action" box, and untick the box for the normal menu - If Bob has Rogue levels, and RT is switched on: same as above, but with the RT version defaulting to "token action", and the normal version is hidden. Again, an alert sent to GM and the character letting them know that the other menu is available if they didn't want the RT one Any feedback on that part is also welcome. One final thing - I know the Clockwork Soul Sorcerer has a similar (mechanically) ability at level 14.... are there others?
1608656685

Edited 1608684672
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Champion fighters have  Remarkable Athlete Starting at 7th level, you can add half your proficiency bonus (round up) to any Strength, Dexterity, or Constitution check you make that doesn't already use your proficiency bonus. I can't remember if that has a sheet option like Jack of Trades. Sorry I've been a bit slow on this. I'd like to propose to the dev team to run the script on the NPCs for official modules. It's pretty stable right now, so I'm loath to make changes until we get the go ahead. That's another reason why I've wanted to make sure that the actions it produces do not require interaction with the API once created.
1608678871
Oosh
Sheet Author
API Scripter
Ah fair enough - there's not really any reason to include Reliable Talent for NPC's. Although having no global modifiers for straight Ability Checks and no global modifiers at all for NPC's is something which has needed fixing for some time. I guess that needs to be fixed on the sheet before including it a module macro though, to avoid inconsistencies.
Question:  Is there a way to bring up a chat menu for attacks much the same way as Spells are done?
1609287616
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Not within Token Action Maker, but you can check out  Universal Chat Menus , specifically these  5e Menu Macros  
I'm attempting to use this in a game of Adventures in Middle-earth that uses the 5E character sheet, but with slightly different skills and one new save. I've managed to replace two skills (religion/arcana) with their direct replacements, is there an easy way to add the remaining two new skills (Shadow Lore and Riddle) to the checks and the extra saving throw (Corruption)?
Love the script. I've searched around the forums but can't seem to find an answer. I'm trying to use the !sortta feature on tokens from the SKT compendium, specifically on monsters with legendary actions...but the token actions won't appear. Is this a known issue or only specifically happening to me? I've tested it on ancient dragons (like Iymrith) but not on any custom made NPCs yet. !ta works fine though. Any insight into this is appreciated, thanks! I guess it might be important to note that I'm somewhat new to APIs, so perhaps I'm being dumb and missing something obvious.
1611836941
David M.
Pro
API Scripter
Dan, I had a similar issue with the creatures from The Sunless Citadel module. !sortta would work for creatures from MM or SRD, but for TSC only !ta would work. We just lived with it and used !ta for those, but this might be interesting to try: If there is a duplicate MM version of one of the creatures in SKT, try deleting the SKT version from your journal and bringing the MM version in instead to see if !sortta magically starts working for that creature. I would recommend trying this on a copy of the game, however, as I can't remember if you will lose the tokens' "represents" links during the process. If it works, and you really want !sortta in your real game, you'd may need to make a token-mod macro to re-assign the "represents" property on the orphaned tokens in the module, selecting all the appropriate tokens and running the macro once per page.
I've run across sortta not working on some tokens. Near as I can tell, it happens on tokens preexisting on some older adventures I purchased (e.g. Eldritch Lairs). Re-dragging a token out of the compendium and running my monster setup macro on it generally fixes the issue and allows !sortta to work again. 
Thanks David and Jay, I'll try those work arounds! Seems like it is an old module issue then.
1611855142
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I actually don't use !sortta, but I'll look into what's happening when I can get the time.
if I make an Att Roll and I get a CRIT how do you add the Crit damage to the damage total output automatically? ie. AttDam =[[1d4]] CRTDam [[( AttDam )+1d4]]  = total
Trying this out for the first time, and noticed that !sortta adds "al-" instead of "la-" to legendary actions, as described on the script page, for creatures dragged in through the compendium and doesn't work at all on monsters added via add-on, as previously mentioned in this thread.
1613261602
David M.
Pro
API Scripter
That's for sorting purposes. If it were "la-" then all of the actions wouldn't necessarily be grouped together.
1613261751
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Danielle said: Trying this out for the first time, and noticed that !sortta adds "al-" instead of "la-" to legendary actions, as described on the script page, for creatures dragged in through the compendium and doesn't work at all on monsters added via add-on, as previously mentioned in this thread. The first issue is a fault of documentation, not the script. It is supposed to be "al-" to preserve grouping for folks who like to sort token actions in alphabetical order, rather than creation order, per the requestor and in line with the original writer of the script . I have corrected this. Not sure about the other issue. I cannot find anywhere up-thread that reposts a problem with add on monsters?
1613275036
David M.
Pro
API Scripter
This might be what Danielle is talking about. I was thinking at the time that it might be the Sunless Citadel module itself, but DM in one of my current games is running another module that is having the same problems. !ta works, but !sortta gives an affirmative chat message without actually creating anything. 
1613286814
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Ah, yeah, I looked back through the threads for anything about add-ons. I can reproduce the issue. Not sure what is the source, and I lack the hours it would take my creaky old skills to discover at the moment. Until I can work it out, using !ta still works and will need to be the workaround. Still, I'll ask some of my more powerful allies if they have any ideas.
David M. said: !ta works, but !sortta gives an affirmative chat message without actually creating anything.  I have run into this issue (and documented it in this thread) quite a number of times with preexisting creatures from marketplace content, though I didn't connect it to add-ons as such.
1613352498
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
It turned out to be simple enough even for me to fix. :) Module NPCs store the NPC attribute slightly differently than Compendium drop NPCs. I had a parseInt() that caught the issue on !ta, but missed it on !sotrta.* The fix is in a pull request and should hopefully be merged with the next pull. *This sounds like I know what I'm talking about. I just caught the difference and correcting it fixed the problem. Magic!!!
1613353269
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Jay R. said: Feature request for Token Action Maker: the option to truncate the text of the "Leader Variant" and "Button Recharge" abilities, both of which take up too much space on the token action menu. The Veteran of Geryon, for example, has both abilities, and their action menu is a hot mess as a result. :) Sorry for being deaf to some of these. I put them away for when I have time, and then forget I ever saw them, apparently. While I am making changes, I'll see if I can work these in as well. What would you suggest for the abbreviations? "-Leader"? "(Recharges after a Short or Long Rest)" should be shorter, but easily understood by the casual user. Some options: "-(R SR/LR)"? "-(R Short/Long)"? I'm leaning toward the second, since it's a little clearer, and could also cover abilities which only recharge on one type of rest. And are there any other common abbreviations?
keithcurtis said: Jay R. said: Feature request for Token Action Maker: the option to truncate the text of the "Leader Variant" and "Button Recharge" abilities, both of which take up too much space on the token action menu. The Veteran of Geryon, for example, has both abilities, and their action menu is a hot mess as a result. :) Sorry for being deaf to some of these. I put them away for when I have time, and then forget I ever saw them, apparently. While I am making changes, I'll see if I can work these in as well. What would you suggest for the abbreviations? "-Leader"? "(Recharges after a Short or Long Rest)" should be shorter, but easily understood by the casual user. Some options: "-(R SR/LR)"? "-(R Short/Long)"? I'm leaning toward the second, since it's a little clearer, and could also cover abilities which only recharge on one type of rest. And are there any other common abbreviations? No problem! Life gets in the way of gaming far too frequently, if you ask me. ;) For Leader Variant, Leader is fine (I've only ever seen it as Leader variant, though -- if there are non-variant Leader abilities, someone weigh in!). For Recharge, I agree that option 2 is clearer. 
1613358042
David M.
Pro
API Scripter
keithcurtis said: It turned out to be simple enough even for me to fix. :) Module NPCs store the NPC attribute slightly differently than Compendium drop NPCs. I had a parseInt() that caught the issue on !ta, but missed it on !sotrta.* The fix is in a pull request and should hopefully be merged with the next pull. Fantastic, thanks!
1613362901

Edited 1613363744
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
OK, it took some tricky Regex, but  "(Recharges after a Short or Long Rest)" > "-(R Short/Long)" "(Recharges after a Short Rest)" > "-(R Short)" "(Recharges after a Long Rest)" > "-(R Long)" And it should be able to ignore slight variations, such as if a creator has written "Recharges on a Short or Long Rest" with no parentheses. "[Anything] Variant" > "[Anything]" Current Recharge still functions, even if it is part of a larger string. Example: "Indomitable Strength (Recharge 5–6, Leader Variant)" > "Indomitable Strength-(R5–6, Leader)" Edit: "swarm has more than half HP" > "HP>Half" "swarm has half HP or less" > "HP<=Half"
keithcurtis said: OK, it took some tricky Regex, but  "(Recharges after a Short or Long Rest)" > "-(R Short/Long)" "(Recharges after a Short Rest)" > "-(R Short)" "(Recharges after a Long Rest)" > "-(R Long)" And it should be able to ignore slight variations, such as if a creator has written "Recharges on a Short or Long Rest" with no parentheses. "[Anything] Variant" > "[Anything]" Current Recharge still functions, even if it is part of a larger string. Example: "Indomitable Strength (Recharge 5–6, Leader Variant)" > "Indomitable Strength-(R5–6, Leader)" Edit: "swarm has more than half HP" > "HP>Half" "swarm has half HP or less" > "HP<=Half" Great! Looking forward to this in the next One-click.
1613941681
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
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