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

[Script] Resting in Style

June 08 (5 years ago)

Edited June 08 (5 years ago)
Magnar S.
Pro
API Scripter

Taking a quick look at this forum, there seems to be an abundance of resting scripts being released at the same time. Nevertheless, here's my take on it:

https://github.com/magnars/roll20-scripts


5E OGL Resting in Style

This Roll20 API Script solves the error prone task of updating your character sheet when resting. Using !long-rest and !short-rest commands will update your sheet, and report to you everything it is doing.

Short rest

Select your character, then run the !short-rest command. It will:

  • check your hit points and hit dice, and remind you to use them if needed.

  • replenish Warlock Pact Magic spell slots. This works correctly even if you are a multiclass spell caster.

  • replenish class specific resources, like Wild ShapeSecond Wind and Channel Divinity.

    • It knows that Bards regain Bardic Inspiration at class level 5.
    • It knows that Sorcerers gain 4 Sorcery Points at class level 20.
  • replenish subclass specific resources, like Superiority Dice and Hexblade's Curse.

  • remind Wizards to use Arcane Recovery, and Bards to use Song of Rest.

Long rest

Select your character, then run the !long-rest command. It will:

  • replenish your hit points.

  • replenish the correct number of hit dice (even at lvl 1).

  • remove temporary hit points.

  • replenish spell slots.

  • replenish class specific resources, like Lay on HandsArcane Recovery and Rage.

  • replenish subclass specific resources, like Consult the Spirits and Avenging Angel.

  • replenish race specific resources, like Breath Weapon and Relentless Endurance.

Usage

Resting in Style will generally do the right thing out of the box, as long as you're using the 5th Edition OGL by Roll20 character sheet.

However, not all resources are automatically added to the Resource boxes. You might have to add them yourself.

For instance, a Wizard starts with the Arcane Recovery skill. This is not tracked in the sheet. Add a custom resource box, set the Total to 1, the value to 1, and the name to "Arcane Recovery".

Resting in Style will detect the new resource by name, and start notifying you to use it on short rests, and replenish it on long rests.

I have a resource not covered by this script

No worries. If your skill is called "Homebrew Resource", you can rename it to "Homebrew Resource [l]" to reset it every long rest. If you instead postfix it with "[s]", then it is reset every short and long rest.

Also: Please let me know if I have missed any skills in the official source books, I'll happily add the support.

June 08 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Nice job, Magnar! I know what you mean about the plethora all appearing at once. It's happened in the past with other types of scripts. I you would like to check for any missing class features, feel free to look at the list in my script. I intentionally left a few sourcebooks out, but that may have been personal preference speaking. I was shooting for AL legal.

June 08 (5 years ago)
Magnar S.
Pro
API Scripter

Thanks for tip, Keith. I just found your resting script minutes before releasing this. Bad research on my part not finding it earlier, but I had a lot of fun figuring out the API and getting things to work. Your idea with the [1d6+1] tags to handle recharging wands et.al is very cool. 

In my mind there are two big issues where the Roll20 character sheet experience is quite a bit worse than that other DnD-site, with resting being one and inventory management the other. Hopefully with these new scripts, we have helped a bit on that first point. :)

June 08 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Each of the three scripts just released has some feature the others lack I stayed away from the handling of hit dice and other stuff the Companion script handled.  It looks like your script does a good job with those. And I really should account for the Bard 5th swap from long to short-long on Inspiration.

I have The Aaron to thank for the dice parsing subroutine. That was extremely helpful.

Gah, I was begging for these scripts for months, and then right after I made my own (clumsy) macros, all these fine scripts appear! :) One more I have to check out!

June 08 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Funny how that happens.

June 08 (5 years ago)
Magnar S.
Pro
API Scripter

I added the randomly regained charges feature to the script. I made sure to give a little nod to you in the docs, Keith. Hope that's okay. Let me know! https://github.com/magnars/roll20-scripts#what-about-items-with-randomly-regained-charges

June 08 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

I'm fine with it. :)

June 08 (5 years ago)
Magnar S.
Pro
API Scripter

Good to hear, thanks. You're a class act. :)

