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] Aura/Tint HealthColor

1490120365

Edited 1490120537
DXWarlock
Sheet Author
API Scripter
Yea Salicar negatives wont work :\ the base aura is 0.1 so its always slightly larger than the edge of the token so making the shaded one smaller would just sit inside of the base one. I can try to put negatives in, but trying to work out the scale size of it might be tricky. Only issue would be when you change it to match for the dragon, the aura on normal sized tokens would be almost not there. On the update: Sorry weekend got away from me, forgot we had plans for the family. but its here! 1.4.1 : Major rework with TheAarons help to get the token auto update time down.
1490121899
The Aaron
Pro
API Scripter
Cool!  I used this script in my game over the weekend. =D  Loads of fun when the gnolls charged the PCs... across spike growth they didn't know about... !token-mod --set bar3_value|-[[16d4]] will ruin any gnoll's day... =D  I only wish when they all died that copies sprays of blood would have commenced, but you can't have everything. =D
1490186746

Edited 1490188044
Thorsten
KS Backer
I like the auto-update. I have a suggestion for improving it when toggling "Use Tint" on/off. Current behavior: "Use Tint Yes" will apply Tint, and keep auras "Use Tint No" will apply auras, and keep tint Desired behavior: "Use Tint Yes" will apply Tint, and clear Auras (empty range, transparent colors) "Use Tint No" will apply Auras, and clear Tint (set it to transparent) I should add: The "naive" implementation of always setting Tint / Aura to transparent in tokenset() is not desirable, as that'd interfere with using aura or tint for other purposes. It'd have to be something that triggers once when the configuration is changed. I've found a workaround by setting "Show NPC Health" to "No", toggling Tint to "Yes" and "No" again. That resets both the aura and the tint. Incidentally, setting "Is On" to "No" does not clear existing auras.
1490187793

Edited 1490188192
DXWarlock
Sheet Author
API Scripter
I had it that way long ago in 0.9(something). But think it boils down to cant please all the people. :\ Cant remember exactly if it was one or the other, but I think they used tint, and manually used aura for something else (or other way around). But when I auto removed the other, and they moved/wiggled a token (before the auto update) it wiped off all their manually set info for the aura so I took it out. Been trying to think of a way to tell if one or the other is 'mine' before removing it. Just cant think of a way that doesn't add overhead to the time it takes to check each token, or is reliable. Tried checking the color and if its the color its expecting reset it, but then someone COULD have coincidentally used that color somewhere. Tried setting an attribute it matches size and color to, but attribute reading is the longest part of the process now,adding another doubles the time it takes :(
You're right, that did occur to me after I had hit "Submit". The only solution I can see is to only make the change once, only on the global update triggered when the "Use Tint" option is changed while "Show NPC Health" or "Show PC Health" is On. You did not have global update before and so that wasn't an option then. The workaround of toggling "Show Health" to clear Aura / Tint works for me, as well. I'm just wondering whether users new to your script will get as confused as I was and be unhappy about having all tokens with tint and aura after playing with the settings.
1490189777

Edited 1490189808
DXWarlock
Sheet Author
API Scripter
I agree, if I can think of a way to do it that doesn't cause it to timeout the sandbox on update for large number of tokens checking if its 'my' stuff set I will get it in :) Or maybe just like you said just do it once on a global update. Don't think people will be switching from tint to aura back and forth a lot. It might reset any customs they have, but it will just be that once during setup.
Awesome script- I use it for NPC only but it seems like it is preventing my PC from showing any aura at all. I know that was working fairly recently, but definitely broken for me at the moment. Anybody experiencing a similar issue?
1490212040

Edited 1490214666
DXWarlock
Sheet Author
API Scripter
Do you have Show PC aura set to Off? Edit: I see the problem, fixing it now as well as adding  Thorsten request. They are related in a way..sooo 2 birds one stone and all that.
1490217304

