I'm attempting to organize my map pages by location. For instance Northern/Coastal/Marina. I then want to gather that data and store it (ultimately to build random encounter tables, etc). However, the best I can get is the map page's name and ID. Here's my latest attempt: /* ========================================================================== */
/* ACTIVE PAGE METADATA CAPTURE */
/* ========================================================================== */
/**
* Returns the Page object currently active for the calling player.
* If the player has a player-specific page, that page is returned;
* otherwise the campaign’s global player bookmark is used.
*/
function getActivePageForPlayer(playerId) {
var campaign = Campaign();
var specific = campaign.get('playerspecificpages');
var pageId = null;
if (specific && typeof specific === 'object' && specific[playerId]) {
pageId = specific[playerId];
} else {
pageId = campaign.get('playerpageid');
}
if (!pageId) return null;
return getObj('page', pageId) || null;
}
/**
* Collects the unique Roll20 page ID and its name as displayed in the UI.
*/
function collectPageMeta(page) {
return {
id: page.id,
name: page.get('name') || ''
};
}
/**
* Captures and returns metadata for the page currently active
* for the given player ID.
*/
function captureForPlayer(pid) {
var page = getActivePageForPlayer(pid);
if (!page) {
return { error: 'Could not resolve an active page for you.' };
}
var meta = collectPageMeta(page);
return { meta: meta };
}
which gives output similar to: Map Information Page: Marina (-OdYtrXRlCu8O6qq36Ub) But what Im attempting to collect is: Map Information Page: Marina (-OdYtrXRlCu8O6qq36Ub) Region: Northern Locale: Coastal As best as I can tell, the map directory structure isnt exposed to the API, but I'm really hoping that I am wrong and there is some cool way to get this done. Im a failure, but Im willing to learn. :) Thanks in advance for any assistance you can give. It is greatly appreciated. peaces! ~tcm