function rollDice() { const name = document.getElementById("name_entry"); const numDice = document.getElementById("num_dice"); const faces = document.getElementById("dice_faces"); const note = document.getElementById("dice_note"); if (conn == null || table == null) { setErr("Looks like you haven't joined a table yet."); return; } if (!name || name.value.length < 1) { setErr("Who are you? What's your name? Super brother?"); return; } if (numDice && faces && note) { const n = Number(numDice.value); const d = Number(faces.value); r = new Uint8Array(n); crypto.getRandomValues(r); const rolls = []; for (const i of r) { rolls.push(i%d + 1) } publish({diceRoll: { faces: d, roll: rolls, player: name.value, note: note.value, timestamp: new Date(), }}); } }