Edited 1490218014
DXWarlock
Sheet Author
API Scripter
1.4.2 : Change to color settings to update on Aura/Tint toggle. Change to not reset Aura/Tint on disabled tokens. Now check to see if color used, on type used (Aura or Tint), matches what it expects before disabling it and setting new options. I think I got all the bases covered if I missed anything let me know: Setting any token to "NO" on UseColor will skip adjusting any tint/aura at all. PCs disabled with Aura option on, can manually set PC Aura colors. NPCs disabled with Aura option on, can manually set NPC Aura colors. PCs disabled with Tint option on, can manually set PC Tint colors. NPCs disabled with Tint option on, can manually set NPC Tint colors. Toggling 'Show Health' will update all tokens to new option, but will not reset manually set ones. Any of the above manually set will only overwrite if script conflicts (IE: You have custom aura on token, but tell token to use Aura for health).
1490220300
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
That last bit might be handy in the documentation. 
DXWarlock said: Yea Salicar negatives wont work :\ the base aura is 0.1 so its always slightly larger than the edge of the token so making the shaded one smaller would just sit inside of the base one. I can try to put negatives in, but trying to work out the scale size of it might be tricky. Only issue would be when you change it to match for the dragon, the aura on normal sized tokens would be almost not there. On the update: Sorry weekend got away from me, forgot we had plans for the family. but its here! 1.4.1 : Major rework with TheAarons help to get the token auto update time down. Ya once i thought of it. It didn't seem feasible. But the tint was great once i figured it out.
1490280221
DXWarlock
Sheet Author
API Scripter
I agree keithcurtis , I really need to get around to update/creating some in depth documentation for it.
1490296837
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
It's certainly worth the effort. It's a great addition to the API library.
Thanks, that's great! Now I can use Auras for NPCs and it won't interfere with the players' Paladin auras and such.
1490422787
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
When the script is running, it will no longer allow me to display token names. I have all "see token names" settings options to "Off" instead of "Yes" or "No". I just noticed this behavior tonight, though. I'm not sure if it is interacting oddly with another script or Roll20 update, but as soon as I disable Health Colors, I can once again set names to display and have their settings stick. Any ideas?
1490464331

Edited 1490464425
DXWarlock
Sheet Author
API Scripter
I tried to simulate it on my test game and couldn't get it to do it. Want to invite me when its convenient for you and I can see if I can see what the issue is?
1490722695
DXWarlock
Sheet Author
API Scripter
1.4.3 : Fix bug when using 'NO' as color option, and show names to disabled.
1490805431
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Thanks again, O Warlock!
Warlock... something I noticed when running a one shot of LMoP the other night... the players could see me copy/pasting tokens onto the map due to the FX showing through the dynamic lighting and the green sparkles playing when the token first appears on the map. I haven't tried to do it myself yet, but it would be cool if the script could not play the FX when the token first hits the map. 
I wonder if this is more of a Roll20 issue.  In general should FX be drawn on top of, or below dynamic lighting (though to be honest, not even sure this type of layering is possible).
1491070498

Edited 1491070750
DXWarlock
Sheet Author
API Scripter
I can try to look for a way to stop it. The issue pops up because characters token was saved with X value for health. Character sheet its tied to has Y health now. So when you drag it to the table, the token for a split second has the value it was saved as (usually 100%), and then immediately updates to the value the bar is tied to, triggering an on:change event for the token that is the exact same as if you changed the bar value yourself. Side note for update: 1.4.4 : Fix SetSheetWorker script conflict with 5e Companion Script. 
With the Cleric spell Aid, it adds Temp hit points. In my game I just use Aaron's token mod to add the HP to bar1 so that I can keep Sky's mod set to respect mins/maxs, and in effect I can raise their HP above max. I guess im asking, Have you considered a Overmax option for your aura colors? Maybe a Blue color? Is this doable or would you consider it outside the scope for your mods purpose?
Dustin C. said: With the Cleric spell Aid, it adds Temp hit points. In my game I just use Aaron's token mod to add the HP to bar1 so that I can keep Sky's mod set to respect mins/maxs, and in effect I can raise their HP above max. I guess im asking, Have you considered a Overmax option for your aura colors? Maybe a Blue color? Is this doable or would you consider it outside the scope for your mods purpose? Not really possible since there are only two auras and the script already uses both. If we had a third aura option it would be doable, but would muddy the colors even more. 
Sky said: Dustin C. said: With the Cleric spell Aid, it adds Temp hit points. In my game I just use Aaron's token mod to add the HP to bar1 so that I can keep Sky's mod set to respect mins/maxs, and in effect I can raise their HP above max. I guess im asking, Have you considered a Overmax option for your aura colors? Maybe a Blue color? Is this doable or would you consider it outside the scope for your mods purpose? Not really possible since there are only two auras and the script already uses both. If we had a third aura option it would be doable, but would muddy the colors even more.  I wasn't thinking a 3rd aura, but the same aura that records HP (the one that changes from green to red) just make a overmax color that showed blue. I know it uses 2 auras, but I never see the non HP aura bc I use Circle tokens. Isn't the 2nd aura matching the Players dice color? Im not sure tbh. I might be wrong about it works tho.
No, the second aura is white... so that the inner circle is a lighter color of the outer circle. It shows through on top down tokens.
1491095994

