
I have a couple of different scripts which use sendChat() to output a series of rolls. In both cases, I notice that the order of the chats as they appear in the game is different than the order in which they are sent out from the script. For instance, the following snippet is from a script for the Empowered Spell sorcerer ability in D&D 5e (and please forgive the shitty javascript! I'm very new to this) newRoll = randomInteger(rolls[diceGroup].sides);
rolls[diceGroup].results[dieNumber - 1].v = newRoll;
sendChat("empower", "New die roll: [[" + newRoll + "]]");
sendChat("empower", "New result: " + calculateResult(rolls));
sendChat("empower", "You have " + empowersRemaining + " uses of empower left.");
calculateResults traverses the msg.inlinerolls[0].results.rolls object and returns a string of type "[[a + b + c ...]]" a,b,c, etc are the individual dice values. Here is a sample of the output for this script on a few iterations: empower: Rerolling die number 3 from 3d6
You have 4 uses of empower left.
New die roll: 6
New result: 15
Rerolling die number 2 from 3d6
You have 3 uses of empower left.
empower: New result: 14
New die roll: 3
Rerolling die number 2 from 3d6
You have 2 uses of empower left.
New die roll: 5
New result: 16
Any thoughts? (And yes, in this script I'm actually not using sendChat to perform any die rolls — I'm simply using the [[]] arithmetic because it is visually consistent with the original damage output and allows the players to see the individual dice adding up to a result.) thanks so much!