Bungee Logic : Intrinsic : OnChange

Page Status: Beta
Jump to: navigation, search

Back to Bungee Logic Statements

Contents

[edit] Description

Each field member of a class has two intrinsic functions associated with it: OnInit and OnChange Bungee Logic Statements added to the OnChange function run whenever the field is assigned a value, even if the new value is the same as the previous value. 

The OnChange function contains an intrinsic variable, oldValue, of type Data.  This variable contains the previous value of the field. If you only want the statements to exicute when the newly assigned value is different from the previous value, you can use an if(condition) around your statements where the condition compares the current value to oldValue.

[edit] Example

 

public int formChoice;
{
.
.
.
   OnChange
   {
      var Data oldValue;

      condition
      {
         case (oldValue == 1)
         {
            formChoice = 3;
         }
         default:
         {
            formChoice = 2;
         }
      }
   }
}

[edit] See Also

OnInit

 

    Copyright © 2005 - 2008 Bungee Labs. All rights reserved.