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 for "Count Selected" Script

Another script request for a card game. When you've got a huge pile of tokens (or cards), it can get hard to count them on the table, especially if they're stacked on top of each other. Is there a simple API script that someone could write that counts the number of items that are selected, such that I could drag over a stacked deck, type !count, and have it send a chat message with the number of cards selected?
1418781956
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
var CountSelected = CountSelected || (function() { 'use strict'; var version = 0.1, handleMessages = function(msg) { if('api' !== msg.type ) { return; } var args = msg.content.split(/\s+/); switch(args.shift()) { case '!count': sendChat("Select Count", msg.selected.length+".") break; } }, registerEventHandlers = function(){ on('chat:message',handleMessages); }; return { RegisterEventHandlers: registerEventHandlers }; }()); on('ready',function(){ 'use strict'; CountSelected.RegisterEventHandlers(); });
Thank you very much. Works just as I hoped.
I am new to roll20 and i just added an API Script. It is the one that marks the token as it loses HP. How do I get it to work? I can't find any information on how to turn it on/off or enable it. I did save it in the api scripts area. Thanks.
1418787310
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
You have a link to the script bobby? (and perhaps start another thread.)
Yes..it is here:<a href="https://wiki.roll20.net/API:Cookboox" rel="nofollow">https://wiki.roll20.net/API:Cookboox</a> "The Darkness is Closing In..." I got it to work...don't know how. My problem is how do I manage it? I would think that it is intended to be enabled at a time period set by the DM, Sorry for the wrong thread..
1418788353
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Bobby G. said: Sorry for the wrong thread.. Doesn't bother me... but that Vince guy... oh boy. He is difficult.
1418796529
vÍnce
Pro
Sheet Author
Stephen S. said: Bobby G. said: Sorry for the wrong thread.. Doesn't bother me... but that Vince guy... oh boy. He is difficult. Oh, you are killing me... :-)