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

looking for some help modifing a api script.

i am triing to modify a script and have it roll a roll automatically. sorry idk how to post in a more legible way. the bold part is the line in question and the underlined section of that part is the roll i am attempting to achieve. /* jshint undef: true */ /* globals  sendChat,  randomInteger,  _,  on  */ var MFumble = (function() { 'use strict'; const Mfumble = [     {low: 1, high:   50, result: "Brilliant Recovery", effect: "No Fumble, Lucky You."},     {low: 51, high:  98, result: "Brilliant Recovery", effect: "No Fumble, Lucky You."},            {low: 99, high:  100, result: "Wild Surge", effect: "your magic goes awry consult wild surge table 1d10000 ."},     ]; function registerEventHandlers() { on('chat:message', MFumble.handleChatMessage); } /** * Grab chat message objects * * @param {object} msg */ function handleChatMessage(msg) { // Check if we are dealing with a !magicfumble command. if (msg.type === "api" && msg.content.indexOf("!Mfumble") !== -1) { var content = msg.content; var words = content.split(' '); // Sanity check if (words.length > 0) { // Sanity check if (words[0] === '!Mfumble') { var rolled = 0; // Was a roll amount given? If so parse the second "word" as an int, otherwise create a randomInteger. if (words.length === 2) { rolled = parseInt(words[1]); } else { rolled = randomInteger(100); } // Sanity check if (typeof rolled !== 'number' || rolled === 0) { rolled = randomInteger(100); } // Get the smack object as a smash variable var smash = MFumble._determineMFumble(rolled); // Sanity check if (smash) { // Send the critical result as a formatted string in chat sendChat('Magic Fumble', rolled.toString() + "% <b>" + smash.result + "</b><br><i><b>Effect: </b>" + smash.effect +"</b><br><i><b>Other: </b>" + smash.other + '</i>'); } else { sendChat('MFumble', 'Invalid % roll given, or something went wrong. GM makes something up.'); } } } } } /** * Internal function given the roll value returns the object indicating the result and effect. * * @param {int} roll * @return {object} smack * @private */ function _determineMFumble(roll) { // Use _.find to figure out what happened. return _.find(Mfumble, function (hit) { return (roll >= hit.low && roll <= hit.high); }); } return { registerEventHandlers: registerEventHandlers, handleChatMessage: handleChatMessage, _determineMFumble: _determineMFumble } }()); /**  * Fires when the page has loaded.  */ on("ready", function() { MFumble.registerEventHandlers(); });
1547950625
The Aaron
Roll20 Production Team
API Scripter
Try changing it to say [[1d100000]] and see if that works.  The code formatting is in the magic wand button at the top left when editing.