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
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
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.
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.
Ah cool. I didn't like that part of the copy and pasta I did. I'll look into switching it over, thanks :)
Switched it to use setWithWorker