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

Page Api for GM's

Is there any api to determine which page a gm is on, or change the page the gm is on. I just found some post from 7 years ago and could't find any updates on this
1684152772
Pat
Pro
API Scripter
It's in the suggestions forum, also from seven years ago, it has not been implemented yet. 
1684160091
The Aaron
Roll20 Production Team
API Scripter
You can determine which page the GM is on, but you can't change the page they are on. 
How do you determine which page the GM is on? I only know some workarounds like selecting a token, and then call your api.
1684178774
timmaugh
Pro
API Scripter
If you want to know what page a player/gm is on, you can use Fetch (though I am in the process of patching a problem with this specific feature). If you want to know from code (like you'd write your own script), Aaron has a handy function I liberated   ... poached     ...   absconded with     ...   borrowed mightily ... Alright. I pilfered it. I did. If that's what you want and Aaron hasn't shared it, I can look it up.
1684178847
The Aaron
Roll20 Production Team
API Scripter
Here's the function I use for getting a player's page, including a GM player: const getPageForPlayer = (playerid) => { let player = getObj('player',playerid); if(playerIsGM(playerid)){ return player.get('lastpage') || Campaign().get('playerpageid'); } let psp = Campaign().get('playerspecificpages'); if(psp[playerid]){ return psp[playerid]; } return Campaign().get('playerpageid'); };
1684178973
The Aaron
Roll20 Production Team
API Scripter
Lol
Oh nice I did not know player.get('lastpage') property Thanks a lot
1684182561
The Aaron
Roll20 Production Team
API Scripter
No problem.  lastpage (or _lastpage), is the id of the last page the player loaded while logged in as a GM.  It can be blank (don't recall if it's undefined, empty string, or null) if the game is new or the player has never loaded a page as a GM.  It can also be wrong if the GM has more than one copy of the game open and they've loaded another page more recently in the other tab.  Both those cases are rare occurrences, but you should know about them just in case you run across them.
Thank you for the additional infos, I dont think these rare cases will occur in my case. I am currently making something like map change but with more filtering methods, and wanted to add a token which can be used to go to tp to the next map. In this scenario there will always be a map the gm is currently editing.
1684389010
Pat
Pro
API Scripter
Teleport does a few of those things.