FG Spreadshirt Swag
  1. #1

    How to extract data from a dropped getShortcutData type of object?

    I was experimenting around with onDrop functionality - dragging things into a field that supported it and seeing what getShortcutData() gave me back.

    I would see things like this:

    -- charsheet
    -- shortcut = {charsheet:charsheet.id-00002}
    -- npc
    -- shortcut = {npc:reference.npcdata.aarakocra@DD MM Monster Manual}
    -- shortcut = {npc:combattracker.list.id-00005}
    -- item
    -- shortcut = {item:item.id-00001}
    -- shortcut = {reference_equipment:reference.equipmentdata.abacu s@DD PHB Deluxe}
    -- shortcut = {reference_mountsandotheranimals:reference.equipme ntdata.camel@DD PHB Deluxe}
    -- shortcut = {reference_armor:reference.equipmentdata.leather@D D PHB Deluxe}
    -- shortcut = {reference_weapon:reference.equipmentdata.club@DD PHB Deluxe}
    -- shortcut = {reference_magicitem:reference.magicitemdata.leath erarmorofacidresistance@DD Dungeon Masters Guide}

    Now I'm new to "link" logic in LUA and how to access it. Is there a document/example that actually details out how I can extract out specific information from these things?

    I looked at things using getShortcutData() in 5E and CoreRPG code but it made no sense to me. Things did not really seem to ever be trying to grab any specific data out that I could see.

    For example - I can see how I could define a node for things like charsheet.id-00002/combattracker.list.id-00005/item:item.id-00001 and find the data under those nodes in the DB - but what about things like all the reference* type of shortcuts? How do you extract that data?

    Maybe a dumb question - but I really don't see it. I get something dropped on me - I want to find the data for it - no matter where it was dropped from. Not seeing how some of that data extraction works.
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  2. #2
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,674
    Blog Entries
    1
    Search CoreRPG or 5E for

    draginfo.get

    See examples of all of these:
    getType()
    getDieList()
    getTokenData()
    getShortcutData()
    getDatabaseNode()
    getNumberData()
    getDescription()
    getStringData()
    getCustomData()
    getMetaDataList()
    getSlotType()
    getSecret()
    getSlotCount()

  3. #3

  4. #4
    Quote Originally Posted by damned View Post
    Search CoreRPG or 5E for

    draginfo.get

    See examples of all of these:
    getType()
    getDieList()
    getTokenData()
    getShortcutData()
    getDatabaseNode()
    getNumberData()
    getDescription()
    getStringData()
    getCustomData()
    getMetaDataList()
    getSlotType()
    getSecret()
    getSlotCount()
    All the stuff above I can actually see simply by doing Debug.console(dragInfo) which does not give me anything about the reference data. For example, if I drop an NPC into my field and print out the dragInfo I can see:

    DRAGDATA = { type = s'shortcut', desc = s'Aarakocra', #slots = #1, slot = #1, string = s'', num = #0, diceexpr = {}, shortcut = {npc:reference.npcdata.aarakocra@DD MM Monster Manual}, asset = {, instance = }, custom = nil }

    Which seems to be what all the functions you just listed are involved with. I am trying to get the data out of

    reference.npcdata.aarakocra@DD MM Monster Manual

    Or things like that. Looking at the functions you provided I don't see how to look up anything in the NPC sheet that is displayed if I actually use the link to bring up something instead of dropping it on my field.

    As I stated in my original message - if the shortcut is a DB reference then its simple - make it a DB node and go get data. But these reference things I don't understand how to extract the data out of. Where is the non-id name? The strength? Intelligence? Block of text describing attacks?

    You'll have to explain how these functions get me that as I'm not seeing it in examples. They just look like they are dragging things out of dragInfo - which is just a vehicle for transporting data - not the data itself. I want the data.
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  5. #5
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,674
    Blog Entries
    1
    reference.npcdata.aarakocra@DD MM Monster Manual

    is a npc in the Monster Manual
    you then have to lookup that record to find the other info you mention

  6. #6
    Quote Originally Posted by damned View Post
    reference.npcdata.aarakocra@DD MM Monster Manual

    is a npc in the Monster Manual
    you then have to lookup that record to find the other info you mention
    And we come full circle to my original post.

    How? Is there document/examples around that show this?
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  7. #7
    Maybe I've found something. I thought if I did not see the entry in my db.xml - DB.findNode() would not be able to find it.

    But apparently, it is more intelligent than I thought and can locate other .xml files outside of my campaign's db.xml.

    Code:
    	local sClass, sRecord = dragInfo.getShortcutData();
    
    	Debug.console(dragInfo);
    
    	local nodeSource = DB.findNode(sRecord);
    	Debug.console(nodeSource);
    	if not nodeSource then
    		local sRecordSansModule = StringManager.split(sRecord, "@")[1];
    		nodeSource = DB.findNode(sRecordSansModule .. "@*");
    		Debug.console(nodeSource);
    		if not nodeSource then
    			return false;
    		end
    	end
    Apparently it returns a db node in my experiment above when dropping reference.npcdata.aarakocra@DD MM Monster Manual type of data. So if that is the case, then I know how to extact the data once I figure out the XML tags to use.
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
DICE PACKS BUNDLE

Log in

Log in