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

auto-move a players focus to center on their token

greetings! I am new to API scripting and am looking for some help. I would like an API script that will move the players focus when their token is moved without moving everyone else's focus, and without moving the GM's focus.  I understand that this should be doable with the ping() command, though getting it to function correctly is eluding me.  I would like to use this as a "slave" to the GM. I am using Roll20 to run my maps on the tv i have laid onto our game table. I have the "player" account running on the tv. I ultimately would like to be able to move the player token as a GM, and the player screen automatically update to be centered on the new location of the token. I also only want it to do so for the player's token. So I don't want it to re-center every time I move an enemy token. is this possible?
I think I figured it out shortly after I posted this. Here is the script I have that is working. I just listed the playerID so it only moves the "map" player. I haven't tested it on different maps yet, though I think it should work similar. My next step will be to make it work for any player so that if I move their character token, their focus automatically follows.  on("change:token",function(obj){         if(obj.get("controlledby")=="-NGILJxHysRtPTUC8ZsQ"){             sendPing(obj.get("left"),obj.get("top"),obj.get("pageid"),"-NGILJxHysRtPTUC8ZsQ",true,"-NGILJxHysRtPTUC8ZsQ");         } });
Here's a script that uses a command to pull all controlling players to a token when used: <a href="https://app.roll20.net/forum/post/7846802/api-to-move-slash-ping-specific-players-not-all-of-them/?pageforid=7846802#post-7846802" rel="nofollow">https://app.roll20.net/forum/post/7846802/api-to-move-slash-ping-specific-players-not-all-of-them/?pageforid=7846802#post-7846802</a> You can probably use it to modify if you want a version that automatically pings when a token is moved.&nbsp;&nbsp;
1668354593

Edited 1668354661
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Ping Buddy is a script that can do all of this and more. It can automatically ping to a given token, a player's own token, follow a token as it moves, and more besides. Demo Video