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

3D Dice don't work from sendChat command or randomInteger or inline

I would like to trigger 3D dice rolls from within an API script.  Calling sendChat("Player Name","/roll 1d100") works, but does not roll 3D dice. I tried passing a die roll in line to get the 3D dice to roll, that doesn't work Passing the character_id from a button on a custom sheet didn't work either !SKILL @{character_id} ART [[1d100]]   I also tried the asynchronous version of sendChat and that didn't work. randomInteger(100) does what it say on on the tin, and I wouldn't expect this function to roll 3D dice. I find it some what perplexing that I can't roll the 3D dice and pass the rolls to my API script as simple text parameters. Thanks for any help in advance - Jack.
Did you see the guidelines in the wiki for sendChat?&nbsp; <a href="https://wiki.roll20.net/API:Chat#sendChat.28speakingAs.2C_input_.5B.2Ccallback_.5B.2C_options.5D.5D_.29_.5BAsynchronous.5D" rel="nofollow">https://wiki.roll20.net/API:Chat#sendChat.28speakingAs.2C_input_.5B.2Ccallback_.5B.2C_options.5D.5D_.29_.5BAsynchronous.5D</a> If so, I don't see the {use3d:true} option added in your sendChat above.
1535509420
The Aaron
Pro
API Scripter
Just to further clarify what Kyle said, you can get 3d dice alongside your API script in 2 was: 1) With 3D Dice enabled, pass an inline roll as an argument to the API script: !do-things [[3d6]] Actually, that appears to be broken... reported to the devs. 2) With 3D Dice enabled, supply the option for use3d: true to your sendChat() call: sendChat("Name", "Rolling [[3d6]]", null, {use3d: true}); You cannot get 3d dice to be shown in the client if they aren't shown in the chat, so setting use3d: true and catching the return (a function in place of the null above) will not show dice to anyone. Additionally, if a user does not have 3d dice turned on, they will not be shown 3d dice.
1535532744

Edited 1535533033
Thanks I missed the {use3d : true} parameter, however the asynchronous sendChat functon still doesn't work correctly. This works and rolls the dice sendChat("Name", "Rolling [[3d6]]", null, {use3d: true}); However specifying a callback function as well turns off 3D dice &nbsp; &nbsp; sendChat("Jack", "Rolling [[1d100]]", function(ops) { &nbsp; &nbsp; // ops will be an ARRAY of command results. &nbsp; &nbsp; var rollresult = ops[0]; &nbsp; &nbsp; log("INNER SKILL FUNCTION CALLED"); &nbsp; &nbsp; //Now do something with rollresult, just like you would during a chat:message event... },{noarchive:false,use3d:true}); This form also fails and relies on an external function function skillroll(ops) { &nbsp; &nbsp; log("skill roll called") } &nbsp;sendChat("Jack", "Rolling [[1d100]]", skillroll, {use3d: true}); Substituting null for skillroll turns the 3D dice back on.