We use Cookies to help personalize and improve Roll20. For more information on our use of non-essential Cookies, visit our Privacy Policy here.
Accept
Advertisement Create a free account

Creating attribute with API with same name creates two sets?

1463188074

Edited 1463188403
DXWarlock
Pro
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.