PDA

View Full Version : Error message when attempting to call ChatManager.throwDice



cscase
September 15th, 2013, 22:10
Working on getting the stuff I set up for live to work with 3.0, and I'm running into something I don't understand. This may be more of a Workshop type question, as I don't doubt that it is more of a problem with something I'm doing than with 3.0 itself.

I am set up so that if a skill is doubleclicked, this function is called:

function onDoubleClick(x, y)
window.rollDice();
end

In the script file attached to this item, rollDice() is defined thusly:



function rollDice()
local desc = label.getValue();
ChatManager.throwDice("dice",{"d6"},0,desc);
end


This worked fine in 2.9.4, but in 3.0 it elicits an error:
Script Error: [string "campaign/scripts/charsheet_skilllistitem.lu..."]:17: attempt to call field 'throwDice' (a nil value)


I'm working with the CoC ruleset over Core. ChatManager is defined in Core, and in there, throwDice() is as follows:


function throwDice(type,dice,bonus,desc,customData)
if control then
control.throwDice(type,dice,bonus,desc,customData) ;
end
end

Can anyone point me in the right direction? Part of this may be that I'm not sure how to correctly interpret the error message.

Thanks!

Moon Wizard
September 15th, 2013, 22:24
The Call of Cthulhu ruleset on v3.0 has been rewritten to layer on top of the CoreRPG ruleset in order to bring it up to parity with other rulesets. So, ChatManager.throwDice no longer exists in CoC in v3.0.

Regards,
JPG

cscase
September 16th, 2013, 03:06
Aha, thanks!

I found some code elsewhere in the ruleset and made a couple small changes. I confess don't entirely understand it, but it seems to work!

function action(draginfo)
local nodeWin = window.getDatabaseNode();
if nodeWin then
local sSkill = window.label.getValue();
local nTotal = getValue();


local rActor = ActorManager.getActor("pc", nodeWin.getChild("..."));
local sDesc = "[SKILL] " .. sSkill;
local rRoll = { sType = "skill", sDesc = sDesc, aDice = {"d6"}, nMod = 0 };
ActionsManager.performAction(draginfo, rActor, rRoll);
end


return true;
end

function onDragStart(button, x, y, draginfo)
return action(draginfo);
end


function onDoubleClick(x,y)
return action();
end