Skip to content

Instantly share code, notes, and snippets.

@Kamanar
Last active December 28, 2015 12:39
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 Kamanar/7502150 to your computer and use it in GitHub Desktop.
Save Kamanar/7502150 to your computer and use it in GitHub Desktop.
Creates a token to the right of the selected summoner when using !summon babau. Additional if statements can be added to add new summoned creatures. Note: You must update imgsrc with a link to your own, uploaded images. Currently, the Marketplace is not supported.
on("chat:message", function(msg) {
if(msg.type == "api" && msg.content.indexOf("!summon ") !== -1) {
var selected = msg.selected;
_.each(selected, function(obj) {
var tok= getObj("graphic", obj._id);
var slice = msg.content.split(" ");
var augmented = 0;
if (slice[2] != undefined) {
if (slice[2].toLowerCase() == "augment") {
augmented = 1;
}}
if (slice[1].toLowerCase() =='babau') {
createObj("graphic", {
name: "Summoned: Babau",
controlledby: tok.get("controlledby"),
left: tok.get("left")+70,
top: tok.get("top"),
width: 70,
height: 70,
bar1_value: 73 + (augmented * 14),
bar1_max: 73 + (augmented * 14),
showname: true,
showplayers_name: true,
showplayers_bar1: true,
imgsrc: "[Insert link to image here]",
pageid: tok.get("pageid"),
layer: "objects"
});
}
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment