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

Can we tie darkvision to an attribute? And if so, how?

As the title asks, my question is fairly simple. Can we tie a Token's darkvision to a character sheet's attribute? And if so, how? For an example, a character can see up to their Perception in the dark. In this case, it would be easiest if their token's Darkvision was tied directly to their Perception attribute. Especially if their perception is liable to change due to statuses or similar.
1705734094
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
It could be tied to an attribute sort of, through the API. An Attribute Call can be used in a Token Mod Macro: !token-mod --set has_night_vision|on night_vision_effect|nocturnal night_vision_distance|@{selected|passive_wisdom} But you would actually have to run the macro to set it.
1705739163

Edited 1705739733
keithcurtis said: It could be tied to an attribute sort of, through the API. An Attribute Call can be used in a Token Mod Macro: !token-mod --set has_night_vision|on night_vision_effect|nocturnal night_vision_distance|@{selected|passive_wisdom} But you would actually have to run the macro to set it. Should this set it automatically to the token? Because I'm trying it with the correct attribute call, and it's not working. Though in fairness I don't think I have the right API to do this. What's the name of the API I need, or do I need to write one myself for this sort of thing? (For the record, this is for multiple game systems as it's just a homebrew rule for all my tables that use dynamic lighting, regardless of the system.)
Hi You just need Token-Mod for that to work.  I have tested it in one of my sandpits and it works, setting those token values as indicated.   Different systems will have different attribute names, so you might have to change passive_wisdom to match your system, but otherwise this should work.
Thanks! It's working with the Token-Mod api. :)
1705770423
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I probably should have explained that more fully. Yes, a token-mod macro requires the token-mod script to be installed. Token-mod is probably the most generally powerful and useful script in the collection. If you have not installed a script before, here is a quick video guide by the amazing Nick Olivo: How to Install Roll20 API Scripts