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

Extension to OGL 5e character sheet (Resource Tracking)

February 12 (7 years ago)

Edited February 14 (7 years ago)
I threw this together awhile ago for my monk. It'll pretty much work with any numeric resource in the character sheet. Figured I'd put this up here before it's lost forever.

Usage is something like: 
!resource <character> <resource name> <modifier>

You need to create the resource in your character sheet ahead of time. It's useful to add to a macro that does the ability using a card.

Gist is here: https://gist.github.com/anonymous/8523d02095726dafe336653006ef7262
It depends on the splitArgs utility API 
February 13 (7 years ago)
Looks great! I am curious why you decided to make a script for this when you could have utilized the Companion script and/or Jakob's ChatSetAttr
February 13 (7 years ago)
This works alongside the companion script. The companion script doesn't (didn't?) support arbitrary resource usage. It needed a link to an item IIRC.

If that's changed, then awesome :) I just found this script in one of my old sessions, made sure it still worked, and threw it up on here.

I remember looking at ChatSetAttr, I forget why I didn't use it back when.
February 13 (7 years ago)

Nietsnie said:

This works alongside the companion script. The companion script doesn't (didn't?) support arbitrary resource usage. It needed a link to an item IIRC
You might be correct on that. I know I had to make adjustments in a scriptlet of my own to allow using multiple resources at a time in the companion.
Nietsnie said:

I remember looking at ChatSetAttr, I forget why I didn't use it back when.
My guess is that you didn't like having to remember the specific attribute name for the resource (class_resource, other_resource, repeating_resource_$X_left/right, etc.) and wanted a simple way to simple put in the name of the resource you were modifying.


Like I said earlier, you code looks great and does what you want it to do. The only thing I would change in your script is where you handle the adjustment of the total weight on the character if the resource is tied to an item. Rather than updating the weight yourself, you could simply use the setWithWorker function to set the remaining number of the item, this would then call the sheet workers for the character sheet to update the weight on the character.

February 13 (7 years ago)

Edited February 13 (7 years ago)
Ah cool. I didn't like that part of the copy and pasta I did. I'll look into switching it over, thanks :)
February 14 (7 years ago)
Switched it to use setWithWorker