Putting Doubleclickable Dicerolls into Extensions
From FGWiki
Okay, I think I've now got this working ...
In the extension.xml, register the script as another name
Code:
<script name="ChatDice" file="scripts/chatdice.lua" />Put the dice rolling routines in a separate script file (called chatdice.lua). Call "ChatManager.control" rather than just "control".
Code:
-- Joshuha - Auto Dice Rolling --
function dieCheck(type, bonus, name) if ChatManager.control then local dice = {}; table.insert(dice, type); ChatManager.control.throwDice("dice", dice, bonus, name); end end
-- Ian M Kirby - Added die roller for multiple dice
function diceCheck(number, type, bonus, name) if ChatManager.control then local dice = {}; for i = 1, number, 1 do table.insert(dice, type); end ChatManager.control.throwDice("dice", dice, bonus, name); end end
When calling the code, use ChatDice rather than ChatManager.
Code:
ChatDice.diceCheck(2, "d6", dieMod + getValue(), dieLabel);
Discovery by Valarian.

