-
October 16th, 2020, 13:58 #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.
-
October 16th, 2020, 17:39 #2
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.
Problems? See; How to Report Issues, Bugs & Problems
On Licensing & Distributing Community Content
Community Contributions: Gemstones, 5E Quick Ref Decal, Adventure Module Creation, Dungeon Trinkets, Balance Disturbed, Dungeon Room Descriptions
Note, I am not a SmiteWorks employee or representative, I'm just a user like you.
-
October 16th, 2020, 21:11 #3
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,557
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
-
October 16th, 2020, 21:45 #4
AWESOME! Exactly what I was looking for! Thank you so much, you are a wizard!
-
October 18th, 2020, 09:37 #5
i was able to get the second version working - thanks guys.
-
October 21st, 2020, 09:10 #6
-
October 21st, 2020, 14:42 #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);Dominic Morta
Ruleset Developer
Smiteworks
How to zip up your campaign if the Developers ask for it-How to zip up your campaign if the Developers ask for it
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?-Feature Request
-
October 22nd, 2020, 02:56 #8
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,557
I believe it needs to be:
rSlot.dice = { expr = sExpr }
JPG
-
October 23rd, 2020, 12:32 #9
Grand Templar
- Join Date
- Sep 2008
- Posts
- 274
Wonderful, thank you!
-
October 23rd, 2020, 16:42 #10
Grand Templar
- Join Date
- Sep 2008
- Posts
- 274
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 useCode:local rThrow = { type = "dice", description = sAbility, slots = { #1 = { dice = { expr = nRollText }, number = 0 } } }; Comm.throwDice(rThrow);
[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)
Bookmarks