Edited 1491096029
Your right Sky I was just playing with it a bit, Looks like PC's have a Black inner Aura, while the NPCs have the white. Either way, I was speaking more towards the ability to make anything greater than Bar1 Max change the Aura 1 to a Blue (Or whatever really) color since thats the one that monitors the HP and adjusts accordingly.
Hrm, that could work possibly.
1491178766

Edited 1491178988
DXWarlock
Sheet Author
API Scripter
@Sky Still working on a way around the on drop. I could just remove the add:graphic, but then it doesn't update to add an aura to new tokens added, or one off's until you move them the first time (which isnt a good trade off I dont think). It seems to only do it to characters that have the bar stat tied to an attribute. So pretty sure now its only on mentioned before: The token saved value of the bar, vs new attribute value of bar it instantly updates to on drop. I'll work something out, just need to figure out what I need to work out to stop it.. :) @Dustin It wouldn't be that hard to change what you and sky mentioned, actually I have it coded to sort of STOP it from doing that. I'm using HSL color space and limiting max to 100, So I'm using the percentage of health as the color: 0 is red, 100 is green: I could remove the option that limits the value from 0 - 100, and let it go all the way, so like 200% health would be blueish Or do you want more drastic obvious color for smaller amounts, like 110% to be blue. OR anything over 100% same color blue. That wouldn't be hard to do either. Also is your characters inner circle black? It should be player color. Black is the default fallback so it doesn't crash if it cant find the players dice color.
DXWarlock said: @Sky Still working on a way around the on drop. I could just remove the add:graphic, but then it doesn't update to add an aura to new tokens added, or one off's until you move them the first time (which isnt a good trade off I dont think). It seems to only do it to characters that have the bar stat tied to an attribute. So pretty sure now its only on mentioned before: The token saved value of the bar, vs new attribute value of bar it instantly updates to on drop. I'll work something out, just need to figure out what I need to work out to stop it.. :) It spawns the green heal FX every time regardless of whether the token health bar is linked or not. The goblin tokens I was copying and pasting were not linked to the character sheet.
1491179950

Edited 1491180292
DXWarlock
Sheet Author
API Scripter
Ah..strange. Let me poke around, only ones I could get it to trigger on was the ones tied to sheets with stats tied to attributes. Maybe I missed something I didnt think of trying. Copy/paste of the same token was doing it? edit: OH wait, just to check you dont have a script that rolls npc/mook HPs on drop do you? Just checking first. had that on mine a while back and it would cause it.
No, the tokens already have their hit points set.
1491215982

Edited 1491216169
DXWarlock
Sheet Author
API Scripter
Would you mind making me a copy of your game (dont want to poke around in a live play game), and I will see what is causing it? I cant seem to replicate it. And it should be skipping the FX with the check: if(curValue != prevValue && prevValue != "" && update !== "YES") As current and prev should be the same. Something must be off in it I'm not seeing the results of in my game :\
DXWarlock said: Would you mind making me a copy of your game (dont want to poke around in a live play game), and I will see what is causing it? I cant seem to replicate it. And it should be skipping the FX with the check: if(curValue != prevValue && prevValue != "" && update !== "YES") As current and prev should be the same. Something must be off in it I'm not seeing the results of in my game :\ Hrm, let me test something. I bet it's my DM Toolkit script firing health aura off for some reason.
It's not my scripts. It's the way roll20 creates copies of tokens when you copy and paste. I added log(obj) and log(prev) in handleToken and it's firing off several times. First roll20 creates a blank token and then copies all the attributes from the original token over to the new blank token. And this is what is causing it to display the FX. It doesn't happen when dragging from the journal though.
1491232972

