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 to scan through Characters in Journal?

Query:  Does someone have a script to scan through the characters in the Journal and report any that have, or are missing, a specific Attribute? Background Information:  Back when I first started using Roll20, I didn't use the same scripts I do now.  Many of the older scripts used different attribute names for characters, or in some cases, like initiative, I tracked it manually before I found the power of the API (at that time we played face-to-face rather than online, so it was easy). I would like to revisit one of those old games with a new group, and would like an easy way to know which characters do, and do not, have the attributes my scripts need. Thanks in advance for for any information
1454014403
The Aaron
Pro
API Scripter
I don't know of one, but it would be pretty easy to write one...
Yeah, for someone like you.  :) For me, it would take hours.  It'd be faster for me to manually check the 200-300 characters, which I really don't want to do.  Hence why I"m hoping someone has one written already.
1454030670
The Aaron
Pro
API Scripter
Perhaps so...  =D !check <attribute name> <attribute name> ... Will tell you each character that is missing one of those attributes (and which one they are missing).  It will also tell you if any of the characters have duplicates of one of those attributes (and how many duplicates there are), where duplicates mean the same name but different captialization: e.g. Speed speed SPEED sPeEd Script: on('ready',function(){           "use strict";                      on('chat:message',function(msg){               var cmd,chars;                              if('api' !== msg.type || !playerIsGM(msg.playerid) ){                   return;               }               cmd = msg.content.split(/\s+/);                              switch(cmd.shift()){                   case '!check':                     cmd = _.map(cmd,function(n){ return n.toLowerCase();});                     chars=_.reduce(findObjs({type: 'character'}),function(m,c){                         m[c.id]={                             name: c.get('name'),                             attrs: cmd,                             dups: {}                         };                         return m;                     },{});                     _.each(filterObjs(function(o){                         return 'attribute' === o.get('type') && _.contains(cmd,o.get('name').toLowerCase());                     }),function(a){                         var cid=a.get('characterid'),                         aname=a.get('name').toLowerCase();                         if(chars[cid]){                             if(_.contains(chars[cid].attrs,aname)){                                 chars[cid].attrs=_.without(chars[cid].attrs,aname);                             } else {                                 if(_.has(chars[cid].dups,aname)){                                     ++chars[cid].dups[aname];                                 } else {                                     chars[cid].dups[aname]=2;                                 }                             }                         }                     });                     sendChat('','/w gm <h3>Attribute Check</h3>'+_.reduce(chars,function(m,c){                         var line='';                         if(c.attrs.length || _.keys(c.dups).length){                             line+='<div><div style="font-weight:bold;">'+c.name+'</div>';                             _.each(c.attrs,function(a){                                 line+='<div style="color: #900;padding-left:3em;"><b>Missing:</b> '+a+'</div>';                             });                             _.each(c.dups,function(c,n){                                 line+='<div style="color: #909;padding-left:3em;"><b>Duplicate:</b> '+n+' x '+c+'</div>';                             });                             line+='</div>';                             m.push(line);                         }                         return m;                     },[]).join('')                     );                     break;               }           });                  });       
You sir, are amazing.  I've said it before, and I'll say it again.  You are one of the select few who make Roll20 how great it is. In general, the whole community is amazing given the lack of a$$hats, but those of you who go out of your way to assist others for no reason than to be helpful make me glad I selected Roll20 as my VTT of choice.
1454032428
The Aaron
Pro
API Scripter
That's pretty much why we do it. =D
1454086085

Edited 1454086103
chris b.
Pro
Sheet Author
API Scripter
omg thanks I was going to link to this&nbsp; <a href="https://app.roll20.net/forum/post/2434223/slug%7D" rel="nofollow">https://app.roll20.net/forum/post/2434223/slug%7D</a> since I thought "someone just asked for something simiiar what was it.."&nbsp; But this script does exactly what many of us need! DMs are going to need some utils like this, with all the changes going on to character sheets. Well i might use this as a generic util, and call it from a Pathfinder sheet specific one if things ever change too much, or we end up with 2 sheets, etc. to help DMs translate their stuff.