STAR TREK 2d20
  1. #1
    Tommycore's Avatar
    Join Date
    Feb 2020
    Location
    Apocalyptic Utopia
    Posts
    48

    Accessing node attributes in Lua

    Hi folks.

    The dev guide is saying "Attributes are not accessible in this manner" (1). Looking if there is another way only brought up age old threads, and examining CoreRPG sourcecode didn't yield anything useful either, so I wanted to ask what the current status on that is: Is there a way to access node attributes in Lua, and if so, how would one go about it?


    Cheers!
    ___
    1 https://www.fantasygrounds.com/wiki/...s_from_Scripts

  2. #2
    To be more helpful, what are you attempting to try and access?
    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

  3. #3
    Tommycore's Avatar
    Join Date
    Feb 2020
    Location
    Apocalyptic Utopia
    Posts
    48
    Custom attributes. I know I can interact with a lot of the built in stuff like anchoring for controls etc. via getter and setter. But being able to leave multiple custom parameters for my scripts in a single self closing tag, instead of bloating up my node tree would be nice.

    Turning this:
    Code:
    <genericcontrol name="foo">
        <param1>These</param>
        <param2>Are</param>
        <param3>Parameters</param>
    </genericcontrol>
    into this:
    Code:
    <genericcontrol name="" param1="These" param2="Are" param3="Parameters" />
    Last edited by Tommycore; March 30th, 2020 at 17:37.

  4. #4
    Depending on the type of element you are using to store data within the code, they may save to the database. I would suggest checking over the reference document for the different element types and how to access them. If the data does get stored to the database, you can use lua to access the node in question. Here is a link for a break down of the code that may assist.

    https://www.fantasygrounds.com/refdoc/databasenode.xcp
    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

  5. #5
    Attributes are not converted into Lua variables; only tags are. So, the example in post 3 means that param1, param2 and param3 would not be available as variables within the Lua script.

    Regards,
    JPG

  6. #6
    Tommycore's Avatar
    Join Date
    Feb 2020
    Location
    Apocalyptic Utopia
    Posts
    48
    Thank you both =)

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 Product Walkthrough Playlist

Log in

Log in