Execute

(Engine-Level Function)

Description: Executes a group of statements as a single entity in structures that would otherwise allow only one statement to be executed.
Returns: Nothing
Usage: Script Only.
Function Groups: Logic Control
Related to: Window | SetHelp
Format: Execute(Statement1 [, Statement2])
Parameters:  
Statement1, Statement2, …     }
Required. Are any expression(s) to be executed. Any number of parameters may be used. Commas or semi-colons must separate the parameters.
Comments: This statement is typically used with a Case or IfElse statement..

Example:

  If ZButton(10, 50, 110, 80, "Grid On", 1);
  [
    { If module is not already launched, launch it }, 
    IfElse(! Valid(ModPtr), 
           Execute( { Do a series of tasks }
                   modPtr = ShowGrid(){Launched because of script}, 
                   ySpace = ySpace,
                   gridOn = 1 
                   ), 
    { If module already launched, stop it } 
  { else } Execute( { Do a different series of tasks }, 
                   Slay(modPtr, 0), 
                   gridOn = 0 
          )); 
  ]

When this particular button is pressed, modPtr's validity is checked and if it is not valid, module ShowGrid is launched and some variables set, otherwise, ShowGrid is slain via modPtr and variable gridOn is set to 0. Notice how the use of the Execute function allows a whole series of tasks to be performed with only one condition check.