Just a short note of thanks for this script. I have used it with no problems on my test game, will install and use with my real games this week. 

June 09 (5 years ago)
Magnar S.
Pro
API Scripter

Very cool, Michael! Glad to hear that. Do let me know if any issues pop up. :)

Magnar S. said:

Taking a quick look at this forum, there seems to be an abundance of resting scripts being released at the same time. Nevertheless, here's my take on it:

https://github.com/magnars/roll20-scripts

Thanks for all your work on this -- excited to try it out.
June 11 (5 years ago)
Magnar S.
Pro
API Scripter

That's great, Chris. Do let me know how it went. :) 

June 21 (5 years ago)
Magnar S.
Pro
API Scripter

The script has now been updated to also turn off global modifiers for buffs. For instance, it will turn off Bless and Rage after a short rest, and it will turn off Mage Armor after a long rest. I have added quite the list of buffs, but do let me know if I've missed any.

June 22 (5 years ago)
Magnar S.
Pro
API Scripter

I have updated the script with lots of missing resources, including support for the tricky Wizard Power Surge, which now correctly resets to 1 on a long rest, and replenishes 0 to 1 on a short rest. :-)

Just added this to my game - works wonderfully! I do have two small questions though.

1) I have a bard who has multiclassed into warlock, as well as a full warlock. The API as is regenerates one of the bard spell slots for the bardlocks on a short rest, because the spell sheet doesn't track the warlock spell slots separately. I can add a class resource and set it up to regen on a short rest, ofc, but how can I prevent a bard spell slot from being regained, without ruining the function for the warlock?

2) On your github, you have a second file for hit dice - how do I use this to make the long rest healing register to other APIs as healing when the hp reset? (currently my health aura stays tinted to wounded when the long rest hp are regained).

Thank you so much in advance for your time and effort! I *really* love that this also sends reminders to chat!

June 28 (5 years ago)

Edited June 28 (5 years ago)
Magnar S.
Pro
API Scripter

Hi Inkcharm! I'm so glad you found the script useful. :-) 

1) I have a bard who has multiclassed into warlock, as well as a full warlock. The API as is regenerates one of the bard spell slots for the bardlocks on a short rest, because the spell sheet doesn't track the warlock spell slots separately. I can add a class resource and set it up to regen on a short rest, ofc, but how can I prevent a bard spell slot from being regained, without ruining the function for the warlock?

I might be misunderstanding either your question or the rules here, but my impression is that warlock Pact Magic spell slots are in addition to regular spell slots. For example, a Bard 2 Warlock 1 would have 4 level 1 spell slots (3 from the Bard, 1 from the Warlock), but not the 2-nd level spell slots they would get if they were multiclassed into another full spell caster.

However, these spell slots can be used interchangeably. You can use your "warlock spell slot" to cast Bard spells.This is one of the perks of multiclassing into Warlock.

Do let me know if I've misunderstood.

2) On your github, you have a second file for hit dice - how do I use this to make the long rest healing register to other APIs as healing when the hp reset? (currently my health aura stays tinted to wounded when the long rest hp are regained).

I have noticed this as well. I had hoped that the `setWithWorker` function would notify other scripts about the hitpoint change, but that doesn't seem to be the case. I'll have to investigate further. Thanks for the report!

Edit: I am trying to find a solution to this. What script are you using to tint wounded characters? DeathTracker?


Thank you so much in advance for your time and effort! I *really* love that this also sends reminders to chat!

Thanks for letting me know. It's something when a Bard finally uses Song of Rest, huh? ^^


June 28 (5 years ago)
Magnar S.
Pro
API Scripter

If you are indeed using DeathTracker, Inkcharm, you can try out the newest version of the script. For technical reasons, you must also install the TokenMod script if you haven't already. If you do try it out, I'd be happy to know if it works / doesn't work for you, or if you are using some other script than DeathTracker.


Hey! 

Ignore everything I said about the spell slots, that was a problem with how my player set up the sheet, we have corrected it and now everything is working wonderfully there xD

I use Aura/Tint HealthColor for tracking - token mod is installed.

June 28 (5 years ago)
Magnar S.
Pro
API Scripter

Glad to hear the warlock spell slots work for you now. :)

