Hello everyone, Over the course of the last few weeks, I've been noticing an issue with my game "Aventures en Azéroth". I'm using a set of scripts : ChatSetAttr PowerCards A custom script that I was sent via help of a community member that goes as follow : on('ready',function(){
"use strict";
const checkFormulaOnTurn = () => {
let to=JSON.parse(Campaign().get('turnorder')||'[]');
if(to.length && to[0].id==='-1'){
sendChat('',`[[${to[0].pr}+(${to[0].formula||0})]]`,(r)=>{
to[0].pr=r[0].inlinerolls[0].results.total;
Campaign().set('turnorder',JSON.stringify(to));
});
}
};
on('chat:message',function(msg){
var args,cmds,who,initial,change,entry;
if('api' === msg.type) {
if(msg.content.match(/^!act\b/) ){
who=(getObj('player',msg.playerid)||{get:()=>'API'}).get('_displayname');
if(_.has(msg,'inlinerolls')){
msg.content = _.chain(msg.inlinerolls)
.reduce(function(m,v,k){
var 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();
}
args = msg.content
.replace(/<br\/>\n/g, ' ')
.replace(/(\{\{(.*?)\}\})/g," $2 ")
.split(/\s+--/);
cmds=args.shift().split(/\s+/);
change=parseFloat(cmds[1])||'+1';
change=`${/^[+-]\d/.test(change)?'':'+'}${change}`;
initial=parseFloat(cmds[2])||0;
entry=args.join(' ');
if(entry.length){
let to=JSON.parse(Campaign().get('turnorder')||'[]');
to.unshift({
id: "-1",
pr: initial,
custom: entry,
formula: change
});
Campaign().set('turnorder',JSON.stringify(to));
if(!playerIsGM(msg.playerid)){
sendChat('ACT',`/w gm <div style="padding:1px 3px;border: 1px solid #8B4513;background: #eeffee; color: #8B4513; font-size: 80%;"><div style="background-color: #ffeeee;"><b>${who}</b> added entry for <b>${entry}</b> starting at <b>${initial}</b> and changing by <b>${change}</b>.</div></div>`);
}
} else {
sendChat('ACT',`/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 [formula] [starting value] --[description]</pre></b></div></div>`);
}
} else if(msg.content.match(/^!eot/i)){
_.defer(checkFormulaOnTurn);
}
}
});
}); Anyway, the issue seems to be that either of these scripts causes an infinite loop that causes the API to shut down, which means asking the players to all disconnect from the game so that I can restart the API. I've had this issue happen before with ChatSetAttr, when a player without the appropriate rights would query the attributes of a character which they could not control. What would basically happen is that the macro wouldn't be displayed and a few minutes later, the API sandbox would shut down. However, I seemed to have fixed the issue over weeks of testing and correcting the typos in my macro and everything was working fine, until recently. I haven't changed anything, and the API will shut down just like that, because of a "possible infinite loop detected". It happens during my prep sessions, during the actual games, and in between. I know infinite loops have been a known issue, but is something else known about this? Like, maybe a new update to one of the scripts led to more possible infinite loops occurring. It's also worth mentioning I guess that both me and my players (spread out across France), have been encountering severe delays between clicking on a macro and it effectively running. Anyone with a helpful clue or comment would be immensely appreciated. Cheers and happy new year to all!