View Full Version : [If...] Question
Very simple question this time:
Can the [If...] command have several ifs in it?
Like [If,var1>2 and var2<3,[Doodle]]
Or [[If,var1>2 or var2<3,[Doodle]]
Seems this would be easier than [If,var1>2,[If,var2<3,[Doodle]]
Sure can. It's best to put parentheses around each element in the expression:
And (both must be true):
[If, (var1 == 1) && (var2 == 2), ...
Or (either can be true):
[If, (var1 == 1) ***0124;***0124; (var2 == 2), ...
That's two ampersands for AND, and two "pipes" (on my keyboard the shift-backslash above the Enter key) for OR.
You can put extra parentheses around conditions to make it really complex:
[If, ((var1 == 1) ***0124;***0124; (var2 == 2)) && (var3 == 3), ...
this first checks if var1 equals 1 OR var2 equals 2, if so then it also checks to see if var3 equals 3.
Cheers,
dave
Thanks Davey. I figured ZScripts had a few more time saving tricks up it's sleeves. :)
Hi Davey I am finding your tutorial on ZScripts interesting. Question, If I record a ZScript and then open it, is it not easier to just go over the text and insert instructions at various points as needed instead of doing everything from scratch?
Good Question, DeeVee ...
My response is, sometimes yes, sometimes no. How's that for an answer? :)
When ZScripts are recorded, only a few of the more than 100 commands are used. This is because the recording feature faithfully registers every click and brush stroke you perform.
The rest of the commands serve to manipulate, calculate, format, display, and more. Whether you record or plan in advance kind of depends on the task you're hoping to accomplish.
If I want to simply draw a cube, for example, a recorded ZScript serves the task perfectly well.
If I want to draw a cube, and then adjust it so it's a specific size and orientation, I might start with a recorded ZScript, and then do as you suggest -- insert the appropriate commands in a text editor.
If I want to write a ZScript that enlarges a cube to twice its size, regardless of how it was drawn, then I'll write the ZScript from scratch with a few simple commands.
And, like anything creative, it's a matter of taste too.
dave
Just my personal opinion on this DeeVee, it depends on the length. I usually write the first instruction as a Note, then record the actions, add them to, the script, write the second note, record, add, and so on. :)
Thanks for the reply. For a while I was reluctant to ask the question as I thought more experienced members would have asked it, and then my question would be answered.
boozy floozie
02-02-02, 08:48 AM
Sorry Muvlo I'm a complete ignoramus when it comes to scripting but I felt that the posting would benefit from some good ol' Telly Savalas
Forgive me.
http://www2.zbrushcentral.com/zbc_uploads/user_image-1012668503ife.jpg
If a picture paints a thousand words
Then why can't I paint you?
The words will never show
The you I've come to know.
And if a face could launch a thousand ships
Then where am I to go?
There's no one home but you;
You're all that's left me
too.
And when my love for life is running dry
You come and pour yourself on me.
If a man could be two places at one time
I'd be with you tomorrow and today
beside you all the way.
If the world should stop revolving
spinning
spinning slowly down to die
I'd spend the end with you
And when the world was through
Then one by one the stars would all go out
Then you and I would simply fly away.
kelly_b_c
02-02-02, 10:31 AM
wow, that is some great poetry you posted there, Floozie. Is that your own?
:tu:
oh, yeah I completly forgot what the original topic was, but umm . . I agree with whatever Davey said.
I have a question, too:
How can i realize the following basiclines:
IF (...) THEN
...
ELSEIF R > .01 AND R <= .86 THEN
...
ELSEIF R > .86 AND R <= .93 THEN
...
ELSE
...
would it be done with:
[If,rand(100)/100<.01,
[RoutineCall, CaseA],
[If, rand(100)/100>.01,
[RoutineCall, CaseB],
[If, rand(100)/100>.86,
[RoutineCall, CaseC],
[RoutineCall, CaseD]
]]]
? Is ist the same?
EDIT: Is it possible to take more than one command together in the "then"-part of the if-command, so that i donīt have to call routines?
and another question:
why does this brings out an error:
[VarSet, R, RAND(100)/100]
and the last one: (so far :) )
[VarSet, NewY, (C * X) + (D * Y) + F]
this brings the followinge error:
"Ambigous input. Input can be precede by... [# =Variable ] or [ =Evaluated numerical expression..."
My english is not good enough to understand that...
perhabs its an syntax-error, only?!
Who can help?
Powered by vBulletin® Version 4.1.11 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.