A simple question about "if" command

Hello everyone,I’m here for asking some beginner questions again.
Maybe something I talk about has presented in tutorials,but it’s a little difficult for me to find it out because my English is not very well.
That’s why I’m here,asking for some help.
Now it’s the question:
There’s a LFO Chop and a Constant Top.I want to realize a function that when LFO’s value < 0.6,the Constant’s color is white and when the value of LFO output >= 0.6,the color of Canstant turns to black.
My code in a Text DAT is :
"
if ($chan1 >= 0.6)
/project1/p1/constant1 $color_r = 1
else
/project1/p1/constant1 $color_r = 0
endif
"
It dosen’t work.
Would anybody point out what’s wrong with it and how to fix it.
And what’s the rule of naming every variable in every OPs?Which means I could find them through the name.
And what’s the form to write a completely program and what parts are necessary,just like we should “include” some head files in C++ programs.

Hi Zhangfang,

The correct syntax in this case would be like this…

[code]if $arg3 >= 0.6

opparm constant1 color (1 1 1 )

else

opparm constant1 color (0 0 0 )

endif[/code]

the opscript command is useful for discovering syntax for setting up and changing opperators via a script.

        [i] # to change working level to project 1 instead of / 
         cc project1 
         # show what would be needed to generate constant1 in its current state and location
          opscript constant1 [/i]

the result appears in the textport (accessible via the dialogs menu or + )

attached is an example that also shows how this might be done using CHOPs without the script.

Rod.
if_example.toe (4.22 KB)

Thanks Rod!
Your reply helps me a lot!
Thanks for your patience and enthusiasm!
But I’m still a little confused about the “$arg3”.Where does it come from and what’s the mean of it?
And I just had a new question about 3D model input:
I’ve connected kinect to TD and recieved its data of the 20 nodes.Now I want to import some 3D model of Maya and ,for example a long stick,edit it’s positions of two endpoints,so that I could define its motion in TD by two relative nodes in kinect data.And I just get known that I can only import .tog , .geo and .bgeo files in File SOP.
Here’s the question:
Could I import a .fbx file from Maya into Houdini and then convert it to .geo file?
I want the object has two parameters about two endpoints,where should I join it into the model ?In Maya?Houdini ?Or TD?
And How?
Ok that’s all.I’ve tried my best to describe my question but I think it maybe still a little difficult to understand.And just forgive me… :wink:
Thanks very much!Look forwards for your answer!

for info about arguments for a chopexec DAT, see here…
derivative.ca/wiki077/index. … xecute_DAT

$arg3 is the value of the channel that is triggering execution of the DAT.

maybe your 3D import question should be in a separate post.

cheers,

rod.

OK Thanks a lot!
It’s so much kind of you.
I’ll post my 3D question separetely.