
As part of my self-learning, I'm using this code in one of my scripts. It seems to work, but something weird has happened: //Rolling crossfire dice, 5 to hit or affect (in the case of anti-armour home brew rules) on("chat:message", function(msg) { //This allows players to enter !r5 <number> to roll a number of d6 dice with a target of 5 or 6. if(msg.type == "api" && msg.content.indexOf("!r5 ") !== -1) { var numdice = msg.content.replace("!r5 ", ""); sendChat("Crossfire Roll: ", numdice + ' dice, 5 or 6 is a "hit"'); sendChat(msg.who, "/roll " + numdice + "d6>5", null, {use3d: true}); } }); I adapted this from the Chat Event Example (Implementing Custom Roll Type) at: <a href="https://roll20.zendesk.com/hc/en-us/articles/360037256754#API:Chat-ChatEventExample(ImplementingCustomRollType)" rel="nofollow">https://roll20.zendesk.com/hc/en-us/articles/360037256754#API:Chat-ChatEventExample(ImplementingCustomRollType)</a> I need to alter the first sendChat to avoid a double colon, but that's peanuts to fix. Issue #1 - 3d Dice Display Different From Text Chat This screenshot shows the the results of entering !r5 4. The dice dice roll is 4, 1, 4, 5, with the 5 circled in red. But the text chat side window shows 4, 1, 4, 4 circled in red. It has worked very well up until the result below, and subsequent entry of !r5 4 and !r5 <other numbers> work as expected. I've repeated the !r5 4 entry a couple dozen times and can't reproduce a similar error as above. Can I write this off as a blip in the roll20 server, do you think? Or is there something off in my script, above? EDIT: Jeez, no, it just happened again. The documentation, quoted below, seems to suggest this is a new function for sendChat. There must be a bug of sorts, I think. Or would the bug be with the /Roll x d6>5 statement, I wonder? Issue #2 - 3d Dice Colour You can see in the above screen shot that the dice are white. This is not a show stopper by any means, but it would be nice to have them roll in a player's assigned/chosen colour. According to the documentation following the above link, describing the use3d parameter for the options part of sendChat command: use3d -- You can now generate 3D Dice rolls using the sendChat() function. The syntax is simply: sendChat("Name", "Rolling [[3d6]]", null, {use3d: true}); If you pass a player ID to the name parameter, such as sendChat("player|-ABC123",...) the player's color will be used for the dice. Otherwise a default white color will be used. :) (Silly Americans, when will you learn to use U in your spelling!) :) It's a pity that the second sendChat name parameter, which is msg.who (see code above) is not sufficient. It would appear that I'd need to use a second variable, perhaps named strName, that is defined by a switch block that assigns the player operator in the above quote, with the default being msg.who. Would that work, do you think? It seems very cumbersome.