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

Adding and removing attributes from character sheets (towards a full character importer)?

May 01 (12 years ago)

I'm excited the API is out in the wild now! I'm almost ready to jump in for a subscription so I can test it out... but in looking at the documentation, I'm not seeing a way to add or attach attributes or abilities to a character. My first big project would be to find a way to scrape JSON data directly into character data so I can import characters with skills, saves, and stats without having to use the GUI.

Is it possible to just make a JSON file offline and suck it into the API directly? Or could I write a script that generates the attributes from a list (easy to make a program that reads data and spits out a complete .js file with addAttr commands or whatever).

I'm not necessarily asking for a complete solution here, just if it's possible and what are some of my options?

May 01 (12 years ago)

At present, there is no way to generate new roll20 objects using the API; that means you cannot add attributes or abilities to a Character object through automation or the API; you can only modify already existing attributes or abilities.  Presumably, this may change in the future.

May 01 (12 years ago)
Riley D.
Roll20 Team

It is high on the list to roll out soon. 

May 02 (12 years ago)

Riley D. said:

It is high on the list to roll out soon. 

I am sharpening my javascript knives for this then. Thanks for the hard work!
May 26 (12 years ago)
Alicia
Sheet Author

Sorry to bring a post out of the graveyard, but what sort of progress has there been towards this?

May 26 (12 years ago)
Alex L.
Pro
Sheet Author

Alicia G said:

Sorry to bring a post out of the graveyard, but what sort of progress has there been towards this?

If you read the update posts or the wiki you would know that this was rolled out quite some time ago.

May 26 (12 years ago)
Alicia
Sheet Author

Been looking and tried a suggestion from another post and can't get it to work, so I wondered.


Edit NM I"ve figured it out. Though I'm noticing that it's affecting all character sheets, not just new ones. when I use the suggested code.

May 27 (12 years ago)
Riley D.
Roll20 Team

Alicia G said:

Been looking and tried a suggestion from another post and can't get it to work, so I wondered.


Edit NM I"ve figured it out. Though I'm noticing that it's affecting all character sheets, not just new ones. when I use the suggested code.

Make sure that you're wrapping your code in the on:ready event. Example:

on("ready", function() {
    on("add:character") {
        //Add your attributes here...
    });
});