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] Script to allow players to inspect non-controlled tokens

Hello! Is it possible to create a script that will allow players to "inspect" a token, that player doesn't have a control and get in chat window wispered to him only text, that is located in GM Notes section of this token? Thank you in advance!
Right now I have following script that I've found here, on forums, but it only allows to see bigger token image. on('ready',function(){ "use strict"; on('chat:message',function(msg){ var args, who; if (msg.type !== "api") { return; } who = getObj('player',msg.playerid).get('_displayname'); args = msg.content.split(/\s+/); switch(args.shift()) { case '!see': _.chain(args) .map(function(id){ return getObj('graphic',id); }) .reject(_.isUndefined) .each(function(o){ sendChat('','/w "'+who+'" [pic]('+o.get('imgsrc')+'#.png)'); }); break; } }); }) Maybe it would be easier to modify it, but I'm complete 0 in programming.
1495152221
The Aaron
Pro
API Scripter
Take a look at this thread:&nbsp; <a href="https://app.roll20.net/forum/post/5047876/script-r" rel="nofollow">https://app.roll20.net/forum/post/5047876/script-r</a>...
1495153028
The Aaron
Pro
API Scripter
Try this: on('ready',function(){ &nbsp; &nbsp; "use strict"; &nbsp; &nbsp; on('chat:message',function(msg){ &nbsp; &nbsp; &nbsp; &nbsp; var args, who; &nbsp; &nbsp; &nbsp; &nbsp; if (msg.type !== "api") { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; who = getObj('player',msg.playerid).get('_displayname'); &nbsp; &nbsp; &nbsp; &nbsp; args = msg.content.split(/\s+/); &nbsp; &nbsp; &nbsp; &nbsp; switch(args.shift()) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case '!inspect': &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _.chain(args) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .map(function(id){ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return getObj('graphic',id); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .reject(_.isUndefined) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .reject((o)=&gt;o.get('gmnotes').length===0) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .each( o =&gt; { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sendChat(o.get('name'),'/w gm &{template:5e-shaped} {{title=GM Notes for '+o.get('name')+' }} {{text='+ decodeURIComponent(o.get('gmnotes'))+'}}'); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; }); });
1495178993

Edited 1495179999
Aaron, thank you very much! But it seems that my idea will never work :( As I play with russian-speaking players and GM notes written in russian return an error to console for decodeURIComponent... :(&nbsp; UPD: WOW, I've changed&nbsp;decodeURIComponent to&nbsp;unescape and now it works! :D I feel myself as PRO programmer! :D Just joking... Aaron, I again would like to thank you very much for your help! You've made my GM life much more easier!
1495198809
The Aaron
Pro
API Scripter
No problem, glad you got it worked out!!