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

DLTool Toggle Grid Opacity Solution Not Working

1761711425

Edited 1761712057
After reading thru the following archived thread... <a href="https://app.roll20.net/forum/post/11614063/slug%7D" rel="nofollow">https://app.roll20.net/forum/post/11614063/slug%7D</a> I added what I believe to be all the necessary API... Mod Library G TokenMod G Vector Math G MatrixMath G Path Math G checkLightLevel G Dynamic Lighting Tool G MathOps G Plugger G libTable G Muler G SelectManager G libTokenMarkers G Messenger G Fetch G APILogic G libInline G ZeroFrame G MetaScriptToolbox (Would have posted a screenshot, but it kept breaking the post.) However, when I try to use the solution posted by @timmaugh... !dltool-mod --grid_opacity|{&amp;if&nbsp; @(page.@(selected.pageid).grid_opacity) = 0}0.6{&amp;else}0{&amp;end} {&amp;select *,+npc} it will perform a one-time adjustment of the grid opacity on the currently viewed page to 0.6, but it does not toggle between 0 and that 0.6. Instead it simply stays at 0.6. Restarting the sandbox and Shift+F5ing my campaign didn't help either. Is there some new way of accomplishing this that my SearchFu is unable to find? I thought to test if the toggle method from TokenMod would work (i.e.&nbsp;!dltool-mod --set grid_opacity|!0.5), but unfortunately the presence of an ! before the value simply sets the grid opacity to 0 instead of toggling. Any suggestions?
1761746807
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I can't answer to the metascript portion, but as the author of DL Tool, I ask that you try issuing the commands manually (I.e. with static values). See if the grid opacity changes. I have noticed that sometimes the VTT won't actually change some API-set values unless the user manually opens the page settings and closes them again. If they don't change from a regular command, then it might be that a metascript solution will not help.
1761747473

Edited 1761747510
Yeah I had already tried reinitializing the sandbox, closing and reopening Roll20, and even Shift+F5ing to see if that helped, but it was to no avail. Also, direct commands to change the opacity such as these work fine: !dltool-mod --grid_opacity|0.5 !dltool-mod --grid_opacity|0 I was really hoping to cut-down on button clutter by reducing as many of my on/off macros to a toggle like I did for Token Menu visibility and Grid Snap (the --flip command in TokenMod is awesome). Would adding a new command to DLTool that can toggle between 2 specified values (or cycles thru an array) be a possibility? i.e. !dltool-mod --flip grid_opacity|{0,0.5}
1761750786
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Before even considering that, since we have verified that the script is working correctly on its own, let's summon the metamancer himself, and see if timmaugh has some direct insight. While we are at it, to ensure that we aren't&nbsp; dealing with an XY Problem , can you explain what you want to accomplish and why?
OMG, I just spent an hour writing up a response, and the forum came back with a "that page cannot be found" error when I clicked Submit! Are images not permitted in replies here?! T-T
1761761397
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Images should be fine, but it sounds like something else went wrong. Typically when an image cannot be posted, the post itself is sent, but the image is ignored. One of the factors at play here is that people have gotten used to more modern messaging software like discord, which can accept a copy/paste as if it was uploaded. The Roll20 forums are older, forum software, and require the image to be physically uploaded (not just pasted), or if it is pasted, then copied and pasted from a source that is already on-line. Anything else will be dropped. But it shouldn't have caused a general failure.
1761764798
timmaugh
Forum Champion
API Scripter
Hmm... I may need more information, because on a Jumpgate/2014/Default Sandbox game, I can get the setting to toggle. I am using the command provided in the first post of this thread, modified only slightly in that I don't require the "+npc" portion of the {&amp;select} tag... basically, the {&amp;select} tag is already limited to the page the player is on, so as long as there's *anything* there to select, you don't need the limitation to it being an npc. !dltool-mod --grid_opacity|{&amp;if @(page.@(selected.pageid).grid_opacity) = 0}0.6{&amp;else}0{&amp;end} {&amp;select *} After running this, you can check the grid opacity with either DL Tool or the Metascript Toolbox. You can run either: !dltool --report|extra ...to check it with DLTool, or you can run... !The page ID is @(selected.pageid[not found]), and the grid_opacity is @(page.@(selected.pageid).grid_opacity[not found]) {&amp;simple} {&amp;select *} To check it with the Toolbox. As I stated, I can toggle the value (between the chosen settings of 0 and .6), however I am not seeing a change on the VTT. Keith and I are running this past the Aaron (and further up the flagpole, if needed) to see if there is a wider API issue that needs correcting. For now, can you try the command line as I have listed it, followed by one of the testing options? Toggle it and track the settings to see if it works, then let us know.
1761766111

