Aedif / TokenVariants

GNU General Public License v3.0
17 stars 12 forks source link

[Feature Suggestion] add the ability to use executable custom JS code in text in overlay #145

Closed LeandroMartinelli closed 7 months ago

LeandroMartinelli commented 7 months ago

Hi, first of all, great work and thanks for the incredible module!

My suggestion came from the fact than when we use the text overlay only some simple variable or text cam be used, but the possibility to make some JS code for simple calculations would bee great! Examples:

Thank you for the attention

Aedif commented 7 months ago

Code can already be entered into that field. Simply make sure that the value returned in a string.

e.g.

const xp = token.actor.system.details.xp;
xp.max - xp.value + ""
LeandroMartinelli commented 7 months ago

Thanks I'm using it wrong then!!

{const xp = token.actor.system.details.xp;
"XP: " + (xp.max - xp.value) + "" }}

Works just fine, but I'm using in a way how return 0 everytime

XP: {{token.actor.system.details.xp.max - token.actor.system.details.xp.value}}

Again, thanks for the great work!

Aedif commented 7 months ago

Thanks for the template submitions 👍. I've made a couple of adjustments and have approved them.