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

Is there a way to enable/disable "Show as Token Action" checkboxes on the Abilities and Attributes tab with a script?

November 15 (4 years ago)

Good afternoon, all. I have a question regarding the D&D 5e character sheet. I'm working with a player who has a druid who wild shapes into various forms. I'd like to create a button the player can use as a Token Action to quickly access the attacks for a given form. Here is a screenshot of my current setup...



I have created Abilities buttons that allow me to change my rollable token and certain attributes using the TokenMod and ChatSetAttribute scripts. I am using Roll20 as a Pro level user. I created a sample attack - Wolf Bite - and I have the "Show as Token Action" currently disabled. What I would like to do is add a line in my Morph-3-Wolf button that would enable the "Show as Token Action" checkbox for the "Wolf-Bite", when the player moprhs to that form. Additionally, when the player morphs into a different form, I would like to add lines in those buttons to disable the "Show as Token Action" checkbox for the "Wolf-Bite". The effect would be that when the player is in a given form, the attacks for that specific form appear as Token Actions. Thia would minimize going to the character sheet to look up attacks. I haven't seen any scripts or suggestions yet that offers any suggestions. Is this something that is possible using the script functions in Roll20? Or would something like this require writing a new API? I'm not a programmer, per se, so I was hoping to use the syntax from existing scripts. Any suggestions would be greatly appreciated. Thanks again.. 

November 15 (4 years ago)


November 16 (4 years ago)

I'm not aware of any script that does that currently, but I'm sure it's possible, as the 'Show as Token Action' is exposed to the API.  And I know the TokenActionMaker script does create token actions that have that field checked.

November 16 (4 years ago)

Edited November 16 (4 years ago)
Oosh
Sheet Author
API Scripter

Well there's the Wildshape script which is specifically for Wildshaping Druids. That should handle everything for you.


Failing that, I'd highly recommend a universal macro - that's what I use for my Druid in a non-API game. Here's a very hacky example - you can make a much better one with either API or using Stylus, but this one should work pasted straight into chat for any selected token linked to an NPC sheet:

&{template:npcaction} &{noerror} {{rname=@{selected|character_name}}} {{name=@{selected|npc_type}}} {{description=[@{selected|repeating_npcaction_$0_name} ](~@{selected|character_name}|repeating_npcaction_$0_npc_action" style="border:none;background-color:rgba(0,0,0,0);color:blue;font-weight:bold;display:none;display:@{selected|repeating_npcaction_$0_name|max}inline)
[@{selected|repeating_npcaction_$1_name} ](~@{selected|character_name}|repeating_npcaction_$1_npc_action" style="border:none;background-color:rgba(0,0,0,0);color:blue;font-weight:bold;display:none;display:@{selected|repeating_npcaction_$1_name|max}inline)
[@{selected|repeating_npcaction_$2_name} ](~@{selected|character_name}|repeating_npcaction_$2_npc_action" style="border:none;background-color:rgba(0,0,0,0);color:blue;font-weight:bold;display:none;display:@{selected|repeating_npcaction_$2_name|max}inline)
[@{selected|repeating_npcaction_$3_name} ](~@{selected|character_name}|repeating_npcaction_$3_npc_action" style="border:none;background-color:rgba(0,0,0,0);color:blue;font-weight:bold;display:none;display:@{selected|repeating_npcaction_$3_name|max}inline)
[@{selected|repeating_npcaction_$4_name} ](~@{selected|character_name}|repeating_npcaction_$4_npc_action" style="border:none;background-color:rgba(0,0,0,0);color:blue;font-weight:bold;display:none;display:@{selected|repeating_npcaction_$4_name|max}inline)
[@{selected|repeating_npcaction_$5_name} ](~@{selected|character_name}|repeating_npcaction_$5_npc_action" style="border:none;background-color:rgba(0,0,0,0);color:blue;font-weight:bold;display:none;display:@{selected|repeating_npcaction_$5_name|max}inline)}}
November 16 (4 years ago)
David M.
Pro
API Scripter

+1 for Wildshape script. Another option is using a rollable table token and the token-mod script with chat menus, as described here. Token-mod changes the represents property to various character sheet forms, along with vision, size, etc. If the forms' sheets are already set up with token actions (say using the Token Action Maker script), then you're set.

November 16 (4 years ago)

