Thread: onValueChanged()
-
August 13th, 2018, 15:50 #1
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.
-
August 13th, 2018, 17:54 #2
Archangel
- 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)
-
August 13th, 2018, 19:06 #3
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.
-
August 13th, 2018, 20:12 #4
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,559
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
-
August 13th, 2018, 21:26 #5
Archangel
- 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