PF2E Playlist
  1. #1
    Minty23185Fresh's Avatar
    Join Date
    Dec 2015
    NV, USA
    Blog Entries

    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
    function encodeRollForDrag(draginfo, i, vRoll)
       for k,v in pairs(vRoll) do
          if k == "sType" then
          elseif k == "sDesc" then
          elseif k == "aDice" then
          elseif k == "nMod" then
          elseif type(k) ~= "table" then
    The value of the argument, "v", in the setDieList(v) function call highlighted above is "{ #1 = s'd20' }".

    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:
    Bag of DM Helpers (extensions)
    Player: Curse of Strahd
    DM: Adventurers League, Season 2, Elemental Evil
    Community Contributions:
    Extensions: Bardic Inspiration, Druid Wild Shapes, Local Dice Tower, Library Field Filters
    Tutorial Blog Series: "A Neophyte Tackles the FG Extension".

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


  3. #3
    Minty23185Fresh's Avatar
    Join Date
    Dec 2015
    NV, USA
    Blog Entries
    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)

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 Classic

Log in

Log in