[Script] Aura/Tint HealthColor

1436462761
The Aaron
Pro
API Scripter
(No problem! =D)
1436824497
This is amazing, question is there anyway to turn this off for pcs and only use it for NPCs?
1436832692
@Greg B.: The script is helpfully annotated, so you can easily delete the section that starts with //SET PLAYER AURA to achieve this. In the current iteration, this comprises lines 99-126.
1436832834
Glenn H. said: @Greg B.: The script is helpfully annotated, so you can easily delete the section that starts with //SET PLAYER AURA to achieve this. In the current iteration, this comprises lines 99-126. Awesome, I actually did that but wanted to make sure that i'm not screwing anything thing else up. :) Thanks for the quick reply.
1436836321

Edited 1436836343
DXWarlock
Pro
Sheet Author
API Scripter
I will add a toggle for it, will be tomorrow before I can get to it, but it's a great idea :)
1436866406
DXWarlock
Pro
Sheet Author
API Scripter
Add Greg B. said: This is amazing, question is there anyway to turn this off for pcs and only use it for NPCs? Done, Thanks for the suggestion! v0.9.1 Added toggles for PC and NPC health colors.
1436879890
DXWarlock (William R) said: Add Greg B. said: This is amazing, question is there anyway to turn this off for pcs and only use it for NPCs? Done, Thanks for the suggestion! v0.9.1 Added toggles for PC and NPC health colors. Awesome, thanks!
1436884824
I was also thinking maybe a Reset feature would be nice, since its tracking the health of monsters, and please let me know if this is outside of the scope of what you are doing here but, I was thinking it could do two things. 1. Remove all auras / tints from a target 2. Reset the @{Target|HP|current to @{Target|HP|max} I realize the second part could easily be done via TokenMod. (in fact I have a macro that does that very thing) I'm sure now that I mention it, Aaron will probably expand token mod to modify auras as well, assuming it isn't capable already.
1436885112

Edited 1436885134
The Aaron
Pro
API Scripter
No expansion necessary... !token-mod --set aura1_radius|0 aura2_radius|0 You can change the permissions and colors too, of course. =D
1436887171
The Aaron said: No expansion necessary... !token-mod --set aura1_radius|0 aura2_radius|0 You can change the permissions and colors too, of course. =D Knew it, but what about Tint?
1436888573
The Aaron
Pro
API Scripter
!token-mod --set tint_color|transparent !token-mod --set tint_color|#ff0000 etc..
1436889468
The Aaron said: !token-mod --set tint_color|transparent !token-mod --set tint_color|#ff0000 etc.. Doh, I even looked at the Help doc on it and didn't see it, figured I got ya.
1436889610
The Aaron
Pro
API Scripter
HAHAHA. =D At this point, I think the only thing you can't do to a token through token-mod but can through the menu is assign controlled by. =D
1436890128
The Aaron said: HAHAHA. =D At this point, I think the only thing you can't do to a token through token-mod but can through the menu is assign controlled by. =D Touche! Now if I could only "clean abilities" selectively, now that would be something! :)
1436890457
The Aaron
Pro
API Scripter
=D. Ok, time to get the thread back on topic. Big fan of your work, DX!!
1436892312

Edited 1436892356
DXWarlock
Pro
Sheet Author
API Scripter
Greg B. said: I was also thinking maybe a Reset feature would be nice, since its tracking the health of monsters, and please let me know if this is outside of the scope of what you are doing here but, I was thinking it could do two things. 1. Remove all auras / tints from a target 2. Reset the @{Target|HP|current to @{Target|HP|max} I might be able to do the first, second is a bit out of the range I had planned for it. But first I can add to my to do list, once I figure out how to make it so you can toggle it for individual tokens so they dont ever get it, I can add it so its a toggle for each. Might take a while, as I think I'll need to work out storing them all in the state somehow, and values for if they use it and if its toggled on or off. The Aaron said: =D. Ok, time to get the thread back on topic. Big fan of your work, DX!! Its mostly your work, I bug you when I break it on how to fix them :P
1436893093

Edited 1436893482
DXWarlock (William R) said: Greg B. said: I was also thinking maybe a Reset feature would be nice, since its tracking the health of monsters, and please let me know if this is outside of the scope of what you are doing here but, I was thinking it could do two things. 1. Remove all auras / tints from a target 2. Reset the @{Target|HP|current to @{Target|HP|max} I might be able to do the first, second is a bit out of the range I had planned for it. But first I can add to my to do list, once I figure out how to make it so you can toggle it for individual tokens so they dont ever get it, I can add it so its a toggle for each. Might take a while, as I think I'll need to work out storing them all in the state somehow, and values for if they use it and if its toggled on or off. The Aaron said: =D. Ok, time to get the thread back on topic. Big fan of your work, DX!! Its mostly your work, I bug you when I break it on how to fix them :P Cool. Yeah I figured it might be out of scope. Which is totally fine, especially since token mod does it all anyways. Aaron agreed to write something for me, so that was a quick zing for his task list being to long and then him changing the subject very quickly. Both of your work is quite awesome, looking forward to where this goes. :)
This is really cool, I can't use it though as my other scripts do things with auras. But for the off games where I don't use them I'll definitely implement your script DX. Very creative! PS: A small note that change events aren't sent for things done by the script interface. So if you have another script alter the health of a token, it won't send a change event. That's expected as if a script changed a token reacting on a change, that would create some circular logic without careful checks.
1436899702
Ken L. said: This is really cool, I can't use it though as my other scripts do things with auras. But for the off games where I don't use them I'll definitely implement your script DX. Very creative! PS: A small note that change events aren't sent for things done by the script interface. So if you have another script alter the health of a token, it won't send a change event. That's expected as if a script changed a token reacting on a change, that would create some circular logic without careful checks. Yes I did see this, if I used the Tokenmod function to "Reset" the HP. The State in the Aura script stays the same.
It can be resolved with an 'update' method of some kind, perhaps even exposed through a javascript method to allow script chaining.
1436933604

Edited 1436933673
DXWarlock
Pro
Sheet Author
API Scripter
Yea I (personally) know no way around it inside my script itself either, its the way the API and tabletop interact. Why i stated you might need to 'wiggle' tokens to get them to update. Ive been trying to find a way to update them when you toggle on and off, I gave up on that..:)
If this could work with the Altersbar script. I'd use this all the time :(
1438014070
DXWarlock
Pro
Sheet Author
API Scripter
Saevar L. "Liquid-Sonic" said: If this could work with the Altersbar script. I'd use this all the time :( Not familiar with that one, what does it conflict with on it? Maybe I can work something out.
1438014999
Alicia
Pro
Sheet Author
DXWarlock (William R) said: Saevar L. "Liquid-Sonic" said: If this could work with the Altersbar script. I'd use this all the time :( Not familiar with that one, what does it conflict with on it? Maybe I can work something out. Doesn't so much conflict as your script doesn't update after using the  Alter Bar script .
1438015623

Edited 1438015771
DXWarlock
Pro
Sheet Author
API Scripter
Ah I see. Not much I can do about that, sorry :\. The way the tabletop works the tokens don't trigger an update if altered through the API. IF edited by a person it will. But if the API changes values no way for the script to know it unless you move the token so it sees the values changed on the trigger it causes. Wish they made any token changes trigger the event, not just player interaction ones. But I could see maybe how that could cause a bad loop if used wrong. (a token updates, triggers the script, which would trigger an update, etc etc)
There is a strange case happenng for me where some tokens seem to get no aura no matter what I do. The rest will work perfectly but one or two just don't seem to want to work. I've tried renaming the sheet, I've tried deleting them (character sheet/token included). Reuploading the token image. It will work in soms campaigns while some not in others. For the life of me I cant figure out why. 
1441266274
Sky
Pro
Saevar, it should be as simple as adding handleToken(Target); at the bottom of AlterBar, third line up before the }); symbols. Target.set("bar" + Bar + "_value", CurrentValue -= AlterValue); } handleToken(Target); }); };
Oh to not confuse this with my previous request. This has nothing to do with Alterbars script. I am talking about auras script. With the aura reflecting their hp. I will post a screen o matic of what I mean tonight. To make it more clear. Ignoring the request of wanting altersbar to walk with auras health. The aura will work for all of my tokens except a few of them. Nothing I do will affect particular tokens and have their hp reflected in auras aaround them.  Ie Token 1 and 2 will reflect being at half hp in their aura but some reason token 3 will not no matter what I do to it. This might be an issue of the specific image or its name somehow interfering with the script bbuti cant be certain. PS. Super thanks though Badger. You're the best and I still use powercards for any 4th editon I do. :)
The Token Kriv. Wont have an aura. Its set up exactly like the others. I cannot think of any reasons why.
1441330634
Sky
Pro
Try remaking the token from scratch. I know I have had some issues with token id's or character id's screwing with the api.
Hmmm I did try this. It was strange how nothing I did would affect "THIS" token. Literally, no matter what character sheet I gave it, called it. Named it, did to it. I could not figure it out. I'll try again tonight. I imagine it might of fixed itself.
1444133932

