Created
November 24, 2017 23:23
-
-
Save Bastlifa/374ccd15140c587ab80adb6681905b22 to your computer and use it in GitHub Desktop.
Roll20 API script to show the health of any tokens on the object layer on the current map the GM is looking at.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on("ready", function() { | |
on("chat:message", function (msg) { | |
if (msg.type === "api" && msg.content === "!ShowHealth") | |
{ | |
var page = getObj('page', getObj('player',msg.playerid).get('lastpage')).id; | |
var tokens = findObjs({type: 'graphic', _pageid: page}); | |
for (var i=0; i<tokens.length; i++) | |
{ | |
if (tokens[i].get("bar1_value")) | |
{ | |
tokens[i].set("showplayers_bar1", "true"); | |
} | |
} | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment