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

How to roll and modify resource on character sheet from handout

January 22 (6 years ago)

Hey cupcakes!

So I'm creating magical items as handouts with the ability to roll from them so that my players' sheets aren't overloaded
Now I've gotten the rolling component functioning but I'm not sure how to make the handout also subtract charges from the sheet of the owner of said magical item
For example, a player has a Wand of Magic Missiles, and they have 7 charges. They use 3 charges by clicking on the handout to roll the 3 missiles but it also subtracts and notifies how many charges remain, akin to the ammo tracking for arrows

I'm not quite sure how to approach this, like would I make a separate macro that the handout calls upon?

January 22 (6 years ago)

You could use ChatSetAttr to decrease the necessary resource charges on the appropriate character sheet.

Quick summary:

1. Setup a resource in the desired character to track the necessary charges

2. Create a button(?) on the handout (I assume this is how you're handling the rolls? If not, please share!) that executes a !chatsetattr macro that targets the character ID you want and removes the necessary number of charges.

DISCLAIMER: I am at work and this is all theorycraft.

Another to way to handle this is from within the sheet give the character an Ability that does the same. For example one of my PCs has a Staff of the Black Spider that has charges and cast spider walk or web. They can click the relevant ability macro and it will remove the appropriate charges.

January 22 (6 years ago)

Edited January 22 (6 years ago)

I think the main problem here is that OP wants to store this information on a handout rather than on a character sheet. So any known methods for accomplishing this (ChatSetAttr) are not going to be sufficient. In order to keep and automatically update the information on a handout is going to require a custom API script.


Personally, I think it might just be easiest to give control of the handout to the player with the item and allow them to manually track the charges.

January 23 (6 years ago)

Alrighty, I managed to get it to work!
The suggestion of using ChatSetAttr worked but the result of the script would appear after the chat commands in the macro, which made me seek an alternative to tracking resources, using the simple Ammo script instead, and it worked like a charm
Apologies because the answer was so simple, and thank you for the help!

Pretty much all I wanted was:
- Resource on the character sheet, ie. Wand of Magic Missiles Charges
- Handout that contains all the info with clickable rolls
- Said rolls subtract from the charges on the character sheet

January 23 (6 years ago)

That's how I interpreted your request Cakelette. Kyle is just on a level above us and probably thought you wanted tracking on the handout too... which is possible using the API, but outside my scope of knowledge! :)

Regarding your comment of ChatSetAttr outputting to chat; you can suppress that using a switch in the API command --silent (suppress output) or --mute (suppress output AND errors). 

The Ammo script is decent if that's your only need, but personally I don't use it anymore since you can achieve its functionality with ChatSetAttr (which can do a bunch of other stuff too).

January 24 (6 years ago)

It wasn't really a problem with the notifications in chat it was more so I had my macro alter the resource count via ChatSetAttr, and then have a chat command say "<x> has <y> charges remaining".
However, the chat command parsed first showing say 20 charges, and then ChatSetAttr would change it to 18 afterwards
So essentially the chat command read the resource too quickly and displayed the result faster than ChatSetAttr could change it

January 24 (6 years ago)
Jakob
Sheet Author
API Scripter


Cakelette said:

It wasn't really a problem with the notifications in chat it was more so I had my macro alter the resource count via ChatSetAttr, and then have a chat command say "<x> has <y> charges remaining".
However, the chat command parsed first showing say 20 charges, and then ChatSetAttr would change it to 18 afterwards
So essentially the chat command read the resource too quickly and displayed the result faster than ChatSetAttr could change it

You could use ChatSetAttrs feedback parameters to output the amount remaining.