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 to automatically center Roll20 viewport on a token?

In an attempt to create a "viewing user" so that I can have a projector using Roll20 without my intervention, I've got an idea to create or find a script that centers the viewport on a designated user's token. Here's the problem: If I'm DMing in one window, and I've got the projector running the players' view in another window, I have to alt-tab over to the players' window and periodically scroll the view to make sure that the tokens are still visible on the screen. Does such a script already exist, and if not, does this sound like a feasible solution?
1413580410
Lithl
Pro
Sheet Author
API Scripter
There is the sendPing function, but last I saw someone posting a script with it, the function was bugged with regard to what players it moved the view for. I haven't tested it myself.
Wow, that's great -- now if only it wouldn't send a ping each time, and just did the centering. :)
Can't quite figure out what I'm doing wrong, here (target player's token is named "Rolen"): setInterval(function() { var centertoken = findObjs({_pageid: Campaign().get('playerpageid'), _type: "graphic", name: "Rolen"})[0]; sendPing(centertoken.get("left"), centertoken.get("top"), Campaign().get('playerpageid'), null, true); },5000); Should center on that token, yes? I've run it with log statements, and the sandbox seems to output the right values for left and top.
Hmmm...looks like there is a known bug associated with sendPing. ...and in researching that bug, I found that Ctrl-Click does exactly what I need. sigh