SWADE Playlist
  1. #1

    Error message when attempting to call ChatManager.throwDice

    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:
    Code:
    function onDoubleClick(x, y)
         window.rollDice();
    end
    In the script file attached to this item, rollDice() is defined thusly:


    Code:
    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:
    Code:
    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!

  2. #2
    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

  3. #3
    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!
    Code:
                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
    Last edited by cscase; September 16th, 2013 at 04:10.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
DMsGuild

Log in

Log in