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

Macro: call resource value as a variable for a die roll

Novice to roll20 macros here, thanks for your patience. I have an ability which allows me to build up charges, which I'm storing as a repeating resource. I'd like to execute the ability with a macro that pulls the value from that resource as a variable d6 roll. However, I keep getting an error when testing the macro. I'm not sure if it's just improper syntax, and I'm having trouble understanding how to apply the resource articles to this specific problem.  I initially tried to write to execute this in the damage field of a weapon, then realized it may only work as a macro. The error is the same with both methods.  Here's what I've written: /roll @{Ondo|repeating_resource_-nbe5h8fltoapjdelspz_resource_left} The error reads: "You tried to use the repeating section row at index NaN for repeating_resource, but there doesn't seem to be a row at that index." I pulled the resource's ID from inspecting the HTML element.  Ideally the macro would also reset the resource variable to zero. I may be able to puzzle that part out myself. But I'd greatly appreciate some help here. Thank you!
1744965722
Gauss
Forum Champion
Hi Elijah P.,  Which character sheet are you using? If you don't know the name please supply a screenshot.
1744979274
timmaugh
Pro
API Scripter
Elijah P. said: Here's what I've written: /roll @{Ondo|repeating_resource_-nbe5h8fltoapjdelspz_resource_left} The error reads: "You tried to use the repeating section row at index NaN for repeating_resource, but there doesn't seem to be a row at that index." These references *will* work in both inline rolls and /roll ... rolls... but they ARE case sensitive. I find it unlikely that you would have only lowercase characters in the UUID for that row entry. In fact, the creation of a UUID is driven by temporal decomposition from the epoch, and we're at a point where the first character after the hyphen should have (probably) been a capital 'N' when it was created.  Here's an image from mine, where the first character after the hyphen is an 'O' (it would have been created later than yours): So you can probably fix this just by copying the repid with a bit more fidelity to the case and using that new copy in your command.
Thanks, timmaugh! Your evaluation of the problem helped me realize I pulled the wrong ID value entirely. The macro now works. Happy to learn I wasn't far off, and now I know better.