
Currently, I am trying to modify another script to set the light values of a token and it works great with the only exception being that it only works on the first token it encounters. I would like it to affect all tokens with the same name, though I cannot figure out how. Any help would be appreciated... var lights = function(radius,dim) { var light = findObjs({ _type: 'graphic', name: "Torch" })[0]; light.set("light_radius", radius); light.set("light_dimradius", dim); }; on("chat:message", function(msg) { if(msg.type == "api" && msg.content.indexOf("!lightson") !== -1) { lights(30,20);};}); on("chat:message", function(msg) { if(msg.type == "api" && msg.content.indexOf("!lightsoff") !== -1) { lights(0,0);};});