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 .
×
Our team is currently investigating rolling service outages. For more information, visit our most recent Forum Announcements post.
Create a free account

ChatSetAttr - Deducting from a repeating section

1524502707
MSG
Pro
Sheet Author
In one of my campaigns, the characters carry torches in their equipment section - which is a repeating section.  I've made it so they all have their torches as the first entry, but what's the best way to deduct 1 from their inventory when they use a torch.  I'm using Torch and TokenMod to change the character's light emitters, but I need a way to deduct one from their inventory.  This is my first time using ChatSetAttr, so please forgive me for what may sound like a dumb question. Thank you!
1524509574
Pantoufle
Pro
Sheet Author
Translator
Hello, !setattr --silent --sel --class_resource|[[@{selected|class_resource} -1]] You can replace sel by the character name or target :) (Class_resource is the first repeating resource, the next one is other_resource... and I don't remember the next ones but you can find it with holding your mouse on the field I believe) :)
1524511397
MSG
Pro
Sheet Author
Thanks, but that didn't work - but it did give me an idea to try.  I'm using the 1st Ed AD&D character sheet in that particular campaign. With a mod to the command, I got it to work!  I had to go with: !setattr --silent --sel --repeating_equipment_$0_quantity|[[@{selected|repeating_equipment_$0_quantity} -1]] So I thank you very much for pointing me in the right direction!  :)
1524511835
Pantoufle
Pro
Sheet Author
Translator
Sorry, I assumed you used 5e OGL :) Glad can help
1524512211
MSG
Pro
Sheet Author
No worries!  :) I guess I'm just (really) old school.  :D