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

API for statting tokens?

Long time player who just recently got a subscription. I am have some issues and questions with API. I am currently looking for a way, either using token-mod or another method, to be able to create new tokens and link the desired attributes. The issue I am running into is unlinking the attributes so the token can then be used as a generic npc. Ideally, I would like something along the lines of; Create journal character for npc->select an image I am using for the token->select the represented character-> hit macro/API button and have it fill in HP to bar1 (unlinked), AC to bar2 (linked or unlinked), and also show nameplate. Is something like this possible, and if so does anyone have a recommended method for doing it? Thanks!
1592954748
The Aaron
Roll20 Production Team
API Scripter
If you're doing a single token, or single type of token at a time, you can just set the value rather than linking. !token-mod {{ --set represents|"?{Name}" bar1|@{?{Name}|hp} }} If you're doing multiple, or using  macro, you could set and unset in two separate commands: !token-mod {{ --set bar1_link|hp }} !token-mod {{ --set bar1_link| }} That will set whatever the value of that attribute is, then remove the link in the next command.  I actually don't remember, but it might work to just do it twice: !token-mod {{ --set bar1_link|hp bar1_link| }}
The Aaron said: If you're doing a single token, or single type of token at a time, you can just set the value rather than linking. !token-mod {{ --set represents|"?{Name}" bar1|@{?{Name}|hp} }} If you're doing multiple, or using  macro, you could set and unset in two separate commands: !token-mod {{ --set bar1_link|hp }} !token-mod {{ --set bar1_link| }} That will set whatever the value of that attribute is, then remove the link in the next command.  I actually don't remember, but it might work to just do it twice: !token-mod {{ --set bar1_link|hp bar1_link| }} Thank you so much for the help! Using your advice, I set up a macro that seems to be working perfectly for everything I wanted! !token-mod {{ --set represents|?{Name} --set name|?{Name} }} !token-mod {{ --set bar1_link|hp --set bar2_link|npc_ac --on showname }} !token-mod {{ --set bar1_link| }} !token-mod {{ --set defaulttoken }}
1592976577
The Aaron
Roll20 Production Team
API Scripter
Sweet!  Happy to help!