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

[Script] Heal chat command

June 09 (12 years ago)
Ada L.
Marketplace Creator
Sheet Author
API Scripter

I made a script that lets you use an API chat command to heal one token by name or the tokens for all characters.

E.g.

To heal tokens with the name "Dave the Dwarf":

!heal Dave the Dwarf


To heal all the characters' tokens:

!heal all


Here's the script: 

https://gist.github.com/Cazra/5737453

June 09 (12 years ago)
Konrad J.
Pro
API Scripter

Edit: oh this is more of a reset command for tokens (all bars are reset to max and status markers are reset), not just a healing of damage taken in one bar. :)  I should have read the script a little closer.  Oh well,  everything I said still applies and would be a good idea!!!  I'll have to get to work on that maybe?  I'm still going to take your idea for a reset script and incorporate it into mine as well! :)

Another good idea!!!  You are on a roll.  Probably for most its easier to just change the bubbles themselves, but I like options!  Its too bad we can't ask for input during a macro.  Then we could put commands like this in a macro button and then you click on it, type the damage and hit enter.  I think I'll be adding this to my framework utility script, with your credit for the idea of course!  If it doesn't already it should be able to damage the token. :)

Another idea I had for a script which I simply do not have time for was Grouping.  Not graphically, but by name.

!group Ateam bob joe dwarf rogue

Then you could use the group name in scripts such as yours.

!heal Ateam 20

Good for those channel energy clerics in Pathfinder, but even more useful might be

!damage Ateam 30

Although you have saves complicating matters, etc. so maybe not as useful.

Also maybe if the script took multiple tokens to heal on one line?

!heal joe bob rogue dwarf 20

But you do run into problems with spaces in the names of tokens I guess.  Make the user put ' ' around the names?

I'd make some global variables the GM can set to let them decide which bar should be for HPs by default, etc.

June 09 (12 years ago)
Ada L.
Marketplace Creator
Sheet Author
API Scripter

Those are all great suggestions! I'll take a shot at implementing additional features like those to the heal script. 

I think that an elegant solution to the multi-target problem would be to make the names be comma-delimited, split the string into tokens (the string kind of tokens), and then trim whitespace off the ends of each token. This would only be a problem if a token's name (the graphical kind of token) has commas in it like "Dave, Dwarf Prince of the Hinterland Mountains" (kind of a mouthful there XD). 

I'd probably include some utility functions to view the contents of stored groups and even get rid of groups that are no longer needed.