If I Could If Better


tnoble8888

Recommended Posts

I seem to be missing something, the last IF part of this loop does not ever execute, can you help?

Thank you,

Thom

var.AudioDETLevel = 213

While (1)  // Limit Option ((var.AudioDETLevel[0] >= 207) && (var.AudioDETLevel[0] <= 218))
   If (AudioMonAVG [0] > (var.AVGFactor + 0.03)) // Compare Desired Level To Average Level Audio
	  Delay (2) 
		 If (AudioMonAVG [0] > (var.AVGFactor + 0.03)) // Compare Desired Level To Average Level Audio
			AudioDETLevel = AudioDETLevel + 1
		 endif
   endif
   If (AudioMonAVG [0] < (var.AVGFactor - 0.01)) // Compare Desired Level To Average Level Audio
	  Delay (2) 
		 If (AudioMonAVG [0] < (var.AVGFactor - 0.01)) // Compare Desired Level To Average Level Audio
			AudioDETLevel = AudioDETLevel - 1
		 endif
   endif
	If ((var.AudioDETLevel[0] < 208) or (var.AudioDETLevel[0] > 217))
		 var.AudioDETLevel = 213
		 Delay (1)
   endif
endwhile

Link to comment
Share on other sites

First, watch your indentation. It looks worse because the forum is wordwrapping, but despite this, you are not indenting properly. Don't intent after delay(). Indent only for block statements (if, for, while, switch, try, etc)

The problem is that "or" is not valid in the if. To do a boolean "or" use the operator ||

Link to comment
Share on other sites

Thank you, I will learn... I updated with your recommendations and it all works now.

I am puzzled by the fact that when I change the delay time, compile and restart the sequence, new delay does not seem to be there. It seems I have seen this before, but not always. It should compile and operate to the newer value without reloading the ctl file .. right?

Thanks,

Thom

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.