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

If Variable Exists, Pull it, otherwise Ignore

Hi all, I'm trying to save myself a lot of work regarding a new homebrew rule.  Is it possible in a macro to print an attribute value if it exists, otherwise ignore it? I'm trying to avoid getting a bunch of these messages:   No attribute was found for @{selected|attribute_name} Googling / searching the forums hasn't turned up anything. Thanks in advance. -Adam
1654365172

Edited 1654365229
GiGs
Pro
Sheet Author
API Scripter
It's not possible to do any conditionals (like "If attribute exists, do this") with a standard roll or macro. It's possible to suppress error messages, but the macros still try to use the non-existent attribute, so that's often not useful. It is possible to do this with an API script, and if you're creating or editing a character sheet, it's also possible to avoid this (say, by making sure every attribute has a default value).
GiGs said: It's not possible to do any conditionals (like "If attribute exists, do this") with a standard roll or macro. It's possible to suppress error messages, but the macros still try to use the non-existent attribute, so that's often not useful. It is possible to do this with an API script, and if you're creating or editing a character sheet, it's also possible to avoid this (say, by making sure every attribute has a default value). Thanks for the quick response.  Adding the new attributes to each sheet (even if they don't need to contain a value) was my plan B.  Sounds like that will be the best route forward. -Adam