Edited 1761768480
Noted about the ancient forum software, I'll use the upload function instead of pasting then. So if I can remember where I was... With the start of a new campaign, my group decided we'd switch from D&amp;D and give Daggerheart a try. Compared to 5E and Pathfinder's more strict grid-based movement, Daggerheart is intentionally less precise and just uses ball-park distances &nbsp;(see the new Range Scale feature on the Measuring Tool in my screenshot). The thing is, the grid being enabled still shoe-horns tokens into snapping to cells even if the Range Scale is enabled unless you manually disable snapping on each token. I don't want to disable snapping for everything &nbsp;because Roll20 treats everything as a "token" when it is dragged into a scene, and I also can't keep the grid disabled because I need that snapping behavior for precisely aligning maps and sub-objects like additional floors of towers (hidden on the GM layer in my screenshot above), or tree canopies for the foreground layer. Since repeatedly changing settings douses my creative spark during prep and takes me out-of-the-scene when I'm GMing, I've tried to simplify as many of these repetitive tasks as I can using macro buttons: changing grid opacity between 0% and 50%, toggling the token menu on/off, toggling grid snap, faking a "ring" on tokens that lack one (2 auras overlaid), as well as incrementing/decrementing counters, HP, and Stress. The thing is, I hate clutter which is exactly what's starting to accrue as I find the need for more and more macros. As such, I've been trying to consolidate the functions that I simply want to be able to toggle on/off as much as possible. Unfortunately, even though I'm a sys admin IRL, I'm not a developer and code pretty much makes my eyes glaze over after more than a few minutes. As for why I'm splitting up layers of Czepeku's Island Toll Castle like in that screenshot? Long and short of it is that on more complex maps with multiple levels and PCs who might be in different areas, repeatedly switching scenes takes longer than I'd like and is disruptive because it splits PCs across multiple scenes. Layering the map-tiles works well enough visually, until such a time as PCs are on different floors. Unfortunately, since different floors have different placements for doors and walls, that also complicates drawing the light-blocking walls, doors, and windows on a single layer. As a work-around, separating each room in Photoshop into its own PNG, and cropping them to the same grid spacing as in Roll20 solves this. I can then hide the additional rooms on the GM layer and swap them in/out as the party explores. (Probably need to make a button for that too since I keep forgetting the keybinds.) While I could &nbsp;stack them in-place and repeatedly call Send to Back, that's not great either. First off, it requires my middle-aged brain to remember which floors are what from when I was prepping a few weeks prior. Secondly, in the case of the 3-level tower in the SE corner, stacking them is inferior to being able to display all 3 floor separately should the party be split-up between floors. This is a big part of why leaving the grid on during play (and quickly revealing/hiding it so I can visually line stuff up), and disabling snap on the tokens has proven useful. Another use case for this setup is due to how the Foreground layer functions. In a different Daggerheart campaign, I recently ran a bandit ambush using the Bandit Ambush Pack from 2-Minute Tabletop. In that pack, they separated the tree canopy into 3 PNGs, but unfortunately instead of just revealing a radius around the character like with Fog of War, Roll20 instead reveals what's under the entire PNG. Sooo it was once again back to Photoshop to crop each tree to a matching grid so I could get a more granular effect in Roll20 -- and for that, grid snapping on the Foreground layer was essential even though it didn't want it at all on the Token layer:
1761766317
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
To corroborate, I have run into this problem with using the API to set grid opacity many times, but for some reason today it's working perfectly. Frustrating.
@timmaugh The updated command you just pasted DOES work for me! is it possible the one from the post 2 years ago was calling upon something that was since deprecated or otherwise incompatible with Jumpgate or using Daggerheart instead of 5E 2014?
1761767626
timmaugh
Forum Champion
API Scripter
The updated command is only different in that it relies on there being an NPC token somewhere on the board... but the availability of that criteria is still in the production code for SelectManager, and it works for me on a page where I know I have an NPC. In any case, the version you have should work AS LONG AS THERE IS ANY TOKEN on the page. I could provide a version that relied on the page-of-the-player making the command, which wouldn't rely on any token... I guess. Also, we are seeing an underlying issue with the way the VTT is updated so that there isn't always a visual change to the grid opacity after these commands. Efforts are underway to chase those problems down.
Gotcha, I pretty much always have at least that "Party Star" token present on each map as the origin point for where my players will load-in, but that's a good caveat for me to keep in mind. Thanks for the quick reply and the updated command. Hopefully this thread will be helpful to anyone else Googling the same thing in another 2 years. :)