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

New API Update 5/23: Direct access to roll engine, random numbers

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

There's a new API Update out today. The main highlight of this update is:

Direct Access to the Roll Engine
You now have direct access to the results of chat commands, including rolls. You do this by passing a function which will receive the results of commands sent to the sendChat function. So instead of sending the chat results to the players, it gets passed to you immediately in the API sandbox. 

https://wiki.roll20.net/API:Chat

Random Numbers
We've also added the randomInteger() utility function which will allow you to generate a random number using the same PRNG that Roll20 uses to power our dice rolls. In addition for convenience the API's Math.random() function is now replaced with one that uses our PRNG, so even if you use Math.random() we can now guarantee that you are getting statistically sound random results.

https://wiki.roll20.net/API:Utility_Functions

More will be on the way soon!

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

Thanks Riley, looks good.

May 23 (12 years ago)
Konrad J.
Pro
API Scripter

Wow, awesome.  Now I will be getting even less sleep playing with this stuff tonight! :)