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

Get array containing all attributes on a character

Working on creating a skill rolling script for my GM so he can check for and call skill checks from players that they shouldn't know about (like Spot checks). The character sheet we use implements a fieldset to manage an expanding list of skills. I was hoping to get an array of attributes and itterate through that to find the target skill, but the findObjs function doesn't seem to be working properly. Any help would be appreciated. I've checked the value for token.represents, and it does match up with the intended character. var skillName = getTagValue("skill_name", txt); var modifier = getTagValue("modifier", txt); var token_id = getTagValue("token_id", txt); var token = getObj("graphic", token_id); var attrs = findObjs({ _type: "attribute", _characterid: token.represents, }); log(attrs); var objName = ""; var objNum = ""; var skillRate = 0; problem: log(attrs); returns [], log(attrs[0]); returns undefined
1410073760
Lithl
Pro
Sheet Author
API Scripter
Use token.get('represents') for the characterid. The only property of a Roll20 object which can be accessed directly (without the get function) is id , so token.represents is undefined, resulting in an empty array from findObjs (since nothing has an undefined characterid).
Thank you! :D