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

Question about GMNote

I'm really loving this script, but I am using the OGL 5e sheet and had to switch the template to default.  I was wondering if there was an updated script that works with the OGL template?
1533929239
The Aaron
Pro
API Scripter
Try this one: on('ready',()=>{ 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(`<\\s*(?:${blockElements.join('|')})\\b[^>]*>`,'ig'); const rEnd=new RegExp(`<\\s*\\/\\s*(?:${blockElements.join('|')})\\b[^>]*>`,'ig'); const getLines = (str) => (rStart.test(str) ? str .replace(/[\n\r]+/g,' ') .replace(rStart,"\r$&") .replace(rEnd,"$&\r") .split(/[\n\r]+/) : str .split(/(?:[\n\r]+|<br\/?>)/) ) .map((s)=>s.trim()) .filter((s)=>s.length) ; const cmdRegex = /^!(w?)gmnote(?:-(.*))?$/i; on('chat:message',(msg) => { if('api' === msg.type && cmdRegex.test(msg.content) && 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 => getObj('graphic',s._id)) .reject(_.isUndefined) .reject((o)=>o.get('gmnotes').length===0) .each( o => { if(regex){ let lines = _.filter( getLines(unescape(o.get('gmnotes'))), (l) => regex.test(l.replace(/<[^>]*>/g,'')) ).join('<br>'); sendChat(o.get('name'), `${output}${lines}`); } else { sendChat(o.get('name'), `${output} &{template:desc}}{{desc=${unescape(o.get('gmnotes')).replace(/(?:[\n\r]+|<br\/?>)/g,'<br>')} }}`); } }); } }); });
1533929373
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
There are many tweaks to this script floating around. If you could post the actual code you are using, I or someone else should be able to help you figure out which lines to alter.
1533938938
Pantoufle
Pro
Sheet Author
Translator
Hello when using gmnotes with 5ogl I prefer the spell template, desc is ok but... :) try yourself