ZBrushCentral

Do Nothing in an IF Statement

I’ve learning to script alot of my workflow in zbrush lately, but I’m stuck on something sort of silly. I can’t figure out how to continue on with the rest of a script if an IF condition isn’t met. For instance, I want to do something like this:

[IF, [Condition]=1,
[Do Something],
[Nevermind, Continue On]
]

So I tried this, but it doesn’t seem to work.

[IF, [Condition]=1,
[Do Something],
]

So I did this, but it doesn’t seem very elegant. Is there a better way to do this that I’m missing? Thanks!

[IF, [Condition]=1,
[Do Something],
[Delay, 0.01]
]

http://docs.pixologic.com/user-guide/customizing-zbrush/zscripting/technical/ Partway down under Loops and Conditionals.

You need to think of it as like a fork in the road. If something is true then you go one way, if it’s false you go the other way. But it’s important to make sure that if the roads meet again later on what happens is OK for both routes. Otherwise you have to make sure that the two roads never meet again.

So, in your scenario

[IF, [Condition]=1,
[Do Something],
[Nevermind, Continue On]
]

is the same as

[IF, [Condition]=1,
[Do Something]
]

But both routes meet again after the If statement unless you’ve included code to stop it happening.

The other thing to consider is the condition. In general, a condition equaling 1 means that is true but you may need to check that the return value you are testing is actually what you expect. Notes are a good way of getting this information. So you might use:

[Varset, returnVal, [IGet,Transform:Activate Symmentry]]
[Note, returnVal]

to see the state of the Activate Symmentry switch.

Oh and using [Delay] will simply pause the script, it won’t change the flow.

HTH,

Thanks Marcus! That flow / fork analogy helps me out a lot. Rethinking how I’m setting up code blocks and defining routines is helping me to use those if statements better now too.

And so far all my conditions are true or false, usually based on switch states