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 .
×

Newbie API Help

Hello all, I am looking at creating a Rage script for the 5e OGL character sheet. My idea is to trigger off of !Rage in chat and make several adjustments to the character's token and sheet. For the token I will add the Strong icon and a 1 unit colored aura as a representation of the character being raged. For the character sheet I would like to update global damage so Rage is added to weapon damage accordingly. Additionally I would like to also update the Class & Other Resource section to deduct a Rage counter.  At this point my difficulties are with the character sheet, as I'm not able to correctly find either of the global damage, or class resource attributes. So my question is, does anyone know what these attribute names are? When I try to use findObjs() and use the attribute name shown in the 5e OGL wiki I constantly get back empty objects. For example: the wiki shows the following: To call the first set of class resources use: Class Resource @{class_resource} Other Resource @{other_resource} To call the Repeating resources use Repeating Resource 1st left @{repeating_resource_$0_resource_left} Repeating Resource 1st right @{repeating_resource_$0_resource_right} Repeating Resource 2nd left @{repeating_resource_$1_resource_left} Repeating Resource 2nd right @{repeating_resource_$1_resource_right} However, when I try findObjs({ id: character.id, attribute: 'class_resource' }); I am returned []. Any help is greatly appriciated. Thank you, Llynthian
1508118993

Edited 1508119053
The problem is that you are using the character's ID as the specific resource's ID. Also, you are not looking for the correct value that holds 'class_resource' that's held within name, not attribute. Attribute here is a type of object in the system, so we limit the search to only attributes as well. Try this instead findObjs({ _type: 'attribute', characterid: character.id, name: 'class_resource' })[0];
Thank you Kyle, that worked great for both the resource and damage mod. I will move forward with that and post back if I run into additional issues.