Condition

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
User avatar
y offs et
Posts: 418
Joined: Wed Apr 22, 2009 4:26 pm
Location: BC, Canada

Condition

Post 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?
"great expectations"
User avatar
VilleK
Site Admin
Posts: 2371
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post 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()) {
...
}
User avatar
y offs et
Posts: 418
Joined: Wed Apr 22, 2009 4:26 pm
Location: BC, Canada

Post 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?
"great expectations"
Post Reply