Created
October 26, 2017 08:06
-
-
Save Bastlifa/5ce152f54c899c6396163f057b21386a to your computer and use it in GitHub Desktop.
Roll20 Bar1_Value Change Report to token owners and GM. Reports bar1 as "speed" at user request
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
//Requested speed updating script. Should be pretty simple. | |
on("change:graphic:bar1_value", function(obj, prev) { | |
if (obj.get("controlledby") != "" || obj.get("represents")) | |
{ | |
if (obj.get("represents")) | |
{ | |
if(getObj('character', obj.get('represents')).get("controlledby")) | |
{ | |
SpeedUpdateReport(obj, false); | |
} | |
} | |
else | |
{ | |
SpeedUpdateReport(obj, true); | |
} | |
} | |
}); | |
function SpeedUpdateReport(obj, noRep) | |
{ | |
var owners; | |
if(noRep) | |
{ | |
owners = obj.get("controlledby").split(','); | |
} | |
else | |
{ | |
owners = getObj('character', obj.get('represents')).get("controlledby").split(','); | |
} | |
if (!owners.length) {sendChat("", "some kinda mess up"); return } | |
else | |
{ | |
for(var i=0; i<owners.length; i++) | |
{ | |
sendChat("", "/w " + getObj('player', owners[i]).get("displayname") + " " + obj.get("name") + " speed changed to: " + obj.get("bar1_value")); | |
} | |
sendChat("", "/w gm " + obj.get("name") + " speed changed to: " + obj.get("bar1_value")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment