Credit to The Aaron for the original script. I only modified this to have a start/stop and the random intervals of lightning. Trigger to start in chat with: !flash start Trigger to stop in chat with: !flash stop Code (Play with the FLASH_TIME, MIN_INTERVAL and MAX_INTERVAL to get the timing you like): on('ready', () => {   const FLASH_TIME = 200;      // how long each flash lasts (ms) - 0.2 seconds   const MIN_INTERVAL = 300;   // shortest gap between flashes (ms) — 0.3 second   const MAX_INTERVAL = 5000;   // longest gap between flashes (ms) — 5 seconds   const randomInterval = () =>     Math.floor(Math.random() * (MAX_INTERVAL - MIN_INTERVAL + 1)) + MIN_INTERVAL;   const getPageForPlayer = (playerid) => {     let player = getObj('player', playerid);     if (playerIsGM(playerid)) {       return player.get('lastpage');     }     let psp = Campaign().get('playerspecificpages');     if (psp[playerid]) {       return psp[playerid];     }     return Campaign().get('playerpageid');   };   const flash = (page) => {     if (page.get('dynamic_lighting_enabled') && !page.get('daylight_mode_enabled')) {       page.set({ daylight_mode_enabled: true });       setTimeout(() => page.set({ daylight_mode_enabled: false }), FLASH_TIME);     }   };   const activeStorms = {};   const startStorm = (page) => {     if (activeStorms[page.id]) return; // already running     const loop = () => {       flash(page);       activeStorms[page.id] = setTimeout(loop, randomInterval());     };     loop(); // fire the first flash immediately   };   const stopStorm = (page) => {     if (activeStorms[page.id]) {       clearTimeout(activeStorms[page.id]);       delete activeStorms[page.id];     }   };   on('chat:message', (msg) => {     if ('api' !== msg.type || !playerIsGM(msg.playerid)) return;     const match = /^!flash(?:\s+(start|stop))?\s*$/i.exec(msg.content);     if (!match) return;     const sub = (match[1] || '').toLowerCase();     let page = getObj('page', getPageForPlayer(msg.playerid));     if (!page) return;     const who = (getObj('player', msg.playerid) || { get: () => 'API' }).get('_displayname');     if (sub === 'stop') {       stopStorm(page);       sendChat('', `/w "${who}" ⚡ Storm stopped ⚡`);     } else if (sub === 'start') {       startStorm(page);       sendChat('', `/w "${who}" ⚡ Storm started ⚡`);     } else {       flash(page);       sendChat('', `/w "${who}" ⚡ FLASH ⚡`);     }   }); });