Digital Art Zone

 
     
How to terminate script execution from within DazScript?
Posted: 05 November 2012 12:55 PM   [ Ignore ]   [ # 4 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  13589
Joined  2003-10-09

I don’t know. continue would terminate any loop you were in, then you could have some kind of check to make sure execution of instructions ended -

for ( var limit && ! GiveUp n++ ) {
      
if (unrecoverableErrorCondition{
       GiveUp 
true;
       continue;
     
}  
 Signature 

DAZ Studio Frequently Asked Questions

Index of free DAZ Studio scripts and plugins list

Profile
 
 
Posted: 05 November 2012 01:37 PM   [ Ignore ]   [ # 5 ]
Member
Rank
Total Posts:  48
Joined  2010-09-22

continue and break just skip or exit the current looping structure.  I’m looking to end script execution all together. 

In Java this would be System.exit(), in PHP and Perl exit(), in Python sys.exit(), etc.  I can’t seem to find the equivalent in DazScript, nor does it seem to be in the ECMAScript spec.

 

Profile
 
 
Posted: 05 November 2012 02:07 PM   [ Ignore ]   [ # 6 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  13589
Joined  2003-10-09

I was suggesting using continue to get out of the loop you are in, if any, and then using a boolean flag to make sure that nothing else is done - so the script should then just run do-nothing function calls until it gets to its end. Or put error checks around the actual code - I often end up with so many nested if ( we-have-the-thing-we-need) statements that in a print the actual working code would be on the right margin.

 Signature 

DAZ Studio Frequently Asked Questions

Index of free DAZ Studio scripts and plugins list

Profile
 
 
Posted: 06 November 2012 11:27 AM   [ Ignore ]   [ # 7 ]
Administrator
Avatar
RankRank
Total Posts:  312
Joined  2003-10-09

Wrap your code in a function and exit the function early…

function myFunctionbExitEarly )
{
 
if( bExitEarly ){
  
print( "Exited the function early." );
  return;
 
}
 
 
print( "Exited at the end of the function." );
};

myFunctiontrue ); 

-Rob

 Signature 

- Documentation Center
- Install Manager
- DAZ Studio 4.x
- DSON Importer
- DSON File Format Specification

Profile