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

Can anybody help me with this

This is a pop up script I found and I tried contacting the author because the thread on it was closed but no response. I tried to use this api script and all I got was this fault = Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your scripts and click the "Save Script" button and we'll attempt to start running them again. More info... For reference, the error message generated was: /home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:1 orts, require, module, __filename, __dirname) { function g(a){throw a;}var j=v ^ ReferenceError: gmNotesBar is not defined at Sandbox.<anonymous> (evalmachine.<anonymous>:897:10) at eval ( // GM notes popup script var gmn = gmn || {}; gmn.gmNotesBar = "bar2_value"; gmn.lineLength = 60; gmn.SanitizePopupData = function(x) { x = x.replace(/ /g, " "); // Replace space character with unicode non-breaking character x = x.replace(/-/g, " "); // Replace the real dash with a unicode substitute (dash causes a linebreak). x = x.replace(/\(/g, "﹙"); // Replace left paren with unicode substitute (Causes linebreak) x = x.replace(/\)/g, "﹚"); // replace right paren with unicode substitute (Causes linebreak) return x; }; gmn.LineWrap = function(seperator, sanitizedData) { var lineWrapReg = new RegExp(".{1,"+gmn.lineLength+"}","g"); var output = ""; var rr = sanitizedData.match(lineWrapReg); var wrapMode = false; if (rr && sanitizedData.length>gmn.lineLength) { output = " "+seperator; for(var j=0;j<rr.length;j++) { // Find last "space" (Unicode character, since data has already been sanitized). var tr = /(.+) (.+?)$/.exec(rr[j]); if (tr) { output = output.concat(tr[1], " ", seperator, tr[2]); wrapMode = true; } else { // No spaces - Just append entire string. output = output.concat((wrapMode)?" "+seperator:"", rr[j], " ", seperator); wrapMode = false; } } } else { // less than lineLength characters long output = " ".concat(seperator, sanitizedData); } return output; } gmn.SetPopupData = function(data, token, bar, size) { // What follows is a hack to enable the use of a "bar" as a presentation-layer. // this permits us to display special qualities to the GM upon clicking on a token, without having to open up gmnotes/etc. if (size == 0) size++; var seperator = "              ".repeat(size+1); // Fill with unicode non-breaking spaces, adjusted for token size var fmt = ""; if (Object.prototype.toString.call(data) === '[object Array]' ) { for(var i=0;i<data.length;i++) { fmt += gmn.LineWrap(seperator, gmn.SanitizePopupData(data[i])); } } else { fmt = seperator.concat(gmn.LineWrap(seperator, gmn.SanitizePopupData(data))); } if (fmt.length <= 90) fmt = fmt.concat(seperator.repeat(Math.ceil((90-fmt.length)/14))); token.set(bar, fmt); // End presentation layer hack. }; on("change:graphic:gmnotes", function(obj, prev) { var data = obj.get("gmnotes"); if (data.length > 0) gmn.SetPopupData(unescape(data).split("<br>"), obj, gmn.gmNotesBar, Math.ceil(obj.get("width")/70) - 1); else obj.set(gmNotesBar, ""); });
the tread does say this script needs this script to work as well // Misc. utility functions, common to my scripts. Array.prototype.unique = function() { var a = this.concat(); for(var i=0; i<a.length; ++i) { for(var j=i+1; j<a.length; ++j) { if(a[i] === a[j]) a.splice(j--, 1); } } return a; }; function mergeArray(array1,array2) { for(item in array1) { array2[item] = array1[item]; } return array2; }; String.prototype.capitalizeFirstLetter = function() { return this.charAt(0).toUpperCase() + this.slice(1); }; String.prototype.repeat = function( num ) { return new Array( num + 1 ).join( this ); };
It looks like the "gmNotesBar" on the next-to-last line should be "gmn.gmNotesBar", but I didn't test to see if there were any other issues once that fix is made.
fix thank you very much