Unfortunately, the Aura/Tint HealthColor script only listens to built-in change events, that other scripts cannot trigger. There's no standard way of solving this problem at the moment, which is a shame. I was able to add support for scripts that listen to the custom events sent by TokenMod, which includes DeathTracker. It also has the ability to tint damaged characters.

Thank you for checking that! 

We did find one thing that doesn't seem to be done through tracking: Exhaustion levels. They can be tracked through the OGL sheet, but aren't lowered by the API. Do you have the means to add it / do you plan to? It's not a big thing ofc, just something my players noticed while testing. 

June 29 (5 years ago)
Magnar S.
Pro
API Scripter

That's one I've plain forgot. Consider it in the pipeline. :-)

Awesome! 

Big thumbs up from myself and my players. They're all very very very delighted by this API, especially with the reminders sent to chat. 

At "Consider Song of Rest" our Bard went "Stop calling me out like this!", and everyone was just plain delighted ;)

June 30 (5 years ago)
Magnar S.
Pro
API Scripter

I'm happy to say that this script is now available as a one-click install in the script dropdown. :) 

I have your script loaded the DIY way and I noticed it was now in drop box so I deleted it and did the drop box one and when I restatred it came up with a error about no script found??

July 02 (5 years ago)
Magnar S.
Pro
API Scripter


Giulio M. said:

I have your script loaded the DIY way and I noticed it was now in drop box so I deleted it and did the drop box one and when I restatred it came up with a error about no script found??

Yeah, all the most recently added scripts are behaving this way. There's some roll20 bug going on. While we wait for a fix, it's back to the DIY way, unfortunately.

July 02 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

You can click the "Import" Button, instead of "Install". It will download the script into your campaign as if you had installed it manually (editable text). The script will work fine, but you won't receive any automatic updates. I have two scripts in the same boat.

July 02 (5 years ago)
Magnar S.
Pro
API Scripter

I have now updated the script to also reduce exhaustion level by one after a long rest. Thanks for the idea, Inkcharm. :) 

Quote...You can click the "Import" Button, instead of "Install". It will download the script into your campaign as if you had installed it manually (editable text). The script will work fine, but you won't receive any automatic updates. I have two scripts in the same boat.


"Import" button? or even "Install"   is this on the API scripts page of a game as I dont see them.......just curious I am missing something here :P

July 03 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

You have to "delete" the script. The Import button only appears if the script does not exist in the campaign. The buttons are on the API page. Just choose the script from the dropdown and you should see both options.

Ok thanks I see it now

July 03 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

One Click is hopefully working now.

July 08 (5 years ago)
Magnar S.
Pro
API Scripter
This script now works with the one-click installer - including support for exhaustion levels. Yay! :) 


Magnar S. said:

This script now works with the one-click installer - including support for exhaustion levels. Yay! :) 

This is an awesome contribution, Magnar. Has become part of my core API kit.



July 09 (5 years ago)
Magnar S.
Pro
API Scripter

Chris said:

This is an awesome contribution, Magnar. Has become part of my core API kit.

Thanks, Chris. That makes me happy to hear. :) 

This is an awesome contribution, Magnar. Has become part of my core API kit.


Me to....very useful


Magnar S. said:

Also: Please let me know if I have missed any skills in the official source books, I'll happily add the support.

I believe the Celestial Warlock's "Healing Light" ability is missing (Xanathar's Guide).

Healing Light

At 1st Level, you gain the ability to channel Celestial energy to heal wounds. You have a pool of d6s that you spend to fuel this Healing. The number of dice in the pool equals 1 + your Warlock level.


As a Bonus Action, you can heal one creature you can see within 60 feet of you, spending dice from the pool. The maximum number of dice you can spend at once equals your Charisma modifier (minimum of one die). Roll the dice you spend, add them together, and restore a number of Hit Points equal to the total.


Your pool regains all expended dice when you finish a Long Rest.



July 10 (5 years ago)
Magnar S.
Pro
API Scripter

Chris said:

I believe the Celestial Warlock's "Healing Light" ability is missing (Xanathar's Guide).

That one is indeed missing. Thanks! :)

