That's much better, cw - thanks for the good example! :) I knew execute seemed pretty dodgy... I've been out of the loop on maxscript for a few years now though :(
Ok MoP, I see your code example and raise you another (just for fun, like..) fn myFunc n attribute value = ( --cmd = ( "$" + n.name + "." + attribute + " = " + value as string ) --execute cmd -- proper way! ;) objs = n as array for obj in objs do ( if hasproperty obj attribute then ( setProperty obj attribute value )…
cw: Thanks, that's cleaner. I actually needed to do some different things than set a basic property in my real function, but your reply set me down the path to a cleaner solution. Strangely, 'hasProperty' will return false if you're querying about a custom attribute. 'isProperty', however, will work just fine. I ran into…
You need to use the execute command to assemble a string to evaluate. You will also need to pass "height" as a string - currently you're trying to pass it as a variable, therefore it will end up passing undefined at the moment (unless you defined height as a string value of "height" earlier in the code, which seems…