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 .
×
May your rolls be merry + bright! 🎄
Create a free account

[Script] How to get token in current turn?

In turnorder object have no characterId. I trying to do a script that subtract duration from the buffs. on('change:campaign:turnorder', function(msg) {         let pageId = Campaign().get('playerpageid')         let turnOrderFrom = JSON.parse(Campaign().get('turnorder'));         log(msg);         characterId = turnOrderFrom[0]; //Here I get first position, but how can I link with character?         subtractBuffDuration(characterId); });
I found how. The id of turnorder is the same from token.     on('change:campaign:turnorder', function(msg) {         let pageId = Campaign().get('playerpageid')         let turnOrderFrom = JSON.parse(Campaign().get('turnorder'));         log(getObj('graphic',turnOrderFrom[0].id));     }); I swear I was researching for an hour before asking here. Five minutes later, I found the answer.
1618674735
The Aaron
Roll20 Production Team
API Scripter
Good ole' rubber duck debugging! ( <a href="https://en.m.wikipedia.org/wiki/Rubber_duck_debugging" rel="nofollow">https://en.m.wikipedia.org/wiki/Rubber_duck_debugging</a> ) Glad you got it working, definitely come back if you've got more questions!
hahahahahaha exactly!