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 .
×
May your rolls be chill this holiday season!
Create a free account

Script for tracking water and food

1681863369

Edited 1681929274
Does anyone know of an API that can be used to track how much water and food individual players have consumed? Specifically for 5E. I can do it manually ofc but I was hoping there was some kind of tracker within Roll20, similar to LazyExperience. Thanks in advance. EDIT: Thank you for the responses, but I realized I wasn't clear in my OP: I'm not looking to track how much water and food is in the party inventory, I'm looking to track when each player last ate/drank and how much they've had in the day, for purposes of tracking when they should face exhaustion.
1681868178

Edited 1681868452
Gauss
Forum Champion
Which character sheet are you using?  If you are using the 5e by Roll20 sheet then you can make a macro that reports this. No API necessary.  Put the food and water for each player into their respective character sheets as a resource.  Then have the macro call each player's resources and output that into chat (or a whisper to yourself).  Example:  Test has [[@{Test|Other_resource}]] rations.  Test has [[@{Test|repeating_resource_$0_resource_left}]] water remaining
1681869899

Edited 1681869978
I agree with Gauss for the reporting side.  Using the 'other_resource' or 'repeating_resources' is an easy approach.  You could also use the inventory items directly if you know which number they are in the inventory: Test has  @{selected|repeating_inventory_$0_itemcount}  @{selected|repeating_inventory_$0_itemname}  This would display the first inventory item. Just increase the 0 until you get the inventory number for their food or water. Or you could tell the players to put their food and water at the top of their inventory to make it all uniform between character sheets. For adjusting the repeating resources, since you have a Pro subscription you can use the ChatSetAttr script to have the players easily adjust their food and water consumption. Here's a previous thread explaining how to do exactly that.
1681872347
timmaugh
Forum Champion
API Scripter
And if you're thinking of abstracting the command (so that multiple players could use it on their own sheet) but you don't/can't have the character's water in the same spot on every sheet (ie, you can't be sure that it will be resource $1 for everyone), you can use Fetch to get it dynamically: *(selected.inventory.[itemname = Water].itemcount) Then you can report it in a template using ZeroFrame: !&{template: default} {{name=Rations for @{selected|character_name}}}{{Water=*(selected.inventory.[itemname = Water].itemcount)}} {&simple}