
Just a simple script to turn on and off token actions. This script assumes that you have them either all on or all off (otherwise it will toggle them appropriately). It could be easily adjusted to turn them all on or all off if needed, but to keep track of specific ones to turn on or off, it would need some other component to it. In either case, I think token actions are quite handy and appreciate having everything I want to do with a character a single click away. But for characters with a lot of different possible actions, I want to be able to easily clean up the clutter as I try to move them around. As such, I have created this simple macro which uses !tokenAction to quickly turn off token actions if they are on, or turn them on if they are off. In order to use this, select the token you want to make the changes to and use the command word in chat. Once you have done this, you will have to deselect the token then select it again to see the changes. Here's the script: on("ready",function(){
on('chat:message',function(msg){
if('api' === msg.type && msg.content == '!tokenAction') {
var selected = msg.selected;
if (selected===undefined)
{
sendChat("API","Please select a character.");
return;
}
var tok = getObj("graphic",selected[0]._id);
var importMonster = getObj("character",tok.get("represents"));
var abilityList = findObjs({type:"ability",characterid:importMonster.id});
_.each(abilityList,function(ability){
if (ability.get("istokenaction")){
ability.set("istokenaction",false);
} else {
ability.set("istokenaction",true);
}
});
}
});
});