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 .
×
Advertisement Create a free account

TokenMod - UDL and LightColor

1634080247
Hi everyone, I have some macros set-up to set various kinds of light for my players (torches etc.) which use roughly the following syntax for each "item": |Sunsword 30,!token-mod --set has_night_vision#0 --set emits_bright_light#1 --set emits_low_light#1 --set bright_light_distance#30 --set low_light_distance#30 My players recently found a Sun Blade and I wanted to represent the difference between the "Sunlight" it emits and normal lighting. I have been trying to use this using the lightColor key that was added in July thusly: We added a new API key for Graphics, ‘lightColor’ which takes a hexadecimal color value i.e ‘#FF0000’ for red I have tried using this syntax (just adapting my original) but it doesnt seem to have any effect on the color: |Sunsword 10,!token-mod --set has_night_vision#0 --set emits_bright_light#1 --set emits_low_light#1 --set bright_light_distance#10 --set low_light_distance#10 --set lightColor#FF0000 Does anyone have any idea what I am doing wrong? P.S. As a bonus question... does anyone know what the hexadecimal code for transparent (i.e. no color) should be?
1634080881
The Aaron
Forum Champion
API Scripter
Just a side note, there's no need to repeat the --set if you're still setting things: |Sunsword 30,!token-mod --set has_night_vision#0 emits_bright_light#1 emits_low_light#1 bright_light_distance#30 low_light_distance#30 This seems to be working for me: |Sunsword 10,!token-mod --set has_night_vision#0 emits_bright_light#1 emits_low_light#1 bright_light_distance#10 low_light_distance#10 lightColor#FF0000 For transparency, just put 00 on the end of any hexadecimal code, and it will be transparent.  Only some things support the transparency setting.
1634080980
The Aaron
Forum Champion
API Scripter
With TokenMod, you can just use the word "transparent". Colors Colors can be specified in multiple formats: Transparent  -- This is the special literal  transparent  and represents no color at all. HTML Color  -- This is 6 or 3 hexidecimal digits, optionally prefaced by  # . Digits in a 3 digit hexidecimal color are doubled. All of the following are the same:  #ff00aa ,  #f0a ,  ff00aa ,  f0a RGB Color  -- This is an RGB color in the format  rgb(1.0,1.0,1.0)  or  rgb(256,256,256) . Decimal numbers are in the scale of 0.0 to 1.0, integer numbers are scaled 0 to 256. Note that numbers can be outside this range for the purpose of doing math. HSV Color  -- This is an HSV color in the format  hsv(1.0,1.0,1.0)  or  hsv(360,100,100) . Decimal numbers are in the scale of 0.0 to 1.0, integer numbers are scaled 0 to 360 for the hue and 0 to 100 for saturation and value. Note that numbers can be outside this range for the purpose of doing math.
1634081992

Edited 1634082002
Thanks The Aaron, removing the --set elements (other than the first one) has indeed resolved the problem... bizzarre, but nice!
1634082196

Edited 1634082334
... as a side note to anyone who might find it useful: It appears that if you set a light but omit the lightColor element it will automatically revert the tint to transparent... which is nice! EDIT - Actually scratch that, it seems sporadic... sometimes it does, sometimes it doesn't - oh well.
1634097605
The Aaron
Forum Champion
API Scripter
Hmm. That sounds like a bug. If you get reproducible steps, let me know. 
1634121176
Ok will try and take a deeper look... at first glance it may be distance related, but it was late so that is highly questionable. Will let you know if it becomes clearer.
1634122724

Edited 1634124575
Just realised it was user error... or distraction... Doh! Esentially when I switched to "NIght Vision" only options I wasn't seeing a colour/tint but as soon as I switched to an "Emit Light" option the colour/tint was re-appearing.... in my tiredness I didn't realise that the properties are named differently between the two (i.e.  night_vision_tint  v. lightColor). My bad, sorry! So the behavious is that the lightColor is retained when other values are changed (but is correctly set using the transparent literal).
1634153539
The Aaron
Forum Champion
API Scripter
Excellent!