PDA

View Full Version : "Reskinning" dice results no longer working



Valarian
October 29th, 2019, 11:28
Ruleset: The One Ring
Issue: Custom result images not used.
The custom dice images defined in the gameelements.xml are not displayed when the results are shown.
This will affect other rulesets that customise the dice, such as Star Wars: Edge of the Empire, and Warhammer.


<root>
<distance>
<base>5</base>
<diagmult>1.5</diagmult>
<suffix>'</suffix>
</distance>

<!-- Hide Dice -->
<die name="dF" merge="delete"/>
<die name="d4" merge="delete"/>
<die name="d6">
<icon>d6icon</icon>
<menuicon>customdice</menuicon>
<position>220,-68</position>
</die>
<die name="d8" merge="delete"/>
<die name="d10" merge="delete"/>
<die name="d20" merge="delete"/>
<customdie name="d2" merge="delete"/>
<customdie name="d3" merge="delete"/>

<!-- Custom Dice for The One Ring -->
<!-- d12 -->
<die name="d12.1"><icon>d12icon.1</icon></die>
<die name="d12.2"><icon>d12icon.2</icon></die>
<die name="d12.3"><icon>d12icon.3</icon></die>
<die name="d12.4"><icon>d12icon.4</icon></die>
<die name="d12.5"><icon>d12icon.5</icon></die>
<die name="d12.6"><icon>d12icon.6</icon></die>
<die name="d12.7"><icon>d12icon.7</icon></die>
<die name="d12.8"><icon>d12icon.8</icon></die>
<die name="d12.9"><icon>d12icon.9</icon></die>
<die name="d12.10"><icon>d12icon.10</icon></die>
<die name="d12.11"><icon>d12icon.11</icon></die>
<die name="d12.12"><icon>d12icon.12</icon></die>

<!-- d6 -->
<die name="d6.1"><icon>d6icon.1</icon></die>
<die name="d6.2"><icon>d6icon.2</icon></die>
<die name="d6.3"><icon>d6icon.3</icon></die>
<die name="d6.4"><icon>d6icon.4</icon></die>
<die name="d6.5"><icon>d6icon.5</icon></die>
<die name="d6.6"><icon>d6icon.6</icon></die>
</root>


Fantasy Grounds Classic
29640

Fantasy Grounds Unity
29641

Issue: Custom dice results not recognised.
When rolling the dice through a custom dice handler, the results total for the dice is not being shown.


function onInit()
ActionsManager.registerResultHandler("dice", handleDiceLanded);
end

function handleDiceLanded(rSource, rTarget, rRoll)
local successes = 0;
local gandalfrune = false;
local eyeofsauron = false;
local add_total = true;
local total = 0;

local firstResult = 0;
local secondResult = 0;
local dicetable = rRoll.aDice;
if dicetable then
for n = 1, table.maxn(dicetable) do
if dicetable[n].type == "d12" and dicetable[n].result == 12 then
if User.isHost() then
total = total + 10;
else
total = total + 0;
end
gandalfrune = true;
elseif dicetable[n].type == "d12" and dicetable[n].result == 11 then
if User.isHost() then
total = total + 0;
else
total = total + 10;
end
eyeofsauron = true;
elseif dicetable[n].type == "d6" and dicetable[n].result == 6 then
successes = successes + 1;
total = total + 6;
else
total = total + dicetable[n].result;
end

dicetable[n].type = dicetable[n].type .. "." .. dicetable[n].result;

if User.isHost() then
if dicetable[n].type == "d12.11" then
dicetable[n].result = 10;
elseif dicetable[n].type == "d12.12" then
dicetable[n].result = 0;
end
else
if dicetable[n].type == "d12.11" then
dicetable[n].result = 0;
elseif dicetable[n].type == "d12.12" then
dicetable[n].result = 10;
end
end
end
end

total = total + ModifierStack.getSum();

local rMessage = ChatManager.createBaseMessage(rSource, rRoll.sUser);
rMessage.type = rRoll.sType;
rMessage.text = rMessage.text .. rRoll.sDesc;
rMessage.text = rMessage.text .. " [" .. successes .. " " .. Interface.getString("dice_label_tengwar") .. "]";
if gandalfrune then rMessage.text = rMessage.text .. " (" .. Interface.getString("dice_label_gandalf") .. ")"; end
if eyeofsauron then rMessage.text = rMessage.text .. " (" .. Interface.getString("dice_label_eye") .. ")"; end
rMessage.dice = rRoll.aDice;
rMessage.diemodifier = rRoll.nMod;

