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

Setting attributes as die rolls

I'm currently trying to write a macro that allows me to toggle which weapon I'm using with the help of the ChatSetAttr script. I have an attribute called "Pact Weapon", and a "Summon Pact Weapon" macro, which currently looks like this: !setattr --name X --Pact Weapon|[[?{Pact Weapon|Dagger, 1d4|Javelin, 1d6}]] Now what I want the macro to do is to set the Pact Weapon attribute to "1d4" or "1d6", however what it actually does is roll the die, and then set the attribute as the result (so 1, 2, 3, etc.). Any ideas on how to fix this?
1582480986
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Get rid of the square brackets. They are evaluating the expression and turning it into a resolved number: !setattr --name X --Pact Weapon|?{Pact Weapon|Dagger, 1d4|Javelin, 1d6}
That fixed it, thanks!