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

[Request] remove all abilities of selected token(s)

1477294113
vÍnce
Pro
Sheet Author
Assuming this can be done... can someone do me a favor and write a script to remove all abilities of selected token(s)? TIA
1477295652

Edited 1477295692
vÍnce
Pro
Sheet Author
Actually... I was able to use [Script] PTUtokenAction -- Creates token actions for use with PTU(Pokemon Tabletop United) and although I'm not using Pokemon Tabletop the delete function included seems to work very well for my needs.   !ptuta --DELETE Thank you Warren J.  ;-)
1477295761
Lithl
Pro
Sheet Author
API Scripter
on('chat:message', function(msg) { if (msg.content !== '!removeall' || !msg.selected) return; _.each(msg.selected, function(sel) { var token = getObj(sel._type, sel._id), abilities = findObjs({ type: 'ability', characterid: token.get('represents') }); _.each(abilities, function(abil) { abil.remove(); }); }); }); Quick, dirty, and untested. This will (read: should, assuming I wrote it correctly) permanently delete any abilities on a character representing any selected token when you use the "!removeall" command. If you want to leave the abilities intact, just make them not token actions any more, change line 9 to abil.set('istokenaction', false)
1477296082
vÍnce
Pro
Sheet Author
Thank you Brian.  This works great.  I grabbed the Pokemon Script and it has a similar function, but only on a single token.  Thanks
1477328374
Gold
Forum Champion
Thank you both. I have wanted to ask for the same request. I have a use for this and will try this soon.
1477350981
Gold
Forum Champion
Brian, What if?  What if I want to !removeall (remove abilities or just uncheck the token actions) on ALL the Characters in the entire game, not just on selected tokens? What if I want to do that on ALL the Characters except for 6 characters? (Uncheck token actions from all the monsters in the entire game, except for the 6 Player's Characters). What if I want to uncheck all the token actions except for 1 token action with a known name ("Loot")? I'm currently employing the quick-n-dirty script snippit Brian provided in this thread, and it works nicely on a "selected" basis. Thanks man! I'd like to scrub an entire game, like so. A game that has dozens of monster-characters with token actions that aren't needed for running in an alternate game system.
1477351429
vÍnce
Pro
Sheet Author
Oh sure Gold.  Sweet talk Brian into making the changes I could have benefited from right after I had to manually select and click groups of tokens.  Really?  ;-P +1 to the enhancements Gold has mentioned.  Very handy.
1477353566
Gold
Forum Champion
The game I'm thinking of running this on has more than 100 Pages, so I didn't want to select them all... Though I have a workaround in mind, honestly, I could make an Index Page (Bestiary page) and drag-drop every Character's token onto that page from the Journals bar, then select and run !removeall. Probably has about 80 characters / monsters. Brian's code does (of course) cover all Token instances across all-pages that link to that same Character, since these Abilities and Token Actions are part of the Character... so hitting 1 token of each character will work without necessarily loading every Page. The workaround would cover upgrades 1 & 2, but not the 3rd.
1477353762
vÍnce
Pro
Sheet Author
Gold said: Though I have a workaround in mind, honestly, I could make an Index Page (Bestiary page) and drag-drop every Character's token onto that page from the Journals bar, then select and run !removeall. Probably has about 80 characters / monsters. That was the method I used.  Luckily I already had many of my beasties on the page for easy drag/drop.
1477383064

Edited 1477383098
Lithl
Pro
Sheet Author
API Scripter
Gold said: Brian, What if?  What if I want to !removeall (remove abilities or just uncheck the token actions) on ALL the Characters in the entire game, not just on selected tokens? What if I want to do that on ALL the Characters except for 6 characters? (Uncheck token actions from all the monsters in the entire game, except for the 6 Player's Characters). What if I want to uncheck all the token actions except for 1 token action with a known name ("Loot")? I'm currently employing the quick-n-dirty script snippit Brian provided in this thread, and it works nicely on a "selected" basis. Thanks man! I'd like to scrub an entire game, like so. A game that has dozens of monster-characters with token actions that aren't needed for running in an alternate game system. // Uncheck all tokenaction abilities in the entire campaign on('chat:message', function(msg) { var allAbilities = findObjs({ type: 'ability' }); if (msg.content !== '!removeallabilities') return; _.each(allAbilities, function(abil) { abil.set('istokenaction', false); }); }); // Uncheck all tokenaction abilities except for tokenactions on characters linked to the selected tokens on('chat:message', function(msg) { var allCharacters = findObjs({ type: 'character' }), selectedIds, allExceptSelected; if (msg.content !== '!removeallexceptselected' || !msg.selected) return; selectedIds = _.chain(msg.selected) .map((sel) => getObj(sel._type, sel._id).get('represents')) .reject((rep) => rep === '') .value(); allExceptSelected = _.reject(allCharacters, (char) => _.contains(selectedIds, char.id)); _.each(allExceptSelected, function(char) { var abilities = findObjs({ type: 'ability', characterid: char.id }); _.each(abilities, function(abil) { abil.set('istokenaction', false); }); }); }); // Uncheck all tokenaction abilities in the entire campaign except the named abilities on('chat:message', function(msg) { var allAbilities = findObjs({ type: 'ability' }), args = msg.content.toLowerCase().split(' '), command = args.shift().substring(1); if (command !== 'removeallexcept' || !msg.selected) return; _.each(allAbilities, function(abil) { if (_.contains(args, abil.get('name').toLowerCase())) return; abil.set('istokenaction', false); }); }); Use the command "!removeallabilities" to make all  abilities in the entire campaign not tokenactions. (Change abil.set to abil.remove if you want to actually delete them.) Use the command "!removeallexceptselected" to make all abilities in the campaign not tokenactions except  for abilities on characters linked to the selected token(s). Use the command "!removeallexcept [ ability1-name  [ ability2-name  [ ability3-name... ]]]" to make all abilities in the campaign not tokenactions except abilities with names matching the supplied argument(s). Don't include the square brackets ~_^. If you don't supply any ability names, it should function just like !removeallabilities in #1, above. These three scripts are just as quick-and-dirty as the first one!
1477405404
vÍnce
Pro
Sheet Author
Thanks Brian.
1477419991
Silvyre
Forum Champion
Vince said: Thanks Brian. No, this won't suffice. THANK YOU, BRIAN!
1477423894
vÍnce
Pro
Sheet Author
Absolutely!
1477432303

Edited 1477432421
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
(PS: Sorry for this... I just haven't had a chance to pick on Vince in while.) Wouldn't it be shorter to write: MakeToken = Vince
1477434002
vÍnce
Pro
Sheet Author
Get back in your lab Stephen.
1477448193
Gold
Forum Champion
Stephen S. said: (PS: Sorry for this... I just haven't had a chance to pick on Vince in while.) Check out this thread, it's gold! <a href="https://app.roll20.net/forum/post/4157653/non-stan" rel="nofollow">https://app.roll20.net/forum/post/4157653/non-stan</a>... 2nd post, had me laughing. Bug report: I hit my computer with a hammer and now Roll20 doesn't work. Vince can you please try to replicate this issue? :p
1477451872

Edited 1477451973
vÍnce
Pro
Sheet Author
LOL In my defense... &nbsp;To a fault , I always feel I can solve a problem. &nbsp;Truth be told, I can't. &nbsp;;-)
1477480697
The Aaron
Pro
API Scripter
Gold said: Check out this thread, it's gold ! You know, it says your name above the post, you don't have to repeat it! (...speaking of couldn't resist! &nbsp;=D~ )
1477640977
Gold
Forum Champion
Brian said: Use the command "!removeallexcept [ ability1-name &nbsp;[ ability2-name &nbsp;[ ability3-name... ]]]" to make all abilities in the campaign not tokenactions except abilities with names matching the supplied argument(s). Don't include the square brackets ~_^. Eureka, #3 did the trick for my campaign. Thanks again Brian. I didn't use #2 because I just decided to go back into the 6 PC's and re-enable the token actions that they need. The script turned off all the unwanted token actions on dozens of monsters while leaving just their Loot button turned on.&nbsp;Here is the API command that I used in chat to make it go. !removeallexcept loot