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

Lay on Hands Macro That Decrements My Available Points

I have lay on hands in my character sheet, but I was wanting a button to cast Lay on Hands that will prompt me for the the amount to use of the available points but also subtract that from my Lay on Hands pool. Is that possible?
Yes, if the DM of your game has a Pro subscription and using an appropriate API script. -Adam
1655700922

Edited 1655700960
GiGs
Pro
Sheet Author
API Scripter
And to be absolutely clear, the answer is no if your GM (technically, the campaign creator) doesnt have a Pro subscription. Macros available at the Free and Plus subscription levels cannot change anything on the character sheet or token, they can only read existing values.
GiGs said: And to be absolutely clear, the answer is no if your GM (technically, the campaign creator) doesnt have a Pro subscription. Macros available at the Free and Plus subscription levels cannot change anything on the character sheet or token, they can only read existing values. He does have the Pro subscription. Could you point me in the right direction of how to do this in the API?
1655743672
David M.
Pro
API Scripter
Here is a macro solution, but it uses three api scripts (Scriptcards, ChatSetAttr, and TokenMod).  !scriptcard {{ --#title|Lay on Hands --#sourceToken|@{selected|token_id} --#targetToken|@{target|Who is Healed|token_id} --#emoteText|*@{selected|token_name} uses Lay on Hands to heal @{target|Who is Healed|token_name}.* --=Available|@{selected|other_resource} --=MaxAttempted|?{Number of points to Heal} --=Attempted|[$MaxAttempted] {MAX:[$Available.Raw]} --=hpMissing|[*T:t-bar1_max] - [*T:t-bar1_value] --=Used|[$Attempted] {MAX:[$hpMissing.Raw]} --=Remaining|[$Available] - [$Used] --+Points available|[$Available] --+Healing Points Used|[$Used] ([$MaxAttempted.Raw] attempted) --+Healing Points Remaining|[$Remaining] --@modattr|_charid [*S:character_id] _other_resource|-[$Used] --@token-mod| _ids @{target|Who is Healed|token_id} _set bar1_value|+?{Number of points to Heal}! }} Here's example output with the following situation: Paladin has 4 healing points remaining. Selects a nearby goblin that is only missing 2hp. Player enters 15 in the "Number of points to heal" query because they forgot they already used that ability earlier. The macro only heals 2hp and deducts 2 points from the Paladin's "other_resource" repeating resource. Depending on which repeating resource you use, it may require editing for that resource location (the bold line above).  
Thanks, this is a big help. If I use it as is, there is an error "No character was found for 'selected'" I have tried using it as a token action, or selecting the token then clicking the macro to no avail. Instead, I tried to hard set the character to my character. That works, but it does not update the points available or the health of the token selected to be healed. Here is my updated version: !scriptcard {{ --#title|Lay on Hands --#targetToken|@{target|Who is Healed|token_id} --#emoteText|*Alton Twofoot uses Lay on Hands to heal @{target|Who is Healed|token_name}.* --=Available|@{Alton Twofoot|class_resource} --=MaxAttempted|?{Number of points to Heal} --=Attempted|[$MaxAttempted] {MAX:[$Available.Raw]} --=hpMissing|[*T:t-bar1_max] - [*T:t-bar1_value] --=Used|[$Attempted] {MAX:[$hpMissing.Raw]} --=Remaining|[$Available] - [$Used] --+Points available|[$Available] --+Healing Points Used|[$Used] ([$MaxAttempted.Raw] attempted) --+Healing Points Remaining|[$Remaining] --@modattr|_charid [*S:character_id] _class_resource|-[$Used] --@token-mod| _ids @{target|Who is Healed|token_id} _set bar1_value|+?{Number of points to Heal}! }}
1655828776
David M.
Pro
API Scripter
When using the original macro, was your selected token set up to have the "represents" field pointing to the character sheet? Your updated version is failing because this line was removed: --#sourceToken|@{selected|token_id} In the --@modattr line (which calls the ChatSetAttr script), there is a [*S:...] type of reference, which is scriptcard-specific syntax and that requires the #sourcetoken to be defined. If you can't get the generalized version to work (using @{selected...}, you should be able to hardcode the --@modattr line by using something like this: --@modattr|_charid @{Alton Twofoot|character_id} _class_resource|-[$Used]
I am not seeing any chat output about it updating the attribute, so I don't think the line is doing anything. I didnt in the original version either.
1655840926
GiGs
Pro
Sheet Author
API Scripter
Do you have scriptcards installed?
1655841772

Edited 1655841794
David M.
Pro
API Scripter
3 scripts are required, unfortunately: Scriptcards, ChatSetAttr, and Token-Mod. ChatSetAttr is the one that does the repeating attribute updating. Another thing to check would be which repeating resource is used for your specific paladin sheet. The "other_resource" resource is referenced in the modattr command. This corresponds to the first row, second column of the repeating resources (see below). If yours is in a different position then we'd have to change it.
ah, that was the problem. I missed the part in your first post that I needed those three scripts. Sorry for all the confusion