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

Token Naming Mismatch

Hello - I am seeing a major issue with renaming tokens. On the VTT I can change the name of an object, such as a player token, and everything on the VTT recognizes the new name. When I try to find or interact with the object in API, it's not found with the new name, only by the old name. I have double checked and confirmed I am looking for a subtype of token and the correct name, but the API is either very behind on updates from VTT, or there is some other issue. I can reproduce this at will. I am willing to make a recording if it will help.
1616262794
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
It might be more helpful to post your script or the relevant portion. I can run a report on a token, change the name and get the new token name immediately (The bold portion after the token image is the token name): But perhaps it has something to do with the finding, since this is simply reporting.
Here is my debug code I use to find the object and report in the API window: on("chat:message", function(msg) {     testName = "test object";     cleanUp = false;          // testName = "following Amarok";     // cleanUp = true;          if (msg.type == "api") {         var logChar = findObjs({             // _id: "-MKAmXdU2auz3MAFBkDm",             // _pageid: "-Kjxzy3pf-LMnzfGP8CP",             _subtype: "token",             name: testName         }, {             caseInsensitive: true         })[0];         if (logChar === undefined){             log("No object called " + testName + " can be found.");         }         else {             log("char string for " + testName + ": ");             log(logChar);         }     if (cleanUp) {         logChar.remove();         log(testName + " removed.");     }     } }); Steps: Create new object (in this case, it's called "following Amarok". Use VTT to rename it to "test object". use VTT command @{selected|token_name} to confirm the name change to "test object" send "!" in chat to trigger above code. API reports back "No object called test object can be found." If I copy/paste the object on VTT, API will report back the object string as expected. I can also immediately rename the new object on the VTT and repeat all the above steps with the same results.