-
January 13th, 2021, 18:04 #1
Accessing the Builtin Magics of the dragdata Object
I am working through the settings of a dragdata object for a Skill die dragged into the Dice Tower.
I have come across some behind the scenes (builtin?) functionality that I need help with.
Here is a code snippet from ...\rulesets\CoreRPG\scripts\manager_actions.lua
Code:function encodeRollForDrag(draginfo, i, vRoll) for k,v in pairs(vRoll) do if k == "sType" then draginfo.setSlotType(v); elseif k == "sDesc" then draginfo.setStringData(v); elseif k == "aDice" then draginfo.setDieList(v); elseif k == "nMod" then draginfo.setNumberData(v); elseif type(k) ~= "table" then ...
Yet, if I do a draginfo.getDieList() the value that is returned is " { #1 = { s'type' = s'd20' }, s'expr' = s'd20' }".
Put one thing in the box, if you pull it back out of the box it has morphed into something completely different. Is there a way for me to access these "magics"?Current Projects:
Always...
Community Contributions:
Extensions: Bardic Inspiration, Druid Wild Shapes, Local Dice Tower, Library Field Filters
Tutorial Blog Series: "A Neophyte Tackles (coding) the FG Extension".
-
January 15th, 2021, 23:28 #2
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,559
No, there is no mechanism for that. The return value will always be the same in FGU for consistency (it was not in FGC, and varied depending on the what phase the roll was in). The input values can be in the old style or the new style for backward compatibility.
Basically, the FGU system treats all "dice" values as dice expressions; so any individual dice passed in are converted to a dice expression string.
Regards,
JPG
-
January 16th, 2021, 19:23 #3
Thank you Moon Wizard, I appreciate your time and your response.
Incidentally, for anyone that cares, I have implemented this functionality in my pseudo dragData object, though I haven't published it yet. I wish to do a little more testing with FGU. To have it work properly I tested various string inputs, e.g. "d20", "d12", "d7", etc. plus others like "2d6", "12d8", "2d4 + 3", "d10 + 4", etc. If the string is not of the simplest form "dN" where N is a whole number, the string that was input is the string you get back out. Makes sense: garbage in, garbage out.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks