
Update v0.4.1 -- Removed dependency on isGM and added use of playerIsGM() instead.
Update v0.31 --Fixed the HTML Entities issue.
Update v0.3 -- Fixed off-by-one bug causing the listed powers to be instrumented one higher than they should have been.
Update v0.2 -- Fixed minor bug preventing schema version from being written into the state object.
Daily powers are restored to token actions after !long-rest is executed. Encounter abilities are restored to token actions after !short-rest or !long-rest is executed. Activating a used power will whisper to the player and GM that the power was already used.
!use-power or !add-use-power by with no arguments produces the help:

Example uses (for character named "Foo"):
First, listing the abilities on that character:

Now flagging some as encounter and some as daily:

Oops. I meant to have 5 as an encounter

Now using them:

Using Power 2, then using it again (notice the error that is issued to the player (and also to the GM if they are different):

Token Macro bar after a few uses:


Use some more:


Looking forward to improvement suggestions!
Git: https://github.com/shdwjk/Roll20API/blob/master/Us...
Update v0.31 --Fixed the HTML Entities issue.
Update v0.3 -- Fixed off-by-one bug causing the listed powers to be instrumented one higher than they should have been.
Update v0.2 -- Fixed minor bug preventing schema version from being written into the state object.
UsePower
UsePower provides a way to instrument and track daily and encounter powers. It is intended for D&D 4E, but could be used for any system that requires the capability to flag abilities as used and reset them. Using an instrumented ability will mark it used and remove it as a token action. (Caveat: it will disappear the next time the owner deselects the token.)Daily powers are restored to token actions after !long-rest is executed. Encounter abilities are restored to token actions after !short-rest or !long-rest is executed. Activating a used power will whisper to the player and GM that the power was already used.
Commands
!add-use-power --<Character Name> [--[ encounter | daily ] <number> [<number> ...] ...](GM Only) For all character names, case is ignored and you may use partial names so long as they are unique. For example, "King Maximillian" could be called "max" as long as "max" does not appear in any other names. Exception: An exact match will trump a partial match. In the previous example, if a character named "Max" existed, it would be the only character matched for --max.
Omitting any --encounter and --daily parameters will cause a list of the character's powers with the expected index numbers (Caveat: These numbers will change if you add powers to the character. You should look them up again before instrumenting if you have changed the list of powers.)
!short-restOmitting any --encounter and --daily parameters will cause a list of the character's powers with the expected index numbers (Caveat: These numbers will change if you add powers to the character. You should look them up again before instrumenting if you have changed the list of powers.)
- --<Character Name> — This is the name of the character to list or instrument powers for.
- --<[ encounter | daily ]> <number> [<number> ...] — This specifies a list of abilities to instrument as either encounter or daily powers. You can specify as many powers as you like by number after these arguments. Numbers that do not index abilities or values that are not numbers are ignored. Duplicates are ignored. If you specify the same number to both an --encounter and a --daily parameter, it will be reported as an error. Powers that are already instrumented will be changed (So, if an ability is already instrumented as an encounter power and you specify it as a daily power, it will be changed to a daily power.).
(GM Only) This command restores all expended encounter powers to token macros.
!long-rest(GM Only) This command restores all expended encounter and daily powers to token macros.
!use-power <Type> <Ability ID>This command requires 2 parameters. It is usually added by the instrumenting code. If you copy it from one ability to another, it will be updated with the correct Ability ID on save. Duplicating an existing character will also cause the new character's abilities to be corrected. All abilities are validated and updated on restart of the API.
!use-power or !add-use-power by with no arguments produces the help:

Example uses (for character named "Foo"):
First, listing the abilities on that character:
!add-use-power --foo

Now flagging some as encounter and some as daily:
!add-use-power --foo --encounter 2 3 --daily 5 6Then listing again:
!add-use-power --foo

Oops. I meant to have 5 as an encounter
!add-use-power --foo --encounter 5

Now using them:

Using Power 2, then using it again (notice the error that is issued to the player (and also to the GM if they are different):

Token Macro bar after a few uses:

!short-rest

Use some more:

!long-rest

Looking forward to improvement suggestions!
Git: https://github.com/shdwjk/Roll20API/blob/master/Us...
If you use my scripts, want to contribute, and have the spare bucks to do so, go right ahead. However, please don't feel like you must contribute just to use them! I'd much rather have happy Roll20 users armed with my scripts than people not using them out of some sense of shame. Use them and be happy, completely guilt-free!
Disclaimer: This Patreon campaign is not affiliated with Roll20; as such, contributions are voluntary and Roll20 cannot provide support or refunds for contributions.