
I'm making an End Credits for my campaign sessions using a setInterval to time some events. Those timed events aren't firing, and i think it's something to do with the ecCounter variable iteration, or reading the values of it in the if statements. HELP! CODE IS BELOW on("ready",function(){ var flip; var ecCounter = 0; on("change:campaign:playerpageid",function(){ var currentPage = getObj("page",Campaign().get("playerpageid")); sendChat("api","!token-mod --config players-can-ids|on"); if (currentPage.get("name")=="ECGloria"){ flip = setInterval(flipper, 5000); } else { clearInterval(flip); flip = null; } function flipper(ecCounter){ ecCounter += 5; if(ecCounter === 5){ sendChat("API","!token-mod --api-as -NgLL39aMVMGSgYa69Tq --ids -NrBaVr_xm4BdIXBIoGG --set layer|gmlayer"); } if(ecCounter === 10){ } else if(ecCounter === 30){ sendChat("API","!token-mod --api-as -NgLL39aMVMGSgYa69Tq --ids -NrBloLVocW0LFFdNToD --set layer|token"); sendChat("api","!token-mod --api-as -NgLL39aMVMGSgYa69Tq --ids -NrBloLVocW0LFFdNToD --set currentside|1"); } else if(ecCounter === 45){ sendChat("api","!token-mod --api-as -NgLL39aMVMGSgYa69Tq --ids -NrBloLVocW0LFFdNToD --set currentside|2"); } else if(ecCounter === 60){ sendChat("api","!token-mod --api-as -NgLL39aMVMGSgYa69Tq --ids -NrBloLVocW0LFFdNToD --set currentside|3"); } else if(ecCounter === 75){ sendChat("api","!token-mod --api-as -NgLL39aMVMGSgYa69Tq --ids -NrBloLVocW0LFFdNToD --set currentside|4"); } else if(ecCounter === 95){ sendChat("api","!token-mod --api-as -NgLL39aMVMGSgYa69Tq --ids -NrBloLVocW0LFFdNToD --set currentside|5"); } else if(ecCounter === 105){ sendChat("API","!token-mod --api-as -NgLL39aMVMGSgYa69Tq --ids -NrBloLVocW0LFFdNToD --set layer|gmlayer"); sendChat("API","!token-mod --api-as -NgLL39aMVMGSgYa69Tq --ids -NrBgFNKcTQ2UNDReKGw --set layer|token"); } else if(ecCounter === 160){ //black screen w final messsage } //sendChat("api","!token-mod --config players-can-ids|on"); //sendChat("api","!token-mod --api-as -NgLL39aMVMGSgYa69Tq --ids -NobNO6uHnya6FmREuhJ --set currentside|*"); //sendChat("api","!token-mod --api-as -NgLL39aMVMGSgYa69Tq --ids -NobNNjT4sLnOW64Qbau --set currentside|*"); } }); });