STAR TREK 2d20
  1. #1

    FGU Updates (2020.10.30) docs?

    Would it be possible to get param/vars expected for:

    [DEV] Added API functions: Interface.getAssetSize, generriccontrol.getAsset, genericcontrol.setAsset
    [DEV] Added API handlers: DB.onExport

    I've tried a few different things for interface.getAssetSize() but not having any luck...


    and im curious what is DB.onExport()'s purpose? I'm guessing to hook into the export process so you dont have to overwrite the corerpg version?
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  2. #2
    Interface.getAssetSize(assetKey) - Same information stored in draginfo.getTokenData, databasenode.getText (for image value and token value).

    genericcontrol.getAsset()/setAsset(assetKey) - Same as above.

    DB.onExport - There was already a handler for onImport; and I was adding the other export pieces, so I added onExport. Example in CoreRPG.

    Regards,
    JPG

  3. #3
    Quote Originally Posted by Moon Wizard View Post
    Interface.getAssetSize(assetKey) - Same information stored in draginfo.getTokenData, databasenode.getText (for image value and token value).

    genericcontrol.getAsset()/setAsset(assetKey) - Same as above.

    DB.onExport - There was already a handler for onImport; and I was adding the other export pieces, so I added onExport. Example in CoreRPG.

    Regards,
    JPG
    Not having any luck with getAssetSize(). Tried various things to see if I could get something...

    Code:
    Code:
        Debug.console("manager_author_adnd.lua","createBlockImage","nodeImage",nodeImage);          
        Debug.console("manager_author_adnd.lua","createBlockImage","sImageAsset",sImageAsset);     
        Debug.console("manager_author_adnd.lua","createBlockImage","Interface.getAssetSize(nodeImage)",Interface.getAssetSize(nodeImage));          
        Debug.console("manager_author_adnd.lua","createBlockImage","Interface.getAssetSize(nodeImage.getText())",Interface.getAssetSize(nodeImage.getText()));          
        Debug.console("manager_author_adnd.lua","createBlockImage","Interface.getAssetSize(sImageAsset)",Interface.getAssetSize(sImageAsset));
    Output:
    Code:
    [10/30/2020 1:35:17 PM] s'manager_author_adnd.lua' | s'createBlockImage' | s'nodeImage' | databasenode = { image.id-00002 }
    [10/30/2020 1:35:17 PM] s'manager_author_adnd.lua' | s'createBlockImage' | s'sImageAsset' | s'image.id-00002.image'
    [10/30/2020 1:35:17 PM] s'manager_author_adnd.lua' | s'createBlockImage' | s'Interface.getAssetSize(nodeImage)' | #0 | #0
    [10/30/2020 1:35:17 PM] s'manager_author_adnd.lua' | s'createBlockImage' | s'Interface.getAssetSize(nodeImage.getText())' | #0 | #0
    [10/30/2020 1:35:17 PM] s'manager_author_adnd.lua' | s'createBlockImage' | s'Interface.getAssetSize(sImageAsset)' | #0 | #0
    ----
    [10/30/2020 1:35:17 PM] s'manager_author_adnd.lua' | s'createBlockImage' | s'nodeImage' | databasenode = { image.id-00001@B2: THe Keep on the Borderlands (HighRes) }
    [10/30/2020 1:35:17 PM] s'manager_author_adnd.lua' | s'createBlockImage' | s'sImageAsset' | s'image.id-00001@B2: THe Keep on the Borderlands (HighRes).image'
    [10/30/2020 1:35:17 PM] s'manager_author_adnd.lua' | s'createBlockImage' | s'Interface.getAssetSize(nodeImage)' | #0 | #0
    [10/30/2020 1:35:17 PM] s'manager_author_adnd.lua' | s'createBlockImage' | s'Interface.getAssetSize(nodeImage.getText())' | #0 | #0
    [10/30/2020 1:35:17 PM] s'manager_author_adnd.lua' | s'createBlockImage' | s'Interface.getAssetSize(sImageAsset)' | #0 | #0
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  4. #4
    I added this line to ref_blocklayoutmanager.lua:Line 57:
    Debug.chat("ASSET SIZE", sAsset, Interface.getAssetSize(sAsset));

    This returned this message in the chat box when I opened the 5E PHB reference manual:
    s'ASSET SIZE' | s'images/Cover.jpg@DD PHB Deluxe' | #1000 | #700

    Regards,
    JPG

  5. #5
    Quote Originally Posted by Moon Wizard View Post
    I added this line to ref_blocklayoutmanager.lua:Line 57:
    Debug.chat("ASSET SIZE", sAsset, Interface.getAssetSize(sAsset));

    This returned this message in the chat box when I opened the 5E PHB reference manual:
    s'ASSET SIZE' | s'images/Cover.jpg@DD PHB Deluxe' | #1000 | #700

    Regards,
    JPG
    What object allows you to reference down to the image object (sAsset above) from the image record (image.id-XXXX)? I tried various things on my own but have not managed to come across anything that does that. If there is some example code I can review in CoreRPG let me know. I did a search but didnt find anything that I could figure it out from after experimentation.
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  6. #6
    There's an example in line 55 of the ref_blocklayoutmanager.lua file.

    JPG

  7. #7
    Quote Originally Posted by Moon Wizard View Post
    There's an example in line 55 of the ref_blocklayoutmanager.lua file.

    JPG
    Thats the example I found and tested with no positive results. Here is what I tried.

    Code:
          local w = Interface.openWindow("imagewindow",nodeImage);
          if w then 
            local sAsset = DB.getText(w.getDatabaseNode(), "image", "");
    
            Debug.console("manager_author_adnd.lua","createBlockImage","w.getDatabaseNode()",w.getDatabaseNode());             
            Debug.console("manager_author_adnd.lua","createBlockImage","sAsset",sAsset);             
            Debug.console("manager_author_adnd.lua","createBlockImage","Interface.getAssetSize(sAsset)",Interface.getAssetSize(sAsset));   
    ...
    Log from above
    Code:
    11/1/2020 1:30:17 PM] s'manager_author_adnd.lua' | s'createBlockImage' | s'w.getDatabaseNode()' | databasenode = { image.id-00001@B2: THe Keep on the Borderlands (HighRes) }
    [11/1/2020 1:30:17 PM] s'manager_author_adnd.lua' | s'createBlockImage' | s'sAsset' | s''
    [11/1/2020 1:30:17 PM] s'manager_author_adnd.lua' | s'createBlockImage' | s'Interface.getAssetSize(sAsset)' | #0 | #0
    sAsset is always '' no matter what image record I load.
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  8. #8
    The getText will only return a value if there is a single image layer in the image value. If you have more than one image layer, then it will return empty string.

    Regards,
    JPG

  9. #9
    Quote Originally Posted by Moon Wizard View Post
    The getText will only return a value if there is a single image layer in the image value. If you have more than one image layer, then it will return empty string.

    Regards,
    JPG
    So if the source has LOS/effects/etc layers it'll not work? (This appears to be my experience so far but I also have multi-layer map). If so... Unfortunately this means I won't be able to have inline ref-man from maps linked any longer in FGU?

    I've also just noticed that if the source has any XML escape characters it causes problems because it doesn't match the module name. My guess is previously FGC did not require escape versions of specific XML characters in formatted text links. It looks like DB.findNode() doesn't resolve XML escapes such as "&".

    After knowing the above 2 issues I was able to get a simple image to give me asset and the w/h.
    Last edited by celestian; November 2nd, 2020 at 18:17.
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

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
  •  
5E Character Create Playlist

Log in

Log in