I have added it to the script found on github. You can use that straight away, or wait for it to release on the one-click installer. If you chose to wait, you can rename the "Healing Light" resource to "Healing Light [l]" (lower case L in brackets), and !long-rest will notice and refresh it based on the name postfix.

FYI Magnar -- After one of the script updates (around the time it became available on the one-click installer), the cool special-character arrows stopped displaying properly:



July 22 (5 years ago)
Magnar S.
Pro
API Scripter

Chris said:

FYI Magnar -- After one of the script updates (around the time it became available on the one-click installer), the cool special-character arrows stopped displaying properly.

Thanks for letting me know, Chris. It seems this only happens with the one-click installer. If you choose "Import script" instead, then it works like it should. I'll have to report a bug for it.

Also FYI Magnar - I'm seeing an odd behaviour when using the "fades_after_short/long_rest." When the script toggles off the Global Damage Modifier for (say) Rage, it's also hiding the Atk and Damage/Type information in the "Attacks & Spellcasting" area. It's not actually changing the content of those rows, just setting it to not display in the box on the Core Tab of the sheet. Maybe this is a bug with the sheetworker:



July 23 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

It is a bug in the sheetworker. Try toggling the "Attack" checkbox off and on in each of those attack fields. It should work normally after that, though you will need to do this once for any attack you ad later.

July 23 (5 years ago)
Magnar S.
Pro
API Scripter

There sure are a lot of weird things going on in this space. Thanks for the info, Keith. 

July 23 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

It think the main problem is that a lot of hands have touched the D&D 5th Edition by Roll20 Sheet over the years. Not everyone approaches problem solving the same way. That particular issue was "fixed" a few months ago. It used to be that toggling the modifier programattically did nothing at all. Now at least there's a workaround.

August 02 (5 years ago)

Edited August 02 (5 years ago)

One thing I noticed in my session last night is that for the single-classed Warlock, his spells did not restore on a long rest.  Troubleshooting this myself, I noticed that if a character is level 1 that their spells are restored, but if they're level 3 character the spells are not.  I'm guessing that the script looks at the PC's spells sequentially, and if it has 0 slots then it stops checking the rest of the spell list.  The problem  is that the OGL sheet as it's currently set up is that a level 3 warlock (for example) will have 0 Lv1 slots and 2 Lv2 slots.

Not a hard thing to work around on my end since this script seems to work fine with everything else, but I just thought you would like to know.

August 02 (5 years ago)
Magnar S.
Pro
API Scripter

Jerad said:

One thing I noticed in my session last night is that for the single-classed Warlock, his spells did not restore on a long rest.  Troubleshooting this myself, I noticed that if a character is level 1 that their spells are restored, but if they're level 3 character the spells are not.  I'm guessing that the script looks at the PC's spells sequentially, and if it has 0 slots then it stops checking the rest of the spell list.  The problem  is that the OGL sheet as it's currently set up is that a level 3 warlock (for example) will have 0 Lv1 slots and 2 Lv2 slots.

Not a hard thing to work around on my end since this script seems to work fine with everything else, but I just thought you would like to know.

Hi Jerad. Thanks for the report. I've tested this plenty before, so I had to check for myself one more time. There is indeed something wrong: If you don't manually change the available spell slots at least once, then they are not changed by my script. However, once they have been changed, then the script works as intended.

Do let me know if you see the same thing. Cheers!

August 02 (5 years ago)
Interesting, now it seems to work.  The party leveled up recently so that may have something to do with why the player was having problems.  Thanks!
August 03 (5 years ago)

I just found this script.  I've been looking for a script like this so Thank You! 

Two things:

1.  Reducing Exhaustion by 1 level may not be the correct thing to do automatically.  Under D&D 5e rules, there are two types of exhaustion: exhaustion that comes from lack of rest, and exhaustion that comes from not having enough food&water (PHB p. 185).  The first type of exhaustion can be reduced by 1 simply by resting.  The second type can only be reduced by rest AND getting food&water.  In some modules, like Tomb of Annihilation, getting food&water is not a given.  Can I suggest that reducing exhaustion in your script be tied to an option that can be set so that if it's off, the exhaustion has to be adjusted manually and isn't automatically lowered by your script?  

