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

Creating attribute with API with same name creates two sets?

1463188074

Edited 1463188403
DXWarlock
Sheet Author
API Scripter
Creating an attribute via API, if it already exists on the sheet, creates a new attribute of the same name? I realized my error of not checking to see if it exists first and corrected it, but my assumption was it would just re-write the current attribute with the new values assigned to it. (Was my original lazy intent, to reset ALL the sheets to 0/100: if it doesn't exist create it, if it does just overwrite it.) For example I had a hunger attribute, and ran the script, all my characters had a new attribute also named exactly the same with different values. How would this work in practice? say you called Hunger in a macro or API, which value would it return? Or if you wrote to it, does it update both to the same? (I could test these, but wanted to see if it was a bug before I tried to 'exploit' it.) Shouldn't creating an attribute that already exist just replace its value and max with the values vs duplicating it?
1463189597
Silvyre
Forum Champion
DXWarlock said: How would this work in practice? say you called Hunger in a macro or API, which value would it return? It tends to return the lattermost Attribute, in my experience.