Thanks, Jarren K, Oosh, and David for the responses. Jarren, I looked at both of the links you sent. I think the API info is specifically useable if you're going to write APIs, so that is a no-go, but definitely good information to know. I spent a few hours trying to see if TokenMod or CharSetAttr could modify the 5e character sheet, but I couldn't get it to work. If I ever do try writing APIs, i'll be looking at it. As for the TokenActionMaker script. I'll import it definitely. I created several of my player and NPC actions using scripts that can display various actions like attacks and saves in the chat. having the buttons there to do that should definitely clean all of that up.

Oosh, I'll also look at the Wildshape script. I read the post, and it looks phenomenal. It still doesn't directly handle the turning on anf off of the "Show as Token Action" checkboxes on the Abilities, but that's not that big of a hurdle to jump. My player will just have to deal with the buttons for now. I may be able to do something with the repeating actions, though.

David, thanks again for the TokenMod sugegstion. I'm actually already using it, and it works great for changing the tokens for the various forms. I think I may be able to make it add and remove certain buttons by having one form's button run the scripts to remove certain abilities, then add in the ones for that form.

November 17 (4 years ago)
David M.
Pro
API Scripter

Cool. If you run token action maker on the forms' character sheets (or have them manually added, whatever), then when you change the represents property with token-mod, only the relevant form's token actions should be present. You will have to click off the token and re-select it to update the displayed token actions, however.

November 18 (4 years ago)

Oh, I think I see what you're saying. So, I should have my character's character sheet, then have the NPC sheets for let's say a Black Bear, Wolf, or whatever, then use Token Mod to set the "represents" field to that NPC character sheet for the Token, THEN user Token Action Maker to set the buttons. Is that how that should flow?

November 18 (4 years ago)
David M.
Pro
API Scripter

Pretty much! Though Token action maker only needs to be run once per character sheet (i.e. "form") during setup. It adds abilities to the sheet and makes them token actions. They will remain until deleted. ALso note that after changing forms, you will have to click off of and re-selected the token to refresh the token actions visible in the upper left corner of the UI.

Aside from the represents property, you can change a bunch of stuff for the token, including vision, size, etc. I'd use something like this.


January 08 (4 years ago)

I found the SetAbility script as well (code here), which says that it should be possible to simply turn on the 'Show as Token Action' portion of an ability, but I can't get it to work correctly.

You can specify a pair of ability name and ability text by --abilityname#abilitytext. Omitting '#' will create an empty ability if none exists, and will otherwise leave the ability text unchanged (this is useful for just making actions token actions via --token).
The macros I tried using (for an ability named 'Traits'):
!setability --sel --token --Traits 
!setability --sel --token --Traits#
!setability --sel --Traits --token
!setability --sel --Traits --token --nocreate


These macros do activate the 'Show as Token Action' checkbox, but they also still remove all the text from the ability to make it an empty ability, so I'm not sure how to adjust either the macro or the script to only activate the 'Show as Token Action' checkbox without changing the text of the ability.

January 08 (4 years ago)
The Aaron
Roll20 Production Team
API Scripter

The biggest problem I see with doing this is how you would turn off the ones you aren't using.  Once you switch back from a wolf to a human, do you just list every possible ability that could be on and turn it off?  I think you'd need to flag the abilities somehow, which would make it a bit more complicated to write.  Just a simple "enable/disable" ability script would be pretty easy.

January 08 (4 years ago)

I could use a simple enable/disable toggle script for 'Show as Token Action' that just needed a name input. Something like:

!sata --ABILITYNAME 


A best case scenario would include an argument for on/off/toggle:

!sata --toggle --ABILITYNAME 

Or a version where the ability name is identified with a '#' instead of '--', which could allow the default to be 'toggle':

!sata #ABILITYNAME 


For David's example above, it would be:

!sata --toggle #Wolf-Bite 


So that would still require the manual input of the name of each Ability to be adjusted, but for static character attack macros, that should work well for most cases.

January 10 (4 years ago)

Hey, Jarren, that's exactly something I'd like to see as well. I don't know if anybody writes scripts on commission, but if someone accepts Girl Scout Cookies as a form of payment, just tell me what you want, and I'll buy and ship 'em when the little crack dealers, er, I mean, young entrepreneurs, start selling again, LOL :)

January 28 (4 years ago)

Has there been any activity on this topic? I am playing D&D 3.5 and during rest periods I would like to "check" all Abilities that deal with Spell Memorization to "Show as Token Action" and then when the rest period is over "uncheck" them. So a script or macro that would allow me to do this would be very helpful.