Page 1 of 1

Condition

Posted: Thu Apr 01, 2010 3:35 am
by y offs et
So I got this idea that I could set up a while loop in the onTrue list of a condition component that would check if the condition was still true. I figured to give the component a name and call a check by the name every cycle. I found I couldn't do anything with it, getting an "unknown identifier" error.
Comments?

Posted: Thu Apr 01, 2010 5:59 am
by VilleK
There is no property on Condition-component that will tell you if the condition is true. You are better off writing a ZLibrary-function that you call both from the Condition and your ZExpression.

//Zlibrary
int isTrue() {
...
}

//Condition
return isTrue();

//ZExpression
if(isTrue()) {
...
}

Posted: Thu Apr 01, 2010 3:28 pm
by y offs et
OK, that works. Using a while loop in the Zexpression produced infinite loop situations, so I'm still experimenting. Perhaps a scripted update of the particular property in the Zlibrary expression.

Anyway, as a result of the infinite loop, the editor saved key presses, which gave uncontrolled behavior next preview. Closing and reloading the zproj didn't fix this, and I had to close the editor. Bug?