
I'm working on a script that allows players to scroll a map on a landing page for a campaign. However, I discovered that a user could still scroll the map around even when not on the page. I wanted to make a check at the start of the code that verifies if they player inputting the command request is viewing the page with the map. A short little example of what the script does: <a href="https://imgur.com/W2dl0Vq" rel="nofollow">https://imgur.com/W2dl0Vq</a> function doMapMove(token, orientation, distance){
try {
log(orientation + " " + distance);
token.set(orientation, token.get(orientation) + distance);
} catch(err) {
log("movemap command detected but failed");
return;
}
}
on("ready", function() {
on("chat:message", function(msg) {
try {
var mapObject = findObjs({_type: "graphic", name: "movable_map"})[0];
} catch(err) {
log("No movable_map object detected");
return;
}
map_pageID = mapObject.get('pageID');
player_pageID = ...
if (map_pageID == player_pageID)
{
if(msg.type == "api" && msg.content == "!movemap-up") {
var distance = 250;
var move_orientation = "top";
doMapMove(mapObject, move_orientation, distance);
}
if(msg.type == "api" && msg.content == "!movemap-down") {
var distance = -250;
var move_orientation = "top";
doMapMove(mapObject, move_orientation, distance);
}
if(msg.type == "api" && msg.content == "!movemap-left") {
var distance = 250;
var move_orientation = "left";
doMapMove(mapObject, move_orientation, distance);
}
if(msg.type == "api" && msg.content == "!movemap-right") {
var distance = -250;
var move_orientation = "left";
doMapMove(mapObject, move_orientation, distance);
}
}
});
}); I know that playerspecificpages grabs a list of players and what pages they're on, but how do I get a hold of the player ID of the person entering the command to be able to search that list for a match?