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
    Location
    -7 UTC
    Posts
    12,815
    Blog Entries
    9
    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.
    Ex:
    local rThrow = { type = "dice", description = "COMPLEX ROLL", slots = { #1 = { dice = { expr = "4d6d2" }, number = 0 } } };
    Comm.throwDice(rThrow);

    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
    Ex:
    local rRoll = { sType = "dice", sDesc = "COMPLEX ROLL", aDice = { expr = "4d6d2" }, nMod = 0 };
    ActionsManager.performAction(nil, nil, rRoll);

    Regards,
    JPG

  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
    Location
    Australia
    Posts
    22,422
    Blog Entries
    1
    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 };

    Comm.throwDice(rThrow);
    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 }

    JPG

  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
    Code:
    local rThrow = { type = "dice", description = sAbility, slots = { #1 = { dice = { expr = nRollText }, number = 0 } } };
    				Comm.throwDice(rThrow);
    i receive the following Error
    [ERROR] Failed to load script buffer (char_abilities): [string "char_abilities"]:32: '}' expected near '='



    Code:
    		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;
    				end
    				local nRollText = "";
    				nRollText = nDiceTest.."d6";
    					if nUropDiceMod > 0 then
    					nRollText = nRollText.."+"..nUropDiceMod;
    					end
    				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;
    			end
    			
    			function onDrop(x, y, draginfo)
    				local sDragType = draginfo.getType();
    				if sDragType == "dice" then
    					local aDropDice = draginfo.getDieList();
    					for _,vDie in ipairs(aDropDice) do
    						dice.addDie(vDie.type);
    					end
    					return true;
    				end
    			end

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