2.  I'm not clear on how resetting the charges on wands is supposed to work.  Maybe better instructions are needed?  For example, am I supposed to create a resource called "Wand of Magic Missile"?  Where do I put the dice roll code?


August 04 (5 years ago)
Magnar S.
Pro
API Scripter

Hi Saul! I'm glad you found the script useful. :)

Saul J. said:

1.  Reducing Exhaustion by 1 level may not be the correct thing to do automatically.  Under D&D 5e rules, there are two types of exhaustion: exhaustion that comes from lack of rest, and exhaustion that comes from not having enough food&water (PHB p. 185).  The first type of exhaustion can be reduced by 1 simply by resting.  The second type can only be reduced by rest AND getting food&water.  In some modules, like Tomb of Annihilation, getting food&water is not a given.  Can I suggest that reducing exhaustion in your script be tied to an option that can be set so that if it's off, the exhaustion has to be adjusted manually and isn't automatically lowered by your script?  

There are three options here, as far as I can tell, as long as the character sheet does not track food and water consumption:

  1. Always change exhaustion levels. You must then manually bump it up again if you're starving.
  2. Never change exhaustion levels. You must then manually bump it down.
  3. Change exhaustion levels based on a switch. You must then manually flip the switch.

All of these options involve performing a manual task to do the right thing with exhaustion levels. I would say that #1 does the right thing most often out of the box. I can certainly see the case for #3, but I don't think it's worth the added hassle, especially since it's an individual issue - I can't add a global toggle, it'll have to be per character somehow.

2.  I'm not clear on how resetting the charges on wands is supposed to work.  Maybe better instructions are needed?  For example, am I supposed to create a resource called "Wand of Magic Missile"?  Where do I put the dice roll code?

Yes, you create a resource called:

Wand of Magic Missiles [l+1d6+1]

The resource is then used to track the charges.

August 10 (5 years ago)

I see your point about Exhaustion.  Either way, something has to be done manually.  But, I'm not sure I get your point about not being able to set a global.  Other scripts I've used seem to be able to set globals.  All I'm suggesting is that there be a global setting for "Yes, change exhaustion for all characters" or "No, don't change exhaustion for all characters".  I'm not clear why that can't be done.  I think it would be useful for anyone running a "hard" D&D game where they use rules like Exhaustion.  Not all DMs bother with exhaustion, or food/water in general but many do.

As for the resource: so the dice roll code goes into the Resource name?  Is there a limit for the number of resources?  As characters get more and more magic items, if there's a limit, they may run out of "resource space".

Thanks!

August 11 (5 years ago)
Magnar S.
Pro
API Scripter

Saul J. said:

I see your point about Exhaustion.  Either way, something has to be done manually.  But, I'm not sure I get your point about not being able to set a global.  Other scripts I've used seem to be able to set globals.  All I'm suggesting is that there be a global setting for "Yes, change exhaustion for all characters" or "No, don't change exhaustion for all characters".  I'm not clear why that can't be done.  I think it would be useful for anyone running a "hard" D&D game where they use rules like Exhaustion.  Not all DMs bother with exhaustion, or food/water in general but many do.

Sorry about my confusing statement - I'm not a native speaker. I didn't mean it was impossible. I only ment it wasn't particularly helpful. On a single day throught the jungles of Chult, maybe only two out of five party members have enough food. In this case, the global toggle wouldn't be of much use. It would basically only be useful in the case where a clear majority is in need of food, and then only to avoid a few adjustments. And if they keep up like that, soon all of them will be dead anyway. 

So, my point is this: A global toggle would be possible, but not useful enough to warrant programming, maintaining and documenting. At least, that is my opinion at the moment. I'm open for any opposing arguments.

 

As for the resource: so the dice roll code goes into the Resource name?  Is there a limit for the number of resources?  As characters get more and more magic items, if there's a limit, they may run out of "resource space".

Thanks!

Yes, you add the dice roll code into the Resource name for magic items. It's not necessary for most class/race-based Resources, because I have enumerated them in code.

If there is a limit to the number of resources you might add, I haven't encountered it personally.