Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Minor bug with finding a token

My scripts will be running fine and using findObjs has no issue at all until... I delete a token from the map and then drag the linked token from the character sheet back to the map. My scripts will sometimes not be able to find the token using findObjs. Is there a delay on the token being updated on the map? I have noticed that if I edit the token and click the save button it seems to rectify the issue. It's a nuisance having to do this but at least it works. Has anyone else experienced this?
1400731355
Lithl
Pro
Sheet Author
API Scripter
What are you passing to the findObjs function?
var targetMatched = findObjs({ _pageid: Campaign().get("playerpageid"), _subtype: "token", layer: "objects", }); if(targetMatched.length > 0){ _.each(targetMatched, function(obj) { TargetID = obj.get("represents"); ControlledBy = Identifiers.ControlledBy(TargetID); }); } A token that is linked to a character sheet will not be found by findObjs on some occasions after it has just been placed on the map. Sometimes I have to edit the token and hit the 'save' button in order for the findObjs to work. It is kind of random. For most of the tokens I have no problem, this is what baffles me.
I have a similar issue where on just one map, the findObjs insists that one of my tokens is at the center of the map, no matter what updates I do. It's very odd and is only on one map. As soon as i move the bookmark to any other page, my findObjs works as expected.
In the properties of the token, is the player controlling the token still in the editable and controlled by box? If this is a PC, maybe you should put it in their journal and have them place it and see if the issue persists.
Yes, the token is controllable by a player.