@Anonymous
Thank you for jumping in here. As a novice Maxscript user I appreciate your input. I usually don’t look at the Programming forum as I am a novice when it comes to programming in Max but saw this post had not been responded to so I thought I would give it a go. I too am Old School with my primary programming experience coming from FORTRAN and PDP assembly language, and more recently VBA.
The reason I provided an expression controller is because:
- That is what the OP asked for.
- Only a scalar variable was being calculated.
- It is a relatively simple calculation that can be written in one statement with little knowledge of statement syntax and no knowledge of Maxscript.
- The function syntax is handily provided via the Function List button in the in the Expression Controller dialog window.
- The expression syntax is similar to that in Excel which adds to its ease of understanding.
I disagree that “…in this case the script is much more simple than expression…”. The first 3 lines of your code
delete objects
target = point name:#target box:on cross:on axistripod:on wirecolor:orange
c = target.rotation.controller[3].controller = float_script()
ss = @"z =
are not obvious to the non-Maxscript write. Why did you start with a delete object? I get the purpose of the target =, and C =, statements but would not know the syntax nor content for them without an example.
What is the meaning of @”z = and then why is c.setexpression ss needed at the end?
I guess because the OP posted his question in the programming forum (rather than the Rigging and Animation forum) there is an assumption of a certain level of programming knowledge with Maxscripts that would make your suggested solution look "simple". It is simple but requires much more knowledge to write than the expression solution.
Again, thank you for your input. It is appreciated. I've learned some useful features I will be able to use in the future.
lee.minardi