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

[Help] Need Assistance with Fixing a GMNote Issue

1532565978

Edited 1532566192
Hello all, I am using a modified version of Keithcurtis' modified version of The Aaron's GMNote script.  The sheet system I use is the Pathfinder Community one, with the pf_block template the preferred template for what this does.  I have little experience with coding, most of what little I have coming from second hand sources like modifying other people's scripts to fit my own needs.  The script works fine as intended, for the most part. It prints out what is in the GMNotes field on a token's attribute(?) window. However, whenever I name a token the field loses all format cohesion, and spits out the words in an ugly, barely formatted black format.  Here is a .gif of the issue.  I honestly have no clue where to go. Any help is appreciate, and thank your time ^_^
1532567326
The Aaron
Pro
API Scripter
I get access denied on that gif. =/ Can you give an example of the command you are running that produces the output you're not pleased with?
1532568282

Edited 1532568347
The Aaron said: I get access denied on that gif. =/ Can you give an example of the command you are running that produces the output you're not pleased with? Thank you Aaron, Apologies, this should work now. <a href="https://i.imgur.com/dri3fyv.gifv" rel="nofollow">https://i.imgur.com/dri3fyv.gifv</a> The command is:&nbsp; !gmnote
1532569292
The Aaron
Pro
API Scripter
Hmm.. that is weird. Try this version and see if that clears it up? on('ready',()=&gt;{ const blockElements = [ 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'ol', 'ul', 'pre', 'address', 'blockquote', 'dl', 'div', 'fieldset', 'form', 'hr', 'noscript', 'table','br' ]; const rStart=new RegExp(`&lt;\\s*(?:${blockElements.join('|')})\\b[^&gt;]*&gt;`,'ig'); const rEnd=new RegExp(`&lt;\\s*\\/\\s*(?:${blockElements.join('|')})\\b[^&gt;]*&gt;`,'ig'); const getLines = (str) =&gt; (rStart.test(str) ? str .replace(/[\n\r]+/g,' ') .replace(rStart,"\r$&amp;") .replace(rEnd,"$&amp;\r") .split(/[\n\r]+/) : str .split(/(?:[\n\r]+|&lt;br\/?&gt;)/) ) .map((s)=&gt;s.trim()) .filter((s)=&gt;s.length) ; const cmdRegex = /^!(w?)gmnote(?:-(.*))?$/i; on('chat:message',(msg) =&gt; { if('api' === msg.type &amp;&amp; cmdRegex.test(msg.content) &amp;&amp; playerIsGM(msg.playerid) ){ let match=msg.content.match(cmdRegex), output = match[1].length ? '/w gm ' : '', regex; if(match[2]){ regex = new RegExp(`^${match[2]}`,'i'); } _.chain(msg.selected) .map( s =&gt; getObj('graphic',s._id)) .reject(_.isUndefined) .reject((o)=&gt;o.get('gmnotes').length===0) .each( o =&gt; { if(regex){ let lines = _.filter( getLines(unescape(o.get('gmnotes'))), (l) =&gt; regex.test(l.replace(/&lt;[^&gt;]*&gt;/g,'')) ).join('&lt;br&gt;'); sendChat(o.get('name'), `${output}${lines}`); } else { sendChat(o.get('name'), `${output} &amp;{template:pf_block}}{{desc=${unescape(o.get('gmnotes')).replace(/(?:[\n\r]+|&lt;br\/?&gt;)/g,'&lt;br&gt;')} }}`); } }); } }); }); If it does, you can also use !wgmnote to whisper it to you.
Works like a charm now! Thanks for combining the /chat /w feature too! Holy crap dude... You're actual script magic floating through these boards. Really appreciate it friend! Cheers to you and yours!
1532574174
The Aaron
Pro
API Scripter
HAHAHAHAHA.. No problem. =D