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

July 09 (9 years ago)
The Aaron
Pro
API Scripter
(No problem! =D)
This is amazing, question is there anyway to turn this off for pcs and only use it for NPCs?
@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.

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.
July 14 (9 years ago)

Edited July 14 (9 years ago)
DXWarlock
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 :)
July 14 (9 years ago)
DXWarlock
Sheet Author
API Scripter
AddGreg 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.

DXWarlock (William R) said:

AddGreg 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!
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.
July 14 (9 years ago)

Edited July 14 (9 years ago)
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

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?
July 14 (9 years ago)
The Aaron
Pro
API Scripter
!token-mod --set tint_color|transparent
!token-mod --set tint_color|#ff0000
etc..

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.
July 14 (9 years ago)
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

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! :)
July 14 (9 years ago)
The Aaron
Pro
API Scripter
=D. Ok, time to get the thread back on topic.

Big fan of your work, DX!!
July 14 (9 years ago)

Edited July 14 (9 years ago)
DXWarlock
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
July 14 (9 years ago)

Edited July 14 (9 years ago)

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.

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.
July 15 (9 years ago)

Edited July 15 (9 years ago)
DXWarlock
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 :(
July 27 (9 years ago)
DXWarlock
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.

July 27 (9 years ago)
Alicia
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.
July 27 (9 years ago)

Edited July 27 (9 years ago)
DXWarlock
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. 
September 03 (9 years ago)
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.
September 04 (9 years ago)
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.
October 06 (9 years ago)

Edited October 06 (9 years ago)
Alex C.
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).
October 06 (9 years ago)

Edited October 06 (9 years ago)
DXWarlock
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?
October 06 (9 years ago)

Edited October 06 (9 years ago)
Cosmic
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?
October 06 (9 years ago)

Edited October 06 (9 years ago)
DXWarlock
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.
October 06 (9 years ago)

Edited October 06 (9 years ago)
Cosmic
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.


October 06 (9 years ago)
DXWarlock
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).
October 06 (9 years ago)
Cosmic
Sheet Author
Sure. Poke your head under my campaign bonnet and see if you can get her working. 
October 06 (9 years ago)

Edited October 06 (9 years ago)
DXWarlock
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.
October 06 (9 years ago)
Alex C.
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!
October 06 (9 years ago)

Edited October 06 (9 years ago)
DXWarlock
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.
October 07 (9 years ago)

Edited October 07 (9 years ago)
DXWarlock
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'.
October 07 (9 years ago)
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.
October 07 (9 years ago)
Ziechael
Forum Champion
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 =)
October 07 (9 years ago)
DXWarlock
Sheet Author
API Scripter
Ziechael so it is :)
No worries I fixed it and pushed a new version, thanks for pointing it out :)
October 07 (9 years ago)
Alex C.
Marketplace Creator
The update completely fixed the issue I was having, and I love the death sound option. Well done!
October 09 (9 years ago)
Best death sound? The Wilhelm Scream. And it's in SoundCloud!
October 09 (9 years ago)
Ziechael
Forum Champion
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.
October 10 (9 years ago)
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