Starfinder Playlist
  1. #1
    Oberoten's Avatar
    Join Date
    May 2006
    Location
    Älvsbyn, Sweden
    Posts
    2,493

    Question Target DC on the Desktop?

    I have been looking at creating control like the modifier-box on the desktop. One which in turn would contain a DC and be accessible for automated rolls of various kinds.

    I have tried by copying the modifierstack code but it fails at
    Code:
    function registerControl(ctrl)
        control = ctrl;
    end
    Can I do just a simple numbercontrol and register it somehow so I can reach it the same way I'd pull numbers from the Modifier? (And if so, how? )


    - Obe
    For your Ars Magica needs :
    https://fgrepository.com




    Atque in perpetuum frater, Ave atque vale.

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    34,731
    See some info on panels here: https://www.fantasygrounds.com/wiki/...terface#Panels

    Attached is an example of a desktop panel where you can enter a number in the desktop panel.

    The code currently stores the number entered in the database and syncs across all clients - you could change that to just store the number locally on each FG instance.

    You'd then have to create a global script package (like ModifierStack) so that you can register the desktop panel control in the package and then get access to that package during your actions. The package can use the registered control to access the desktop panel and get the DC number stored in the control. This is really all you'll be using the global script package for - to give access to the control from your action script, so that it action script can access the DC stored in the control.

    Look at how the <windowclass name="modifierstack"> section in CoreRPG registers the control in the ModifierStack global script package. And how the register and unregister happens in modifierstack.lua - note that control is actually a local variable declared at the stop of the script file - it is here that the reference to the desktop panel control will be stored when it is registered. This allows future function calls into this package to get access to the desktop panel control.

    You could then write a function (perhaps getDCValue) in your global script package that uses control.examplenumber.getValue() to get the value stored in the examplenumber number control in the desktop panel registered in control

    Sounds complex? But, it's actually not that bad. The code in the end will be only a few lines. Sorry I don't have exactly what you need - but it's pretty close...
    Attached Files Attached Files
    FG Wiki: How to Compile the FG Logs

    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  3. #3
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    34,731
    Here's a better example - it does all what I mentioned in the previous post.

    There is example code in the onDoubleClick event of the number control showing how to call the global package to get the number.

    Enter a DC in the control, then double-click it to see the value written to the chat window.
    Attached Files Attached Files
    FG Wiki: How to Compile the FG Logs

    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  4. #4
    Oberoten's Avatar
    Join Date
    May 2006
    Location
    Älvsbyn, Sweden
    Posts
    2,493
    screenshot0009.png

    Thank you for a very nice example file to go over. It always helps to have the functions more isolated. I was close with what I was persuing and trying from the modifierstack, and probably failed mostly by the fact that I was delving into the wrong (and for my use of this irrelevant) parts of the code.

    Compared, this was understandable and quite a bit easier to wrap my mind (and my own code) around. Once again Trenloe, you are a rock & you rock.

    - Obe
    For your Ars Magica needs :
    https://fgrepository.com




    Atque in perpetuum frater, Ave atque vale.

  5. #5
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    34,731
    No worries. It looks good on the desktop!
    FG Wiki: How to Compile the FG Logs

    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

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
  •  
Refer a Friend

Log in

Log in