Conditional Statement

From Visual3D Wiki Documentation
Jump to: navigation, search


This command was fully released in Visual3Dv6. The command is usable but hidden in most versions of Visual3Dv5.

NOTE: This command was previously called the Expression_Loop. Scripts referring to this old command name will still work.

Pipeline Syntax

Conditional_Statement
/ITERATION_PARAMETER_NAME=
/EXPRESSION=
;

Conditional_Statement_End
/ITERATION_PARAMETER_NAME=
;

Pipeline Explanation

This command was modeled after the For_Each command in the sense that there is a start (Conditional_Statement) and an ending event (Conditional_Statement_End).

When the pipeline comes to an Conditional_Statement command, it will evaluate the expression. The expression uses the same syntax as the Evaluate_Expression command. If the expression is TRUE (returns any value other than zero), all of the subsequent commands will be executed. If the expression is FALSE (returns a zero), all the commands that are between the Conditional_Statement and Conditional_Statement_End commands will be skipped.

The ITERATION_PARAMETER_NAME is just used to identify which Conditional_Statement and Conditional_Statement_End commands are associated with each other.

The loop is essentially meant to act as an if statement - if the expression is true, the loop will be entered. The Conditional_Statement_End command acts as the closing bracket for the statement.

Pipeline Example

This script will prompt the user to specify if walking or running trials are being processed. Based on the user's selection, different processing will be completed. In this example, the pipeline parameter TEST will be set to 1 if the condition is Walk, and set to 2 if the condition is Run.

Prompt_For_Pipeline_Parameter_Value
/PIPELINE_PARAMETER_NAME=CONDITION
/PROMPT=Select Condition:
/DATA_TYPE=STRING
/DEFAULT_VALUE=Walk
/USE_POSSIBLE_VALUES=TRUE
/POSSIBLE_VALUES=Walk+Run
! /USE_UNITS=FALSE
! /DEFAULT_UNITS=
! /USE_POSSIBLE_UNITS=FALSE
! /POSSIBLE_UNITS=
! /CONVERSIONS=
;

Conditional_Statement
/ITERATION_PARAMETER_NAME=STATEMENT_1
/EXPRESSION= "&::CONDITION&" == "WALK"
;

Set_Pipeline_Parameter
/PARAMETER_NAME=TEST
/PARAMETER_VALUE=1
! /PARAMETER_VALUE_SEARCH_FOR=
! /PARAMETER_VALUE_REPLACE_WITH=
! /PARAMETER_VALUE_PREFIX=
! /PARAMETER_VALUE_APPEND=
! /MULTI_PASS=FALSE
;

Conditional_Statement_End
/ITERATION_PARAMETER_NAME=STATEMENT_1
;

Conditional_Statement
/ITERATION_PARAMETER_NAME=STATEMENT_2
/EXPRESSION= "&::CONDITION&" == "RUN"
;

Set_Pipeline_Parameter
/PARAMETER_NAME=TEST
/PARAMETER_VALUE=2
! /PARAMETER_VALUE_SEARCH_FOR=
! /PARAMETER_VALUE_REPLACE_WITH=
! /PARAMETER_VALUE_PREFIX=
! /PARAMETER_VALUE_APPEND=
! /MULTI_PASS=FALSE
;

Conditional_Statement_End
/ITERATION_PARAMETER_NAME=STATEMENT_2
;
Retrieved from ""