User Tools

Site Tools


macros:control_structures

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
macros:control_structures [2017/11/19 14:47] icke_siegenmacros:control_structures [2019/02/06 21:07] (current) – external edit 127.0.0.1
Line 10: Line 10:
 </step> </step>
 </code> </code>
 +
 +**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:function:math.isequal]] takes two values as arguments and returns true if both values are equal. In total, if the property ''Playbacks.Editor.Times.ChaseSpeed'' equals 0.0 then this step is performed and sets this property to 1.0. This step is only executed if its condition is met - and the condition is a function written in double quotes: [[macros:function:math.isequal]] takes two values as arguments and returns true if both values are equal. In total, if the property ''Playbacks.Editor.Times.ChaseSpeed'' equals 0.0 then this step is performed and sets this property to 1.0.
Line 22: Line 24:
 This simply negates a variable, effectively turning it into its reciprocal value: if the variable 'Timecode.Enabled' is true it will be set to false, and vice versa. This simply negates a variable, effectively turning it into its reciprocal value: if the variable 'Timecode.Enabled' is true it will be set to false, and vice versa.
  
 +There are also some other syntax versions:
 +
 +<code xml>
 +<step>
 +  {
 +    if(Math.IsNotEqual(Playbacks.Editor.Times.ChaseSpeed, 0.0)) {
 +      ** Do Something **
 +    } else {
 +      ActionScript.SetProperty.Float("Playbacks.Editor.Times.ChaseSpeed", 1.0);
 +    }
 +  }
 +</step>
 +</code>
 +
 +and as of version 10, it is possible to write conditions in a more modern way:
 +
 +<code xml>
 +<step>
 +  {
 +    if(Playbacks.Editor.Times.ChaseSpeed == 0.0) {
 +       ActionScript.SetProperty.Float("Playbacks.Editor.Times.ChaseSpeed", 1.0);
 +    }
 +  }
 +</step>
 +
 +</code>
 +
 +**It appears that the else hive must not be empty. If it is empty then Titan doesn't start, and the Log Viewer complains "Compliation of action script failed:... Unexpected token '' found." ** (The typo is courtesy of the Log Viewer :-) )
 +
 +If you only need the if hive, then omit the else altogether.
 +
 +Also see an example here: [[macros:example:dummyspeedascondition|]]
  
 +~~NOCACHE~~
 +{{page>macros:formats_and_syntax#further_readings}}
  
 +~~DISCUSSION~~
macros/control_structures.1511102858.txt.gz · Last modified: 2017/11/19 14:47 by icke_siegen

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki