macros:control_structures
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
macros:control_structures [2017/11/19 14:26] – icke_siegen | macros:control_structures [2019/02/06 21:07] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 3: | Line 3: | ||
When a macro is called, all its steps are executed sequentially. | When a macro is called, all its steps are executed sequentially. | ||
- | However, you can define conditional steps - steps which are only executed if a condition is met. | + | However, you can define conditional steps - steps which are only executed if a condition is met. In order to do this, simply give the step a condition property, like in [[macros: |
+ | <code xml> | ||
+ | <step condition=" | ||
+ | ActionScript.SetProperty.Float(" | ||
+ | </ | ||
+ | </ | ||
+ | **At the moment (version 10.0 and 10.1) it looks like such conditions are stripped when a macro is copied in Titan. Hence, always __move__ macros with conditions (which has the backdraw that you can have a macro only on one handle.** | ||
+ | This step is only executed if its condition is met - and the condition is a function written in double quotes: [[macros: | ||
- | Another mechanism is also related to control structures albeit strictly it is just juggling with booleans: simple toggle logic. | ||
+ | Another mechanism is also related to control structures albeit strictly it is just juggling with booleans: simple toggle logic, see [[macros: | ||
+ | <code xml> | ||
+ | < | ||
+ | </ | ||
+ | This simply negates a variable, effectively turning it into its reciprocal value: if the variable ' | ||
+ | |||
+ | There are also some other syntax versions: | ||
+ | |||
+ | <code xml> | ||
+ | < | ||
+ | { | ||
+ | if(Math.IsNotEqual(Playbacks.Editor.Times.ChaseSpeed, | ||
+ | ** Do Something ** | ||
+ | } else { | ||
+ | ActionScript.SetProperty.Float(" | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | and as of version 10, it is possible to write conditions in a more modern way: | ||
+ | |||
+ | <code xml> | ||
+ | < | ||
+ | { | ||
+ | if(Playbacks.Editor.Times.ChaseSpeed == 0.0) { | ||
+ | | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | **It appears that the else hive must not be empty. If it is empty then Titan doesn' | ||
+ | |||
+ | If you only need the if hive, then omit the else altogether. | ||
+ | |||
+ | Also see an example here: [[macros: | ||
+ | |||
+ | ~~NOCACHE~~ | ||
+ | {{page> | ||
+ | |||
+ | ~~DISCUSSION~~ |
macros/control_structures.1511101614.txt.gz · Last modified: 2017/11/19 14:26 by icke_siegen