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 with Shadow of the Demon Lord API script

1657835381
N Robaina
Pro
Marketplace Creator
Help!  I run a Shadow of the Demon Lord campaign and I used to use an API script along with some macros to do the Fast/Slow turn on the Turn Order.  For some reason, the API script and/or Macros are no longer working.  Anyone good at fixing broken API/Macros that knows Shadow of the Demon Lord that can help me out? Here's the API script:  on('ready', () => {     on('chat:message',(msg) => {         let args,cmds,who,initial,change,entry;         if('api' === msg.type) {             if(msg.content.match(/^!att\b/) ){                 who=(getObj('player',msg.playerid)||{get:()=>'API'}).get('_displayname');                 if(_.has(msg,'inlinerolls')){                     msg.content = _.chain(msg.inlinerolls)                         .reduce(function(m,v,k){                             let ti=_.reduce(v.results.rolls,function(m2,v2){                                 if(_.has(v2,'table')){                                     m2.push(_.reduce(v2.results,function(m3,v3){                                         m3.push(v3.tableItem.name);                                         return m3;                                     },[]).join(', '));                                 }                                 return m2;                             },[]).join(', ');                             m['$[['+k+']]']= (ti.length && ti) || v.results.total || 0;                             return m;                         },{})                         .reduce(function(m,v,k){                             return m.replace(k,v);                         },msg.content)                         .value();                 }                 let text = msg.content.split(/\s+/).slice(1).join(' ');                 if(text){                     let turns = _.chain(msg.selected)                         .map((o)=>getObj('graphic',o._id))                         .reject(_.isUndefined)                         .map((t)=>({id: t.id, pr: text}))                         .value();                     if(turns.length){                         let to=turns.concat(JSON.parse(Campaign().get('turnorder'))||[]);                         Campaign().set('turnorder',JSON.stringify(to));                     } else {                         sendChat('ATT',`/w "${who}" <div style="padding:1px 3px;border: 1px solid #8B4513;background: #eeffee; color: #8B4513; font-size: 80%;"><div style="background-color: #ffeeee;">Nothing selected capable of having a turn.</div></div>`);                     }                 } else {                     sendChat('ATT',`/w "${who}" <div style="padding:1px 3px;border: 1px solid #8B4513;background: #eeffee; color: #8B4513; font-size: 80%;"><div style="background-color: #ffeeee;">Use <b><pre>!act ${'&'+'lt'+';'}text${'&'+'gt'+';'}</pre> -- add turns for selected tokens with the supplied text as the value of their turn.</b></div></div>`);                 }             }         }     }); }); Macros are: Initiative: ?{Fast or Slow?|Fast,#FAST |Slow,#SLOW } Fast: !att FAST Slow: !att SLOW
1657835817
N Robaina
Pro
Marketplace Creator
Here's the error that I get:  Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your script's code and click the "Save Script" button. We will then attempt to start running the scripts again.  More info...  If this script was installed from the Mod Library, you might find help in the Community API Forum. For reference, the error message generated was:  Possible infinite loop detected, shutting down.