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

Ammo - repeating resource drops below 0

I am using Ammo with the 5e OGL sheet. I am tracking Rations and Waterskin as resources. I am identifying the repeating resources with the row id, as in... !ammo @{Snowy|character_id} repeating_resource_-MOlHjBE4tSielh3s701_resource_left -1 days water ... and that is working fine. However, when I run that, and the value is zero, it warns me, but increments it to -1 anyway. The script description says... If the adjustment would change the attribute to be below 0 or above it's maximum value, a warning will be issued and the attribute will not be changed. ... How can I get it to remain 0, and not drop below that?
1608229125
The Aaron
Roll20 Production Team
API Scripter
For players, it won't go below zero.  It lets the GM do whatever they want.
I see. I was hoping, as the GM, to be able to hit a macro button, lower all the player's rations & water by one. Any way to turn that functionality off in this case?
1608229837

Edited 1608229846
The Aaron
Roll20 Production Team
API Scripter
Not built in, I need to update that script. If you import the script from the 1-click, then go down to line 85 and find this: if( playerIsGM(playerid) || valid ) { and change it to this: if( valid ) { It will treat the GM like any other person.
Oh cool! Thanks so much - you rock.
One more question about Ammo... is there a way to do a refill? Like, instead of incrementing by a positive or negative amount, can we set a value? Or read the total/max amount and set the value to that?
1608231533
The Aaron
Roll20 Production Team
API Scripter
Not built in, but if there is a maximum set, you can just adjust up by some very large number and it will set it to the max for the attribute.
1608251416

Edited 1608251459
Ammo is great! But I use the ChatSetAttr script to refill certain things I track with Ammo. It has a built-in --reset option to set things to their max value. Here is an example with a custom attribute ("helmcharges") added to the character to track the charges. !setattr --reset --fb-public --fb-header Recharging *Helm of Healing* --sel --helmcharges
@Rabulias - see this thread ( <a href="https://app.roll20.net/forum/post/9607071/use-chatsetattr-to-adjust-repeating-resource" rel="nofollow">https://app.roll20.net/forum/post/9607071/use-chatsetattr-to-adjust-repeating-resource</a> &nbsp;) where I'm pursuing this solution for ChatSetAttr , some success but an interesting remaining issue.