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

Calling a Custom Attribute Name and Values (Current and Max) in @{other_resource_name}, @{other_resource}, and @{other_resource_max}

Is it possible to call a Custom Attribute Name ("Bolt") that I created for use with the Ammo tracker API, and enter its values from under the "Attributes & Abilities" tab into the @{other_resource_name}, @{other_resource}, and @{other_resource_max} attributes?  For example, I want to connect them as follows: @{other_resource_name} to show up as "Bolt" by calling that resource name ( or for this one I guess I could just manually type it in ) @{other_resource} to show up as "Bolt" custom attribute current value for that resource. @{other_resource_max} to show up as "Bolt" custom attribute max value for that resource.
1599550356

Edited 1599550445
GiGs
Pro
Sheet Author
API Scripter
If you simply want to transfer the value from your custom attribute to attributes that exist on the sheet, you can do it with a script like chatSetAttr (or just type them in manually!). You cant create a persistent connection between them, though, without using a custom API script. So you;d need to run it again every time one of the attributes changed. So if you do this, you are best off abandoning your custom attribute and just switching to the on-sheet attributes.
Thx!!!&nbsp; My overall goal was to&nbsp;for the Ammo API to update an on-sheet attribute.&nbsp; I just re-read the description at&nbsp; <a href="https://app.roll20.net/campaigns/scripts/4134715" rel="nofollow">https://app.roll20.net/campaigns/scripts/4134715</a> and I'm going to tinker with the macro to try making it update the on-sheet attribute. Wish me luck!
1599585353
GiGs
Pro
Sheet Author
API Scripter
The ammo script can update any attribute - so it can update on-sheet attributes, but if created a custom attribute, it can update that as well. Is there a reason you need to use the on-sheet attribute?
My preference is for the Ammo scrip to update an on-sheet attribute so it's clearly visible on the character sheet when for example a crossbow bolt is expended. I just tinkered with the macro and got it to subtract the resource correctly, but now it's not naming it in the chat output. I want it to read, " (Trigger) uses 1 Crossbow Bolt and has # remaining. " Here is the macro I entered under the Weapon's Description field: &nbsp; &nbsp; &nbsp;[xbow](<a href="https://i.pinimg.com/originals/17/8e/ce/178eced7cbf2068a7dd8f633adffb86b.jpg" rel="nofollow">https://i.pinimg.com/originals/17/8e/ce/178eced7cbf2068a7dd8f633adffb86b.jpg</a>) &nbsp; &nbsp; &nbsp;}} &nbsp; &nbsp; &nbsp;!roll20AM --audio,play,nomenu|Xbow &nbsp; &nbsp; &nbsp; !ammo @{character_id} other_resource -1 other_resource &nbsp; &nbsp; &nbsp;!
1599586710
GiGs
Pro
Sheet Author
API Scripter
It's a long time since I've used ammo, but isnt one of those _other_resources meant to be the label you want to show in chat. So maybe this? !ammo @{character_id} other_resource -1 Crossbow
You rock thank you so much!
UPDATE: &nbsp; Added one minor tweak to call the resource name instead of manually typing in "Crossbow Bolt": &nbsp; &nbsp; !ammo @{character_id} other_resource -1 @{other_resource_name}
1599588151
GiGs
Pro
Sheet Author
API Scripter
You're welcome :) That's a good tweak.
SIDE NOTE: I also figured out how to call other on-sheet resources, like repeating_resource_right. Needed to add a $0 like so: &nbsp; &nbsp; &nbsp; !ammo @{character_id} repeating_resource_$0_resource_right -1 @{repeating_resource_$0_resource_right_name}