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

[Script Writing/Testing Tip] Very "hacky" not recommended for finished script.

1472985766
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
on_change_page_gridlabels = function (obj) { if (obj.get("gridlabels")) { //Do something with a page } else { //Stop doing something with a page } }, register_event_handlers = function () { on("change:page:gridlabels", function (obj) { on_change_page_gridlabels(obj); }); },
1472985925

Edited 1472986086
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Sometimes you want to play around or work with an idea that deals with a page... and you need a quick "toggle" on off.... The "gridlabels" checkbox is just sitting there most often not doing much... just don't recommend highjacking it permanently. It's short sweet and you know what page you are on definitely.
1472986248
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
1472986309
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
In that GIF... I am using it to turn "on" and "off" a map making tool bar.
1472997139
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Stephen, how do you come up with these mapmaking systems; thats looking like it's going to be an awesome script and I can't wait to try the finished version.
1473004614

Edited 1473005610
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
I wanted something that obfuscated the grid, not completely simple to do when dealing with dungeon tiles.. facing and flipping often makes the grid obvious for some tile textures, e specially where the tiles meet. And I wanted auto dynamic light pathing for round shapes. And wanted to use the top row on the map layer as a ribbon toolbar..... and so I used the "gridlabels" checkbox as a tempary "toggle." Its actually very handy for quick short term coding, but not a good idea long term.
1473019949
Lithl
Pro
Sheet Author
API Scripter
Stephen S. said: on("change:page:gridlabels", function (obj) { on_change_page_gridlabels(obj); }); FWIW, this can be shortened to: on("change:page:gridlabels", on_change_page_gridlabels);
1473023511
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Brian said: Stephen S. said: on("change:page:gridlabels", function (obj) { on_change_page_gridlabels(obj); }); FWIW, this can be shortened to: on("change:page:gridlabels", on_change_page_gridlabels); Cool!