-- Check to see if this roll should be secret (GM or dice tower tag)
if rRoll.bSecret then
rMessage.secret = true;
if rRoll.bTower then
rMessage.icon = "dicetower_icon";
end
elseif User.isHost() and OptionsManager.isOption("REVL", "off") then
rMessage.secret = true;
end

-- Show total if option enabled
if OptionsManager.isOption("TOTL", "on") and rRoll.aDice and #(rRoll.aDice) > 0 then
rMessage.dicedisplay = 1;
end

Comm.deliverChatMessage(rMessage);
ModifierStack.reset();
return true;
end

Valarian
October 29th, 2019, 22:59
The workaround for The One Ring ruleset is to bypass the custom dice displaying the custom graphics for the Unity version.
The same workaround isn't going to work for Edge of the Empire and Warhammer as those are completely custom dice.



function onInit()
ActionsManager.registerResultHandler("dice", handleDiceLanded);
end

function handleDiceLanded(rSource, rTarget, rRoll)
local successes = 0;
local gandalfrune = false;
local eyeofsauron = false;

local dicetable = rRoll.aDice;
if dicetable then
for n = 1, table.maxn(dicetable) do
if dicetable[n].type == "d12" and dicetable[n].result == 12 then
gandalfrune = true;
elseif dicetable[n].type == "d12" and dicetable[n].result == 11 then
eyeofsauron = true;
elseif dicetable[n].type == "d6" and dicetable[n].result == 6 then
successes = successes + 1;
end

if Interface.getVersion() < 4 then
dicetable[n].type = dicetable[n].type .. "." .. dicetable[n].result;

if User.isHost() then
if dicetable[n].type == "d12.11" then
dicetable[n].result = 10;
elseif dicetable[n].type == "d12.12" then
dicetable[n].result = 0;
end
else
if dicetable[n].type == "d12.11" then
dicetable[n].result = 0;
elseif dicetable[n].type == "d12.12" then
dicetable[n].result = 10;
end
end
else
if User.isHost() then
if dicetable[n].type == "d12" and dicetable[n].result == 11 then
dicetable[n].result = 10;
elseif dicetable[n].type == "d12" and dicetable[n].result == 12 then
dicetable[n].result = 0;
end
else
if dicetable[n].type == "d12" and dicetable[n].result == 11 then
dicetable[n].result = 0;
elseif dicetable[n].type == "d12" and dicetable[n].result == 12 then
dicetable[n].result = 10;
end
end
end
end
end

local rMessage = ChatManager.createBaseMessage(rSource, rRoll.sUser);
rMessage.type = rRoll.sType;
rMessage.text = rMessage.text .. rRoll.sDesc;
rMessage.text = rMessage.text .. " [" .. successes .. " " .. Interface.getString("dice_label_tengwar") .. "]";
if gandalfrune then rMessage.text = rMessage.text .. " (" .. Interface.getString("dice_label_gandalf") .. ")"; end
if eyeofsauron then rMessage.text = rMessage.text .. " (" .. Interface.getString("dice_label_eye") .. ")"; end
rMessage.dice = rRoll.aDice;
rMessage.diemodifier = rRoll.nMod;

-- Check to see if this roll should be secret (GM or dice tower tag)
if rRoll.bSecret then
rMessage.secret = true;
if rRoll.bTower then
rMessage.icon = "dicetower_icon";
end
elseif User.isHost() and OptionsManager.isOption("REVL", "off") then
rMessage.secret = true;
end

-- Show total if option enabled
if OptionsManager.isOption("TOTL", "on") and rRoll.aDice and #(rRoll.aDice) > 0 then
rMessage.dicedisplay = 1;
end

Comm.deliverChatMessage(rMessage);
ModifierStack.reset();
return true;
end


Fantasy Grounds Classic
29667

Fantasy Grounds Unity
29668

Moon Wizard
October 31st, 2019, 23:51
Thanks for reporting. Filed as FGU-614.

JPG

Valarian
April 9th, 2020, 10:35
This is now resolved. I've renamed all the custom dice as per the fix in "<die> name no longer accepts period (https://www.fantasygrounds.com/forums/showthread.php?52853-lt-die-gt-name-no-longer-accepts-period&highlight=custom+dice)"