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

Eating rations automatically using 5E OGL Resting in Style

Hi, I'm using 5E OGL Resting in Style for my games and it's great. But for one of my games, money is very important, so one of the changes I made was forcing my players to eat during their short rests. Of course, I know I will inevitably forget to remind my players from time to time. So, I was wondering, since 5E OGL Resting in Style is able to reroll charges on magical items, I was wondering if there is any way for it to remove 1 ration per rest, either short or long? Also, is there a way for it to indicate how many rations are left in chat, and let the players know when there are none left? Thanks
I use 5E Resting in Style and I don't think it has this kind of capability. I have a  ScriptCards  wrapper around Resting in Style for other purposes that could easily be modified to do this. Other options would be ChatSetAttr in the resting macro. Let me know if you'd like to see the ScriptCards version.
I'd love to see your  ScriptCards version if you don't mind thanks. And I'll have a look into the  ChatSetAttr, thanks!
Sure thing. Here is a ScriptCard that can do what you were describing above. It requires 3 Mods to be installed as it currently is, ScriptCards , Resting in Style, and SelectManager . !scriptcard {{ --/|CONFIGURATION VARIABLES --/|Set to short, long, or both to decrement an inventory item named Rations by 1 --&UseRationsOnRest|both --/|Requires: SC 2.1.8+, SelectManager, 5E Resting in Style --#title|D&D 5E Rest --#reentrant|gmrestcard --#whisper|gm --:GetPlayerTokens| --~TokenCount|array;pagetokens;RestTokenArr;[*P:id];pc --?[&TokenCount] -eq 0|>LogMessage;No Tokens Found;FATAL;Did not find any PC tokens on page [*P:name] --:DisplayPlayerRestButtons| --~RestTIDList|array;stringify;RestTokenArr;, --%PCTID|foreach;RestTokenArr --+[*[&PCTID]:t-name]|[r][rbutton]SR::PlayerShortRest;[&PCTID][/rbutton] [rbutton]LR::PlayerLongRest;[&PCTID][/rbutton][/r] --%| --+All Players|[rbutton]SR::PlayerShortRest;[&RestTIDList][/rbutton] [rbutton]LR::PlayerLongRest;[&RestTIDList][/rbutton] --:Done| --X| --:PlayerLongRest|TokenList --@long-rest|{^& select [&reentryval] } --?"[&UseRationsOnRest]" -ne "long" -and "[&UseRationsOnRest]" -ne "both"|Done -->DecrementRation|[&reentryval] --^Done| --:PlayerShortRest|TokenList --@short-rest|{^& select [&reentryval] } --?"[&UseRationsOnRest]" -ne "short" -and "[&UseRationsOnRest]" -ne "both"|Done -->DecrementRation|[&reentryval] --^Done| --:DecrementRation|TokenList --#whisper|0 --+|Eating Rations on a Rest --~|array;fromstring;_drTokenArr;,;[%1%] --%_drtid|foreach;_drTokenArr --Rfind|[*[&_drtid]:t-represents];Rations;repeating_inventory;itemname --?"[*R:itemname]" -eq "NoRepeatingAttributeLoaded"|[ -->LogMessage|No Rations Found;ERROR;Did not find an inventory item named Rations for [*[&_drtid]:t-name] --]|[ --!a:[*[&_drtid]:t-represents]|[*R>itemcount]:-=1 --Rfind|[*[&_drtid]:t-represents];Rations;repeating_inventory;itemname --+[*[&_drtid]:t-name]|has [*R:itemcount] rations remaining --]| --%| --<| --:LogMessage|EmoteText;OutputTag;OutputMessage --#emoteText|[%1%] --+[%2%]|[%3%] --?"[%2%]" -eq "FATAL"|Done --<| }} So as it is written, and can be changed if desired, it will look for PC tokens on the page that currently has the player ribbon. PC tokens are tokens that are linked to a character and that character has at least 1 player in the controlledby property. So this will filter out tokens that aren't linked to a character, like maps and such, and tokens that aren't "controlledby" a player so that only GMs controll them, so NPC tokens should get filtered out. When you run the ScriptCard macro or pasted into chat it will whisper a list of those PC tokens to the GM, like so: So each PC gets displayed with 2 buttons, SR for short rest and LR for long rest. So you can give rests individually but there are buttons at the bottom to do a rest for all the listed characters. When the rest button is clicked, if the string variable `--&UseRationsOnRest|` is set to short, long, or both, then it will look for an item named Rations and decrement 1. If it can't find an item named Rations on the sheet it will throw an error in the output like so: This will send each character to the resting in style mod regardless of the error in the inventory though. It will also display the remaining ration count for each character as well. Currently it does not check for 0 rations and will keep decrementing. If you wanted to check for 0 rations specifically, either before the rest is sent or after, then that can be added in as well. Let me know if you have any questions about it. ScriptCards is super flexible and powerful but does take some getting used to at the start usually. In terms of looks, you aren't limited to just that blue white style above. It can also be combined with Keith Curtis' SuperNotes mod for some easy formatting templates via the `--#overrideTemplate|` parameter. So if you like Keith's wizard template style for example you can add `--#overrideTemplate|wizard` to your ScriptCards for quick formatting in that style.
1719690356
timmaugh
Pro
API Scripter
Nice, Joshua! I just wanted to chime in since, after a quick scan of the ScriptCards verbiage in your command, I don't see explicit SelectManager syntax... Which probably means that you are relying on SelectManager to restore the player ID and who properties of the message. In order for that to work, Jesse will need to configure SelectManager by running this command one time: !smconfig +playerid +who If I'm right, after that the above ScriptCard should work. (You know, so few people use the Campaign-level scripts that would require SM to *not* give back those properties that I should maybe reverse the default configuration of SelectManager and make people "opt-out" of the full-service version of SM...)