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 ID issues

I have a lot of Token ID issues where there token ID changes, sometimes multiple times per game.  I thought it might be happening on page changes, but I that isn't consistent.  I really don't know why the ID changes on one character and not others.  Any ideas?
1676097586
The Aaron
Roll20 Production Team
API Scripter
Token IDs are unique to an individual token. That means if your drag out a new copy, it has a new token ID. If you copy paste a token, it has a new Token ID. This is expected and desirable behavior.  If you want to find all the tokens that represent a given character, you can look at the represents property.  Does that clear things up?
1676097673
The Aaron
Roll20 Production Team
API Scripter
Or are you saying that the token id is changing for a token without dragging out a new copy, or without copy pasting, etc?
1676126464
Pat
Pro
API Scripter
I've had something of a similar issue - ghost, duplicate, or randomly appearing "new" copies of tokens resulting from dragging character sheets/NPC sheets to the tabletop. I don't do anything reliant on token IDs other than a few elements like emojibubble or teleporter, so it's not too disruptive yet, not sure if it's related to the "make all the tokens on all the pages match the changes to a token on the character sheet" business... 
1676129956

Edited 1676129990
Thanks.  I guess it is because I'm dragging out new copies or changing the page.  I have macros set up that need token ID, so is there a way to have them automatically read a tokens ID, first, then make them work.  Right now, I'm asking for the token ID @{selected|token_id} each time it changes then manually changing it in the code that I'm using (AMMO tracking). This is getting to be a problem, because I'm tracking daily abilities and we are flipping maps all the time for up to 8 PCs. Is there a better way to track this or update token IDs in my character sheet macros?  Or general macros that I assign to characters?
1676130305
The Aaron
Roll20 Production Team
API Scripter
If you're using my Ammo script, you can (and really should) supply it Character IDs, which are unique to the character.  You can still get them with @{selected|character_id}, and you can hard code them into macros because character IDs don't change in a given Game.  You can also use @{Bob the Slayer|character_id} if you want to write macros you can copy between games with characters that have the same name. 
The Aaron,  Thank you, that was the issue!