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 .
×

toBack() Not working

I've got this script: on('chat:message', function(msg) { if(msg.type != 'api' || msg.content.indexOf('!sendToBack') == -1) return; var selectedObjs = msg.selected; var path = "<a href="https://s3.amazonaws.com/files.d20.io/images/6779680/h5IuaH8z-zBGWiK0_eQ0lg/thumb.jpg?141898999955555" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/6779680/h5IuaH8z-zBGWiK0_eQ0lg/thumb.jpg?141898999955555</a>" var found = findObjs({_type: "graphic", imgsrc: path}); sendChat("GM","1"); _.each(found, function(obj) { var token = getObj('graphic',obj._id); toBack(obj); sendChat("GM","2"); // toBack(token); i've tried this as well, and it just returns an error, saying it needs an obj from getObj(), for example. }); }); It's supposed to move the brick texture (the URL is stored in path ) to the back of the layer. However it's not moving it to the back at all. I can't tell if it's moving the first or the last, I've seen that as a symptom on other posts, it just doesn't seem to be doing anything at all. Any thoughts or pointers on it? If someone has a snippet that will move all of the same token (as in same image) to the back/front, that would be helpful!
1419700041
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
<a href="https://app.roll20.net/forum/post/1422462/request-" rel="nofollow">https://app.roll20.net/forum/post/1422462/request-</a>... It seems the 5ms delay is the trick.
1419708750
Pat S.
Forum Champion
Sheet Author
moving this to the api forum
1419718565
The Aaron
Pro
API Scripter
Stephen S. said: <a href="https://app.roll20.net/forum/post/1422462/request-" rel="nofollow">https://app.roll20.net/forum/post/1422462/request-</a>... It seems the 5ms delay is the trick. Yeah, when I've messed with this (as in the above script) it seemed to drop the toBack() if not delayed.