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

Shift + Click Recenter the map programatically

Is there a call the API exposes to recenter a user on a map or is the Shift + Click of a DM that recenters players only available from the client?  I ask this because I'd like to recenter the DM view of the client based on who is up on the initiative tracker.
1473721943
The Aaron
Pro
API Scripter
Yes. The sendPing() function does this. See:&nbsp; <a href="https://wiki.roll20.net/API:Utility_Functions#Misc" rel="nofollow">https://wiki.roll20.net/API:Utility_Functions#Misc</a>... Last I heard, it was buggy, as in it only pulls the GM there. That said, I think that might be better in some cases. I'd love to hear if you have success with that, or if it has any strange behavior.&nbsp;
1473723233
Ziechael
Forum Champion
Sheet Author
API Scripter
I use it in conjunction with Aaron's Turn Marker script to pull my view to the next token whose turn is up, really handy for quickly finding those mooks who are mobbing the players, it can be a little frustrating if the players have a way to advance the turn order (another little tweak I pestered Aaron into adding to the Turn Marker) and you are in the middle of changing an bar value when they trigger it but it is a minor annoyance that is easily avoided.
1473725340
The Aaron
Pro
API Scripter
hmm.. Could whisper a button to the GM to pull you to it.... hmmm...
1473726674
Tetsuo
Forum Champion
The Aaron, if you get this working, please post it. I would love to implement this.&nbsp;
1473730262
The Aaron
Pro
API Scripter
Sounds fair... &nbsp;pull request sent. Grab it early here: <a href="https://github.com/shdwjk/Roll20API/blob/master/Tu" rel="nofollow">https://github.com/shdwjk/Roll20API/blob/master/Tu</a>... GMs can now click the image of whose turn it is (or was) to be pulled to that token.
1473730803
Tetsuo
Forum Champion
Awesome! That was fast. Is there a way to do it on turn change automatically?
1473730887
The Aaron
Pro
API Scripter
Ha! &nbsp;It could be done, but do you REALLY want that? &nbsp;PM me, we'll discuss. =D
1473759438
Ziechael
Forum Champion
Sheet Author
API Scripter
If you are submitting a pull for that one I'd highly recommend adding the 'next turn' button for players to click on when it is their turn ONLY as a default thing, it is super useful for keeping the flow going and saves the DM a LOT of work ;) Admittedly I'm bias and would suggest you add all of the tweaks I pester for as default things so I can use the one-click installs for a change lol.
1473761024
Tetsuo
Forum Champion
That exists, sort of. If you run !eot it changes the turn. Only the GM or the current player can do it, though
1473762594
Ziechael
Forum Champion
Sheet Author
API Scripter
I know, but i'm never satisfied with simple existing features, I had him tweak mine to add that as an API button in the chat output so my players don't ever have the indignity of having to 'type' things! lol. Seriously though, it is amazing how much play can be sped up with the inclusion of a nice visual reminder to end your turn, even global macros get ignore by some players but that big pink button in chat... yum yum!
1473763038
Tetsuo
Forum Champion
Thats.... an excellent point! It definitely would be a nice reminder.&nbsp;
1473765882
Ziechael
Forum Champion
Sheet Author
API Scripter
It is partially born from the fact that I molly coddle my players, we have been playing for nearly 2 years and in that time they've never had to write a macro, barely have to type anything in chat and generally have the easiest ride of it... but for me that simulates real play more, the only difference is that they don't have to do the math themselves (and since we play 3.5e that alone makes the whole experience even better lol). And... I love making more work for Aaron, keeps him on his toes ;)
1473766471
The Aaron
Pro
API Scripter
(Ow! My toes!). Ok. :)
Thanks so much for the responses and the labor everyone! &nbsp;I am going to have to check out your github pull request immediately.
1473815631
The Aaron
Pro
API Scripter
You might find this function useful: var fixedSendPing = (function(){ &nbsp; &nbsp; &nbsp; &nbsp; var last={}; &nbsp; &nbsp; &nbsp; &nbsp; return function(left,top,pageid,playerid,pull){ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if( last.left &nbsp; === left &nbsp; && &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last.top &nbsp; &nbsp;=== top &nbsp; &nbsp;&& &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last.pageid === pageid ) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sendPing(-100,-100,pageid,null,false); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sendPing(left,top,pageid,playerid,pull); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last.left=left; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last.top=top; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last.pageid=pageid; &nbsp; &nbsp; &nbsp; &nbsp; }; &nbsp; &nbsp; }()) It might not be an issue for your use case, but in testing I found that sendPing() won't ping the same place twice in a row. &nbsp;This version of sendPing(), called as fixedSendPing() and otherwise identical, will detect if the same location is pinged twice in a row and send a ping for a non-visible location first to clear things out. &nbsp;=D
Great stuff The Aaron. =)
1473820113
The Aaron
Pro
API Scripter
:) it's fun to get back into the API a bit. Few more weeks and I can really dive back in with both feet!
This is great stuff, indeed! &nbsp;You know, if this had status tracking like TrackerJacker...it would virtually perfect.
(Your TurnMarker script, that is.)
1474457467
The Aaron
Pro
API Scripter
Yeah, I should really look into doing that.