Dungeons & Dragons 2024 Core Rulebooks Pre-Order
  1. #1

    Change my value from an another field

    Hello everyone,
    from my field A, I know change an another value (B for example) when the Field's value A change with "OnValueChanged".
    But I try to do the opposite : from my value A, I want that this value change when an another value change (I don't want use "OnValueChanged" on this another field.)
    Is there a function like 'OnSourceChanged" ?
    I see in 3.5 template_char some templates with "<source>...</source><op>+</op>".Is the good way ?
    Thanks for your help.

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Colorado, USA
    Quote Originally Posted by stany View Post
    Is there a function like 'OnSourceChanged" ?
    Yes, but you need to create the event handler for onValueChanged on the FG control you want, using the GUI hierarchy, e.g. if your control is called "mydatafield" then you can access that in the current window with window.mydatafield and then write a handler function look at onValueChanged on that control, e.g. window.mydatafield.onValueChanged = myCustomOnValueChangedFunction

    See "Handler Functions" at the bottom of this page here: https://www.fantasygrounds.com/modguide/scripting.xcp The example given is creating a sourceUpdate function for a different database node.

    Quote Originally Posted by stany View Post
    I see in 3.5 template_char some templates with "<source>...</source><op>+</op>".Is the good way ?
    This will add the contents of the <source> database node together with other <source> database nodes. Or, if there is just one <source> entry, it will essentially link the field directly to that database node. So, if you want to add (or subtract) data from database fields or link to a single database field, then this is a good way to go.
    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
    thanks for your help !

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
FG Spreadshirt Swag

Log in

Log in