Skip to content

Instantly share code, notes, and snippets.

@Bastlifa
Created November 24, 2017 23:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bastlifa/374ccd15140c587ab80adb6681905b22 to your computer and use it in GitHub Desktop.
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.
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