This is very cool. Let me explain where I am coming from and what I want to do. I ran the convert to UDL program from Roll20. It did not do everything I thing it should have. Yes it turned off Advanced Fog of War and Dynamic Lighting in the LDL, but it did not uncheck the boxes for Show Grid, Dim Light Revels, Enforce Line of Sight, Only Update on Drop, Global Illumination. I feel these setting still being on, although the top level is off, might be part of the issues I have with UDL. I want to be able to run a scrip on the current page and flip all these off, not toggle them, and also enable in UDL Dynamic Lighting on, Explorer Mode on, Update when Token Drop on. Not toggle these, but enable these. So rather than open the page settings and "fix" all the standard settings, just run the script. I know just enough to be dangerous and will play with this script you gave us. :) Bob The Aaron said: Here's a small script for daylight: on('ready',()=>{
const getPageForPlayer = (playerid) => {
let player = getObj('player',playerid);
if(playerIsGM(playerid)){
return player.get('lastpage') || Campaign().get('playerpageid');
}
let psp = Campaign().get('playerspecificpages');
if(psp[playerid]){
return psp[playerid];
}
return Campaign().get('playerpageid');
};
on('chat:message',msg=>{
if('api'===msg.type && /^!toggle-daylight(\b\s|$)/i.test(msg.content) && playerIsGM(msg.playerid)){
let who = (getObj('player',msg.playerid)||{get:()=>'API'}).get('_displayname');
let pid = getPageForPlayer(msg.playerid);
let page = getObj('page',pid);
let args = msg.content.split(/\s+/);
let isSet = false;
let setValue = true;
if(args.length>1){
isSet = true;
setValue = ['on','yes','y','true','t'].includes(args[1].toLowerCase()) || ((parseInt(args[1])||0)>1);
}
let field = '';
if(page.get('dynamic_lighting_enabled')) {
field = 'daylight_mode_enabled';
} else if(page.get('showlighting')) {
field = 'lightglobalillum';
}
if(field) {
let curr = page.get(field);
setValue = (isSet ? setValue : !curr);
if(setValue !== curr){
page.set(field, setValue);
sendChat('',`/w "${who}" Daylight set to ${setValue ? 'On' : 'Off'}`);
}
} else {
sendChat('',`/w "${who}" Dynamic Lighting not in use on this page.`);
}
}
});
});
force_lighting_refresh is broken (possibly removed right now). I'll have to poke at the explorer_mode and dynamic_lighting_enabled settings.