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

[Important!] API Changes

1405809771
Lithl
Pro
Sheet Author
API Scripter
Wow, yeah, 100ms interval to scan all the things seems just silly. I might understand it if the script was a timer, for example (and even then, 100ms is probably lower than you need), but scanning the campaign's objects like that is a terrible idea. The only time I've written any JS code in my life that used a time span that small was for cascading some slide-in transitions.
1405813077
The Aaron
Roll20 Production Team
API Scripter
I have one script that changes some visual properties on an object every 100ms. At least it's not polling...
So can we get an estimate on when this whole new API system shabang will be implemented and working?
Greg L. said: So can we get an estimate on when this whole new API system shabang will be implemented and working? The CPU and Memory restrictions are already in place...and as of today the API server survived the weekend without crashing, so all seems well. Are you still experiencing an issue?
Unfortunately, yeah. I haven't been able to get off of spinning up new sandbox since Friday.
Greg L. said: Unfortunately, yeah. I haven't been able to get off of spinning up new sandbox since Friday. Which campaign is it? Canyou give me a link to the details page?
It seems to have sprung to life as of this message. I sent you the campaign link nonetheless just in case you would still want it.
Thanks for the tips Riley. My campaign is back up and running after the new restrictions have been put in place. I stripped down a large chunk of abilities from each of the characters in my campaign and it no longer closes down the API due to the CPU usage. The API is running much more fluidly too, some things that were not previously working in my script are now working as intended. Cheers.
Glad to hear it! And thanks for making those changes.
1406560982
The Aaron
Roll20 Production Team
API Scripter
I ran into an error message and circumstance that might interest you. The error was: Sandbox closed due to error. It happened with the Edge of the Empire Dice script in a weird way. On startup, the script checks all the characters for all the attributes that are used for the dice script, adding them if they are missing, and resetting certain ones of them if they are present. With no user interaction at all, the sandbox would crash with that error about 50-60 seconds after the initial character attribute check had finished. I tracked down and fixed what was causing the crash. It was doing a findObjs() call for each of the attributes for each of the characters, 2 characters at a time every 500ms. On the campaign I was looking at, there were 30 characters, resulting in 2280 calls to findObjs(). I changed it to just grab an array of all the attributes and filter it down to the ones of interest (only one findObjs() call now), and the problem has gone away. However, I was surprised that it would take almost a minute to crash and with such a generic error message. I thought it might be indicative of some other issue, with all those findObjs() calls some how leaving things in a bad state, possibly leaking some resource. I commented out all the manipulation in the rest of the script so that only the 2280 findObjs() calls were being made and still got the crash, so I don't think there would be any problems related to writing data. Anyway, thought you should know.
That's interesting that it didn't say anything else besides that error...but my guess is that it was triggering the CPU threshold (that's not instant as it's a minute average).
1406582752
The Aaron
Roll20 Production Team
API Scripter
That would make sense, I didn't think about that working on window that way. Thx!
1406783963

Edited 1406784054
Hi Riley. Would there be a way to monitor performance or rate it some way on our end? Alot of the actual costs of doing stuff are somewhat opaque to us, and I wasn't aware of systematic threats. My 40k Campaign has about 120+ hand outs, and i'm adding more all the time because it is kind of a library the players refer to when figuring out how to beat various Xeno Races. Most of my games involve lots and lots of lore, with players trying to figure out how they all connect. I also use character sheets with maybe 100 fields on it. Each character is a character sheet though, and since i duplicate a template so that my basic generic macros work with all characters, and since we can't create 'simple' sheets yet. I have also have 2 scripts that run on chat events. I have two that run on Bar Changes (basically auto places little status icons when health/armor is depleted) that only run on the Token itself. So I think i'm good, but I only understood part of what you guys are talking about, so some validation on my set up would be appreciated. I've not noticed any horrible performance issues, but if there is something I could to do make it run better, that would be awesome.
1407250419

Edited 1407250508
Riley D. said: Keep in mind that the API is not able to ignore archived things the way your players can. So if you have a campaign with 30+ pages, even if half of them are archived, it's still going to eat through a lot of memory on the API side of things. Hey Riley, Right now I am dealing with this by creating a "Storage" Campaign where I move all my no-longer-needed pages, handouts, characters etc via the Transmogrifier. That Storage campaign is obviously getting pretty huge, but we never play in it, I just pull things in and out of it. Does the very existence of this huge Storage Campaign create an issue or is this a reasonable solution or guideline for the wiki for now? I could see the guideline being-- Active Data: Data you are planning to use in your next session Archived Data: Data you might use in your next session, but don't want to clutter the board Transmogrify/Storage Campaign: Data you don't want to delete, but have no plans to use in a future session. As I understand it so long as the Storage Campaign has no API Scripts associated with it it shouldn't cause any issues and should lessen the load on my main campaign, which does have API Scripts.
Just having the Storage Campaign is fine and has no bearing on it.
I am getting an error with the monster generator. TypeError: Cannot call method 'get' of undefined at Sandbox.<anonymous> (evalmachine.<anonymous>:570:36) at eval
You need to post in the thread where you got the script or message the person who wrote it.
sounds like the pathfinder hero lab importer. That script will crash if there is no attribute in an expected location, and doesnt handle animal companion/minions very well. If you can let me know what you were trying to import it might help
After checking the creature info I found a mistake in the format and after copy and pasting again I was able to get it to work out. Thank you for the help.