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 .
×
Advertisement Create a free account

Is there a pageMod tool?

1630784744
I was looking for a tool that allows you to set page setting for map settings?  Sort of like the what the awesome "tokenmod" does for tokens? I want to create commands to setup default UDL settings (day, night, off)? Anyone know if something like this that exists?
1630791466

Edited 1630864378
I create a simple API script to set the light levels... it is not the most elegant but given a command I can set day, night, moonlight, dusk and off :) here are the command !daylight day !daylight night !daylight dusk !daylight moonlight !daylight off *EDIT: fixed issue with explorerMode to  basic. Thanks Jens on('ready',function() { "use strict"; if( state.daylight){ state.daylight = { version: 'v1.0' }; } log('-=> Loading Daylight '+ state.displayMarkers.version); }); on('chat:message',msg=>{ if(msg.type === 'api'){ if (msg.content.split(' ')[0].toLowerCase() === '!daylight'){ let page = getObj('page', Campaign().get('playerpageid')); if (msg.content.split(' ')[1].toLowerCase() === 'dusk') { page.set('dynamic_lighting_enabled',true); page.set('daylight_mode_enabled', true); page.set('explorer_mode','basic'); page.set('lightupdatedrop',true); page.set('daylightModeOpacity',0.5); page.set('force_lighting_refresh',true); sendChat('daylight','The sun peaks over the horizon'); } else if (msg.content.split(' ')[1].toLowerCase() === 'day') { page.set('dynamic_lighting_enabled',true); page.set('daylight_mode_enabled', true); page.set('explorer_mode','basic'); page.set('lightupdatedrop',true); page.set('daylightModeOpacity',1.0); page.set('force_lighting_refresh',true); sendChat('daylight','The Sun is blazing in the sky'); } else if (msg.content.split(' ')[1].toLowerCase() === 'night') { page.set('dynamic_lighting_enabled',true); page.set('daylight_mode_enabled', true); page.set('explorer_mode','basic'); page.set('lightupdatedrop',true); page.set('daylightModeOpacity',0.0); page.set('force_lighting_refresh',true); sendChat('daylight','The dark of night falls'); } else if (msg.content.split(' ')[1].toLowerCase() === 'moonlight') { page.set('dynamic_lighting_enabled',true); page.set('daylight_mode_enabled', true); page.set('explorer_mode','basic'); page.set('lightupdatedrop',true); page.set('daylightModeOpacity',0.2); page.set('force_lighting_refresh',true); sendChat('daylight','The moon shines bright'); } else if (msg.content.split(' ')[1].toLowerCase() === 'off') { page.set('dynamic_lighting_enabled',false); page.set('daylight_mode_enabled', false); page.set('explorer_mode','off'); page.set('lightupdatedrop',false); page.set('daylightModeOpacity',0.0); page.set('force_lighting_refresh',true); sendChat('daylight','Turning off UDL'); } } } });
1630796173
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
That's a really handy little script!
Ooh I’m giving this a try great work
1630811636
opps there is a mistake in the script....  page.set('explorer_mode','no'); should be  page.set('explorer_mode','on'); :) sorry about that I just swa that. I will fix it quic and post a link
1630846751

Edited 1630846866
Jens
Pro
I had to change 'on' to 'basic' to get the explorer_mode to be set to on.
1630858010
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
From the API objects page: explorer_mode String Toggles explorer mode for the page. This should not be turned on if dynamic_lighting_enabled is not turned on. Use the strings ”basic” to turn on or ”off” to turn off. which is interesting, since it implies other states.
1630864400
Opps you are correct Jens....I updated it above.
1630867648
Thanks for the script Craig! A really handy option to have available on the fly. I quickly threw together a simple macro for your commands: !Daylight ?{Light Level|day|night|dusk|moonlight|off}
1631352805
Thank you for the script Craig  and the macro Sam B, both came in very handy.