const lastArg = args[args.length - 1];
let tactor;
if (lastArg.tokenId) tactor = canvas.tokens.get(lastArg.tokenId).actor;
else tactor = game.actors.get(lastArg.actorId);
const target = canvas.tokens.get(lastArg.tokenId)
//The filterID can be any name you desire.
let filterID = "whereismagic";
//You can change the params to be any other TMX effect you want. Just make sure to keep the one line filterId: filterID,
let params =
[{
filterType: "glow",
filterId: filterID,
outerStrength: 4,
innerStrength: 0,
color: 0x5099DD,
quality: 0.5,
padding: 10,
animated:
{
color:
{
active: true,
loopDuration: 3000,
animType: "colorOscillation",
val1:0x5099DD,
val2:0x90EEFF
}
}
}];
if(args[0] === "on" && target.data.name === args[2])
TokenMagic.addFilters(target, params);
if(args[0] === "off")
target.TMFXdeleteFilters(filterID);