Edited 1491233457
DXWarlock
Sheet Author
API Scripter
Thats whats strange, I cannot get it to do it in mine. I can copy paste: one off (no sheet) characters mook characters with a sheet but no attribute tied to the bar,  PC/NPC with sheet and attribute tied to the bar and it doesn't trigger. Aaron = PC with sheet and attribute bar, Bear = Random one off token with just bar values, Wight = mook with sheet and basic non-tied bar. Can even see wights bar randomly changing slightly from my 'NPC random health" script when I paste him, but it doesnt trigger the spurts. Not sure what the difference is that it acts differently for us :\
1491240091
The Aaron
Pro
API Scripter
What character Sheet are you each using, and do you have the companion scripts?  Might be something happening from OGL?
1491240572
DXWarlock
Sheet Author
API Scripter
I'm using a custom sheet for Rifts, and dont use companion scripts.
Never mind... it was an older version of the script. I forgot I installed it and wasn't using the one-click version.
DX I was just thinking a simple blue for anything over 100% thanks for the reply
1491316535
DXWarlock
Sheet Author
API Scripter
Ah yea! that might do it sky. but you might have the name bug if it affects you, the one click isnt pulled to update with the last version i made. And I can do that Dustin, anything over 100% is some blue tint.
1491414759

Edited 1491414911
DXWarlock
Sheet Author
API Scripter
If anyone dislikes the over 100% as blue and wish to just have it stay green, I can add a button for over heal display. Just let me know! 1.5.0 : Over heal indicator: Tokens over 100% health will change to a blue aura. Auto refresh on attrib change: Changing USECOLOR/USEBLOOD on/off will force a token update for all tokens assigned to that character (Unless done with API, that doesn't seem to trigger attrib change event, so added command below). New command: !aura update will force update of any tokens selected (works with multiple tokens selected).
DX that looks great! Works exactly as i'd hope, thank you!
1491439170
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Sweet!
1491440816

Edited 1491441481
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
!aura update  does not seem to force an update when changing the attribute programatically using ChatSetAttr. :( It updates instantly when I change the value manually. I'm using the 1.5.0 code from your github. Here are the API buttons I am using, but manually sending an !aura update to chat makes no difference. I receive a chat confirmation, but no change in behavior. [Health Aura On](!setattr --sel --USECOLOR|YES !aura update) | [Health Aura Off](!setattr --sel --USECOLOR|NO !aura update)
1491446334
DXWarlock
Sheet Author
API Scripter
Ill test it with that particular script. I was testing with my own simple one that just change usecolor.
1491461525

Edited 1491461603
DXWarlock
Sheet Author
API Scripter
I see why, my cache of the attributes isnt updated because ChatSetAttr doesnt trigger it to know to update it. So it never knew it changed, to re-read the sheet value vs cache value. Let me see what I can do.
1491475284

Edited 1491475649
DXWarlock
Sheet Author
API Scripter
1.5.1 : !aura update fix: Fixed issue with API attribute changes not updating cache. Only way I can think of checking for attribute changes via API vs manual changes, is to read the attribute every time. As far as I can see, there is no way to know an attribute has changed if a script changed it, without reading that attribute to see if its different. So the 'fix' makes my cache a bit pointless as I have to update each characters attrib value each time, so refresh on all tokens might be a bit slower, but nothing lag inducing. As long as you dont have 1000+ different unique characters across all pages... Still has an issue of trying to update multiple tokens aura with another script, and running the !aura update in the same macro with that script. But running each as its own command seems to work fine on multiple tokens (IE run the change command, then the update command). Think its a timing issue as my script reads the values on 'later in the list' of multiple tokens before other other script changes it.
This is fantastic. I am a complete newbie on Roll20 and was able to work with this right away, I have been doing some of this manually and this just makes the game way more fun.
So our groups started using this script and everyone likes it, however I do have a couple of comments.  First it is important to realize that I use basic portrait style tokens rather than top-down display.  Second, our group does use their aura's from time to time to represent certain things (i.e. Paladin Aura, Spell radius centered on the caster, etc...). Based on the above configuration, our group sets Use Tint to yes, however with that set, you really don't want your token being green all the time so we set the PC/NPC thresholds to 50/50.  This does work pretty well for us overall, but I noticed a few things. If someone is colorblind, often the color changes are too subtle for them to make out the differences.  I don't know if this is something that can honestly be improved, but figured I would ask if people had a suggestion for it. The feature of showing who is overhealed (blue aura/tint) doesn't work if the PC/NPC thresholds are set below 100. If you have a death sound effect configured and a creature dies while playing a playlist, after the death sound finishes, it forces the next track on the playlist to begin playing.  
1491841168

Edited 1491841265
DXWarlock
Sheet Author
API Scripter
Not sure what I could do to change that, if someone has suggestions Id try to find one that works It wont work currently because you are over the threshold, if its set to show at below for example: 99%, anything over 99% means "off". So say 105% would be over the limit set to show any status. You want it to show over heal regardless? As in say its set to 70%. it wont show up until below 70, but if overhealed turn on and show it? I will look into it, not sure whats causing that.