Starfinder Playlist
Page 1 of 2 12 Last
  1. #1

    Which Function to call for FGU complex dices rolls

    Hi there,
    does anybody know which function I need to call to process complex dice strings like e.g. 4d6d2?

    It works just fine as described here if I type the string "/die 4d6d2" into the chat window. I would like to use the same function which captures this string from the chat for rolls initiated from a field on the character sheet.

  2. #2
    LordEntrails's Avatar
    Join Date
    May 2015
    -7 UTC
    Blog Entries
    Using dice expressions is dependent upon the ruleset and charactersheet being updated to allow it. I don't know of any rulesets that have yet been modified to allow for dice expressions to be used directly on the character sheet. But I pretty much only use 5E.

  3. #3
    EDIT: Moved to Workshop forum.

    Until the most recent update, there was no way to call the built-in dice expression handler other than calling the Comm.activateSlashCommand API. The Comm.throwDice API did not accept expressions directly; and you would have to build out all the details for each dice and each set.

    With the most recent update, any Comm.throwDice calls will now rebuild the individual dice entries for you, if dice.expr is set in the table passed to Comm.throwDice, and no individual dice are specified.
    local rThrow = { type = "dice", description = "COMPLEX ROLL", slots = { #1 = { dice = { expr = "4d6d2" }, number = 0 } } };

    Also, I updated the ActionsManager global script in CoreRPG used by many layered rulesets to pass through roll tables that do not specify individual dice
    local rRoll = { sType = "dice", sDesc = "COMPLEX ROLL", aDice = { expr = "4d6d2" }, nMod = 0 };
    ActionsManager.performAction(nil, nil, rRoll);


  4. #4
    AWESOME! Exactly what I was looking for! Thank you so much, you are a wizard!

  5. #5
    damned's Avatar
    Join Date
    Mar 2011
    Blog Entries
    i was able to get the second version working - thanks guys.

    MoreCore - Generic Ruleset
    --- Projects ---
    Extensions | Tutorials | MoreCore | MoreCore Themes | Call of Cthulhu | Maelstrom | FG Con

  6. #6
    Me too. The first gave me an error.

  7. #7
    I do it this way as it helps keep things organized, plus derived from scripts\manager_actions.lua for the first example provided.

    local rThrow = {};
    local rSlot = {};
    local sExpr = "4d6d2";

    rThrow.type = "dice";
    rThrow.description = "COMPLEX ROLL";
    rSlot.dice = { sExpr }
    rThrow.slots = { rSlot };

    How to provide an Unity Connection issue?-Connection Issues and What to Provide

    Unity Updater issue?-Updater Issues

    Classic and Unity Port Forwarding?-Fantasy Grounds Connections Explained

    Comcast or Cox ISP User?-Comcast XFinity and Cox Users

    Have a suggestion?-Idea Informer

  8. #8
    I believe it needs to be:
    rSlot.dice = { expr = sExpr }


  9. #9
    Wonderful, thank you!

  10. #10
    Hello again,

    I do have a slight Problem. ActionsManager.performAction(nil, nil, rRoll) on the Charaktersheet. With the new complex roll fromula. It is working well, but on the dragstart it rolls the dice instantly. I cant drop the dice on the board any more. (see below)
    I would like to drag the dice to the chatboard or the dicetower to drop them there.

    If I use
    local rThrow = { type = "dice", description = sAbility, slots = { #1 = { dice = { expr = nRollText }, number = 0 } } };
    i receive the following Error
    [ERROR] Failed to load script buffer (char_abilities): [string "char_abilities"]:32: '}' expected near '='

    		function onDragStart(button, x, y, draginfo)
    				local nDiceTest = dicetest.getValue();
    				local nDiceBonus = 0;
    				local nUropDiceMod = maindicemod.getValue();
    				local sAbility = name.getValue()
    				if name.isEmpty() and nDiceTest == 0 then
    					return nil;
    				local nRollText = "";
    				nRollText = nDiceTest.."d6";
    					if nUropDiceMod > 0 then
    					nRollText = nRollText.."+"..nUropDiceMod;
    				local rRoll = { sType = "dice", sDesc = sAbility, aDice = { expr = nRollText }, nMod = 0 };
    				ActionsManager.performAction(nil, nil, rRoll);
    				--UropRolls.controlRoll(nDiceTest, nDiceBonus, sAbility, nUropDiceMod, draginfo);
    				return true;
    			function onDrop(x, y, draginfo)
    				local sDragType = draginfo.getType();
    				if sDragType == "dice" then
    					local aDropDice = draginfo.getDieList();
    					for _,vDie in ipairs(aDropDice) do
    					return true;

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

Log in

Log in