bmarian / token-tooltip-alt

A module that adds a tooltip next to the currently hovered token to show some useful information for players and DMs.
MIT License
9 stars 15 forks source link

[FEATURE REQUEST] hide value if 0 #85

Closed spiteski closed 3 years ago

spiteski commented 3 years ago

Is there any way to have different lines only show up if their value is >0? For example, I want to set up all my tokens with the following settings, but hide all the (resistance) values that are 0 image

bmarian commented 3 years ago

See the examples in https://github.com/bmarian/token-tooltip-alt/blob/master/EXP_EXPEXAMPLES.md

You can achieve what you want with math.js

bmarian commented 3 years ago

If you return an empty value, TTA will not render that line. So check if the value is 0 and return ''.

spiteski commented 3 years ago

I tried this with the following { a=<resistances.cold.value>; a=compareText(typeOf(a), "null") == 0 ? '' : a; }

The value of cold was 10, however it simply does not show up. (I have selected EXP also to ensure). Should this work or have I mistaken?

spiteski commented 3 years ago

Got it with { a=<resistances.cold.value>; a= a == 0 ? "" : a; a }

Thanks!