var nudge_action = function (obj) {
var character = obj.get("represents"), player;
if (_.isEmpty(character)) {
sendChat("API", "just the token");
// You have just the token.
// Do something
} else {
player = getObj("player", getObj("character", obj.get("represents")).get("controlledby").split(/\s/)[0]);
if (_.isEmpty(player)) {
sendChat("API", "Token and character");
// You have token and the character.
// Do something.
} else {
sendChat("API", "Token, first player and character.");
// You have the token, first player in the controlby and thecharacter.
// Do something.
}
}
},