Valarian
October 29th, 2019, 11:06
Ruleset: The One Ring
Issue: onDoubleClick action not working
The onDoubleClick action defined for the skill on the character sheet doesn't work. The onDragStart action does.
function onDoubleClick(x,y)
local dieLabel = "";
local dieMod = 0;
if dieLabel and dieLabel ~= "" then
dieLabel = dieLabel .. " + " .. window.athleticslabel.getValue();
else
dieLabel = window.athleticslabel.getValue();
end
local weary = window.conditionweary.getState();
if weary then
ChatDice.wearyDiceCheck(getValue(), dieMod, dieLabel);
else
ChatDice.skillDiceCheck(getValue(), dieMod, dieLabel);
end
return true;
end
The code called by the double-click action builds the dice table and uses Comm.throwDice() to roll.
function skillDiceCheck(number, bonus, name)
if Comm then
local dice = {};
table.insert(dice, "d12");
for i = 1, number, 1 do
table.insert(dice, "d6");
end
Comm.throwDice("skilldice", dice, bonus, name);
end
end
I'm also experiencing the problem in the Yggdrasill ruleset, that builds up the dice directly in the char_attribute template onDoubleClick action.
function onDoubleClick(x,y)
local label = getName():gsub("^%l", string.upper);
local woundState = window.getDatabaseNode().getChild("hpstate");
local penalty = window.getDatabaseNode().getChild("hppenalty");
local type = "dice";
if woundState.getValue() == "Severely Wounded" then
type = "wounddice";
else
type = "skilldice";
end
local dice = {};
for i = 1, getValue(), 1 do
table.insert(dice, "d10");
end
Comm.throwDice(type, dice, penalty.getValue(), label);
return true;
end
Issue: onDoubleClick action not working
The onDoubleClick action defined for the skill on the character sheet doesn't work. The onDragStart action does.
function onDoubleClick(x,y)
local dieLabel = "";
local dieMod = 0;
if dieLabel and dieLabel ~= "" then
dieLabel = dieLabel .. " + " .. window.athleticslabel.getValue();
else
dieLabel = window.athleticslabel.getValue();
end
local weary = window.conditionweary.getState();
if weary then
ChatDice.wearyDiceCheck(getValue(), dieMod, dieLabel);
else
ChatDice.skillDiceCheck(getValue(), dieMod, dieLabel);
end
return true;
end
The code called by the double-click action builds the dice table and uses Comm.throwDice() to roll.
function skillDiceCheck(number, bonus, name)
if Comm then
local dice = {};
table.insert(dice, "d12");
for i = 1, number, 1 do
table.insert(dice, "d6");
end
Comm.throwDice("skilldice", dice, bonus, name);
end
end
I'm also experiencing the problem in the Yggdrasill ruleset, that builds up the dice directly in the char_attribute template onDoubleClick action.
function onDoubleClick(x,y)
local label = getName():gsub("^%l", string.upper);
local woundState = window.getDatabaseNode().getChild("hpstate");
local penalty = window.getDatabaseNode().getChild("hppenalty");
local type = "dice";
if woundState.getValue() == "Severely Wounded" then
type = "wounddice";
else
type = "skilldice";
end
local dice = {};
for i = 1, getValue(), 1 do
table.insert(dice, "d10");
end
Comm.throwDice(type, dice, penalty.getValue(), label);
return true;
end