This file contains hidden or 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("chat:message", function (msg) { | |
// Exit if not an api command | |
if (msg.type != "api") return; | |
var command = msg.content.split(" ")[0]; | |
if (command == "!replace") { | |
var selected_id = msg.content.split(" ")[1]; | |
var selected = getObj("graphic", selected_id); | |
var name = msg.content.substr(msg.content.indexOf(selected_id) + selected_id.length).trim(); | |
This file contains hidden or 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
/** | |
* Automatically removes temp HP if they exist. | |
* | |
* When a token has its HP reduced the script checks to see if there are any | |
* temp HP available. If it does those are removed first and the real HP is | |
* updated to reflect the temp HP absorbing the hit. | |
* | |
* TEMP_BAR_ID - The bar used to track temp HP [1, 2, 3] | |
* HP_BAR_ID - The bar used top track real HP [1, 2, 3] | |
*/ |
This file contains hidden or 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
var HP_BAR_ID = 3; | |
on("ready", function() { | |
on("add:graphic", function(obj) { | |
//Will only be called for new objects that get added, since existing objects have already been loaded before the ready event fires. | |
log("DEBUG: " + obj.get("represents") + " : " + obj.get("bar" + HP_BAR_ID + "-link")); | |
if (obj.get("represents") && obj.get("bar" + HP_BAR_ID + "-link") === undefined) { | |
var character = getObj("character", obj.get("represents")); | |
obj.set("bar" + HP_BAR_ID + "_value", getAttrByName(character.get("_id"), "hp", "max")); | |
obj.set("bar" + HP_BAR_ID + "_max", getAttrByName(character.get("_id"), "hp", "max")); |
This file contains hidden or 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
// The attribute where languages are stored on the character using a comma-separated list | |
var LANG_ATTRIBUTE = 'lang'; | |
// Global PC array so we can use getObj instead of findObjs | |
var PCS = []; | |
var separators = /[()\-\s,]+/; | |
on("add:graphic", function(obj) { | |
if (obj.get("represents")) { |