Edited 1444134540
Alex C.
Pro
Marketplace Creator
Saevar - did you find anything that seemed to correct the issue? It looks like I'm running into the same problem, but focused on the PC tokens. The auras won't come on for them at all. NPCs, yes. PCs, no. Show On PC is set to Yes in the menu. I noticed that I'm getting this repeated error in the Console -  "Token bar3 is linked" {"who":"error","type":"error","content":"Unable to find a player or character with name: HealthColors"} "Still working after trying to roll hp" {"name":"SyntaxError","expected":["\"(\"","\".\"","\"[\"","\"abs(\"","\"ceil(\"","\"d\"","\"floor(\"","\"round(\"","\"t\"","\"{\"","[ |\\t]","[+|\\-]","[0-9]"],"found":null,"message":"Expected \"(\", \".\", \"[\", \"abs(\", \"ceil(\", \"d\", \"floor(\", \"round(\", \"t\", \"{\", [ |\\t], [+|\\-] or [0-9] but end of input found.","offset":0,"line":1,"column":1} {"who":"error","type":"error","content":"There was an error with your formula. Please try again."} "Still working after trying to roll hp" "Token bar3 is linked" {"who":"error","type":"error","content":"Unable to find a player or character with name: Shaped"} and so on. It seems to appear whenever I adjust the HP of an NPC token (the aura still seems to be working on them despite the error). And it's been saying this in chat: (From Shaped): Token bar3 is linked ... which only shows up when I drop a new instance of a PC token onto the board. PCs and NPCs both use bar 1 for tracking hp. (I'm playing 5th edition and using the Shaped sheet). edit - I played around a bit more and discovered that the auras don't work on any token with player control (I verified that Show on PC was set to yes and toggled it a few times to make sure).
1444157294

Edited 1444157642
DXWarlock
Pro
Sheet Author
API Scripter
Crap,.somehow I was unsubscribed from this topic, never saw the last few replies :\ That looks like some other script fussing and stopping the API? Or fighting with something I have perhaps? The 'shaped' error is the 5e shaped sheet script I believe. Mine doesn't look for, or use rolls anywhere Thats what the  "There was an error with your formula. Please try again." is from. And it doesnt announce directly to chat other than the setting box to the GM. Very strange, as the campaign I use this on is using Shaped sheet, and script also and seems to work fine.  Try disabled the shaped script and see if it works, if it does try disabling mine and see if shaped still works or still throws errors. I cant think of anything at all mine would be doing to upset the 5e script, It doesnt write or adjust anything on the character sheet itself.   I'll play around with it on a fresh campaign with the updated version of both the shaped sheet and script and see if I can cause it. Are you using the spell import script also?
1444166349

Edited 1444166411
Alex Wilson
Pro
Sheet Author
I can't get any of the auras to show. I enabled the script, and the !aura command works with the chat box . There are no errors in the API sandbox. I am missing something small right?
1444166528

Edited 1444166654
DXWarlock
Pro
Sheet Author
API Scripter
Alexander do you have the tokens assigned to a sheet, and the token set as 'represents' that sheet? If not, Its the only way (I know of) I can tell whats a 'character' token vs a rock, or tree, or chair..etc. to add an aura to it.
1444166830

Edited 1444167102
Alex Wilson
Pro
Sheet Author
All my NPCs and PCs have default Tokens set, and all my NPCs and PCs tokens 'represent a character' I have Health Bars set to 'None' ( yet still representing the X/Y Hit Points) on my NPCs The PCs health bar is to the character sheet.
1444167575
DXWarlock
Pro
Sheet Author
API Scripter
Hmm if you want to invite me to the game and make me a GM I can take a look and see where its failing if you dont mind me poking around in the script. You have them on the token layer correct? (stupid question but had someone message me a while back and they had them on map layer).
1444167806
Alex Wilson
Pro
Sheet Author
Sure. Poke your head under my campaign bonnet and see if you can get her working. 
1444172497

Edited 1444172540
DXWarlock
Pro
Sheet Author
API Scripter
I found the issue for  Alexander its when a token is assigned to a player as represents, and the GM is also set to controlled by as well as the player.  Because the player tint goes off the controlling player, its checks to see if one person controls it, anymore and it does a return; Actually any token 'controlled by' more than one person and set to a sheet will do it, since it doesn't know which color to apply. Will update to not use any color for inner ring if thats the case, and update script today or tomorrow.
1444174150
Alex C.
Pro
Marketplace Creator
Just got home and saw your reply, DX. Thanks for that. I'm 99% sure that Alexander's problem is also my problem. The tokens in question that aren't showing the auras are all controlled by both the GM and at least one player. We'll see what happens after your update!
1444174318

Edited 1444174336
DXWarlock
Pro
Sheet Author
API Scripter
Working on it now, Since I cant tell which player is the real controlling one, and cant reliably pick either the first or second (third, forth, ect,) in the controlledby list (as it could be GM, player or player,GM..depending on order people add the controllers) Im just going to make it if it has more than one controller, and is a PC, make inner ring white.
1444178004

Edited 1444178242
DXWarlock
Pro
Sheet Author
API Scripter
Updated to 0.9.2 Fixed the aura on multi user tokens (hopefully) And while at it: Added option to play sound on death Setting to change the aura size in the gui. To use the death sound, just set it from 'none' to whatever the exact name of your death sound is in the jukebox To disable just set it to the default popup option of 'None'.
1444192171
Ravenknight
KS Backer
Thanks a lot! :) Now to find me some good death sound.
Ah thanks for this one warlock. One of the best scripts thus far.
1444210706
Ziechael
Pro
Sheet Author
API Scripter
Great work... not wanting to be 'that' guy (but going to anyway) I just wanted to let you know that your comment on line 303 is the same as 302 not that it isn't obvious what line 303 is actually asking for but... well... i'm a pedant =)
1444235705
DXWarlock
Pro
Sheet Author
API Scripter
Ziechael so it is :) No worries I fixed it and pushed a new version, thanks for pointing it out :)
1444254486
Alex C.
Pro
Marketplace Creator
The update completely fixed the issue I was having, and I love the death sound option. Well done!
1444425923
Best death sound? The Wilhelm Scream. And it's in SoundCloud!
1444429440
Ziechael
Pro
Sheet Author
API Scripter
Mark R. said: Best death sound? The Wilhelm Scream. And it's in SoundCloud! +1 Used it in my game last night in fact and I can confirm that nothing was more satisfying to my players than the good ole Wilhelm Scream every time one of the bad guys died.
1444475033
Ravenknight
KS Backer
Ziechael said: Mark R. said: Best death sound? The Wilhelm Scream. And it's in SoundCloud! +1 Used it in my game last night in fact and I can confirm that nothing was more satisfying to my players than the good ole Wilhelm Scream every time one of the bad guys died. Epic! :D