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

Permanently save token to front / to back setting

This was brought up by another user three months. Now I've run into the same issue. Tokens dropped onto VTT are always on top. That's good for PC tokens but I have spell area effect tokens I'd like to always be on the bottom so we can what they are targeting. I tried setting the area effect token to bottom then saving the token setting but every time I drop a new one it's back on top, potentially covering PC tokens. 
1595289132

Edited 1595289155
The Aaron
Roll20 Production Team
API Scripter
There isn't a way to do that via the interface. Newly created graphics are alway on top.  However, I could write a simple API script that would send things to the back automatically, you'd just need a way to tell it what things go to do that to. The easiest would be setting one of the bars to a sentinel value like "BACK", then you'd just set that as the default token. If that sounds reasonable, I'll whip that up posthaste. 
1595290475
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I use one spell effect rollable token that looks like a target. It has a chat menu as an Ability that switches the face, sizes it appropriately, and sends it to the back. It also plays a special effect sound. This is done with token mod (and Roll20AM for the sound). I've found it's a lot easier than maintaining dozens of tokens, and can lead to some amusing surprises if the player didn't put that target in the exact right place... Here's a video of it in action, and here's the thread talking about how it is done.
Keith, the video of your solution in action looks amazing. I'd like to implement that at some point but for now I want something simple I can set once per template and not worry about again. Aaron, would using an API script be straightforward as editing it to add a reference to the spell templates? I'm using Token Mod but barely scratching the surface.
1595298394

Edited 1595307346
The Aaron
Roll20 Production Team
API Scripter
Here's how I'd do it. Place the word "[Back]" in any of the bars values or max, or in the name, or in the GM Notes on the token, then save that as the default token for a character.  When you drag that token in, it will force it to back. Script: on('ready',()=>{ const lookWhere = [ 'bar1_value', 'bar1_max', 'bar2_value', 'bar2_max', 'bar3_value', 'bar3_max', 'name', 'gmnotes' ]; const regex = /\[back\]/i; const DELAY = 100; on('add:graphic',(obj)=>{ let id = obj.id; let limit = 10; const check =()=>{ let graphic = getObj('graphic',id); if(graphic){ if(lookWhere.find(k=>regex.test(decodeURIComponent(obj.get(k))))){ toBack(obj); } } else if (--limit){ setTimeout(check,DELAY); } }; setTimeout(check,DELAY); }); });
I have some pre-defined templates attached to character sheets (15 foot radius effect, 20 foot radius effect, 15 foot cone effect, etc.) so when I drag them out to the VTT they are already sized correctly. All players have edit permissions on the sheets, but do not see them in the Journal, so they can move the template around. Once the player finalizes their choice, I right-click the effect template and send it to the map layer if it has a duration. If it's an instantaneous effect (like a fireball ), I just note the creatures within the area, right-click the template and delete it.
Aaron, I ran the script but no effect. Maybe I misunderstood but I did try variations of "[Back]", [Back], and Back in a fireball template's name as well as GM Notes. The area of effect remained on top when dropping the token in. Rabulias, that's similar to what I'm doing now with various spell area shapes but I wanted something permanent for the level the token is on.
1595365525

Edited 1595365550
The Aaron
Roll20 Production Team
API Scripter
Does the token have sight and control?  I tried it as part of the name, gm notes and bar values and it seems to be working right for me, but something else might be causing issues.  If it has sight and control, it will get popped to the front for all controllers.  Here's what it looks like for me with "[Back]" as part of the name (gif, click to watch): You can put "[Back]" anywhere in the various fields and it is case-insensitive.