STAR TREK 2d20
  1. #1
    Blackfoot's Avatar
    Join Date
    Oct 2010
    Location
    New Jersey, USA
    Posts
    4,202
    Blog Entries
    4

    onValueChanged()

    The onValueChanged() function is called when a value is changed... getValue() returns the new value of the variable... is there a way to determine what the previous value of the variable was before it was changed?
    Full License Operator - You must have a 'Lite' License to play in my games.
    Member and GM in the Fantasy Grounds Pathfinder Society Group.
    PFS Fantasy Grounds Forum
    FG Community Teamspeak Server: ts.fg-con.com
    Interested in Custom Character Portraits and Tokens? Contact me.

  2. #2

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096
    When I need value recovery, I save it in a script local variable initialized in onInit and updated once the change is committed in onValueChanged (or revert to pervious cached value if necessary but be sure and set a flag to prevent event recursion if you restore previous value)

  3. #3
    Blackfoot's Avatar
    Join Date
    Oct 2010
    Location
    New Jersey, USA
    Posts
    4,202
    Blog Entries
    4
    I can try that.. so the answer to my query is.. once you've arrived at the 'onValueChanged()' function.. the original value is 'gone'?
    Full License Operator - You must have a 'Lite' License to play in my games.
    Member and GM in the Fantasy Grounds Pathfinder Society Group.
    PFS Fantasy Grounds Forum
    FG Community Teamspeak Server: ts.fg-con.com
    Interested in Custom Character Portraits and Tokens? Contact me.

  4. #4
    Yes, that's correct. The "onValueChanged" event is fired after the value is changed.

    As Bidmaron suggested, when I need to remember the "current" value, I store in a local script variable that gets initialized in "onInit", and updated in "onValueChanged".

    Regards,
    JPG

  5. #5

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096
    Wow. Had forgotten about the tic tac toe sequence.

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
  •  
Starfinder Playlist

Log in

Log in