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
This post has been closed. You can still view previous posts, but you can't post any new replies.

Roll20 Dice Roller on external website?

1404941074
Nick S.
Pro
Marketplace Creator
Translator
Hello! I'm currently working on a website for DMs and Players alike, with tools, resources like maps and tiles and general information about the games. Being a great fan of Roll20, i was wondering if it'd be possible and i'm allowed to include the Dice Roller on my website, with proper credit and linking of course, in a way similar to the wiki . Also wondering if that uses the quantum roll or the old system. Thanks! Nick.
1404942828
Lithl
Pro
Sheet Author
API Scripter
It appears that the roll examples on the wiki are a combination of dengine.js and the following code in the page header: if ( window.mediaWiki ) { mediaWiki.loader.load(["mediawiki.util", "mediawiki.legacy.ajax", "ext.smw.sorttable", "ext.wikiEditor", "ext.wikiEditor.dialogs", "ext.wikiEditor.highlight", "ext.wikiEditor.preview", "ext.wikiEditor.publish", "ext.wikiEditor.previewDialog", "ext.wikiEditor.templates", "ext.wikiEditor.toolbar", "jquery.makeCollapsible"]); mediaWiki.loader.go(); } $(function() { var engine = d20.dice_engine(); var rollre = /\/((roll)|(r)|(gmroll)|(gr))[ ]+/i; $(".diceroller").on("keyup", function(e) { var $this = $(this); var origroll = $this.find("input").val().replace(rollre, ""); if(e.which == 13) { try{ engine.process(origroll, function(results) { if(results.error) { $(this).find(".results").html("<div class='alert alert-danger'>"+results.error+"</div>"); return; } var htmlcontent = d20.dice_formatter.getHtmlForResult(results); var attrs = { htmlcontent: htmlcontent, origRoll: origroll }; console.log(attrs); $this.find(".results").html($("#tmpl_chatmessage_newroll").jqote(attrs)); }); } catch (e) { console.log(e); $(this).find(".results").html("<div class='alert alert-danger'>Invalid roll! Check your formula and try again.</div>"); } } }); $(".diceroller").each(function() { var oldval = $(this).text(); $(this).html("<div class='results'></div><input type='text' /><small>Click in the box and press enter to roll the dice! You can also change the formula.</small>"); $(this).find("input").val(oldval); }); }); var d20 = {}; At a glance, dengine.js is creating its own RNG, not using Math.random or Quantum Roll, which suggests that it's the same RNG as used on the VTT prior to Quantum Roll.
1404948345
Nick S.
Pro
Marketplace Creator
Translator
Thanks for clearing that up Brian! Would you happen to know if it's possible to use it on an external site, and if there's a quantum roll alternative?
1404965029
Lithl
Pro
Sheet Author
API Scripter
Possible? You should be able to do it with just downloading dengine.js and using the code above (you can omit the mediaWiki bit at the start), plus jQuery. Permissible? I have no clue. =) I don't know exactly what Roll20 uses for Quantum Roll, but you could probably utilize the API on random.org so long as your request volume is low enough (IIRC you have to pay to use their API with higher traffic). It wouldn't be the same source of random used by Roll20, but it's still true randomness.
Nick, I'll respond to you about this via email since you contacted us via that method.