Simple Scripting question

I am exploring the wacky world of maxscript and I have a question:
I have written a simple script that allows me to select an object and turn the visability to 0. The problems is I do not know how to get the script to close the parameters box (click OK)
Here is the script - any advice will be much appreciated.

$.executeAction 0 “40022” -- Edit: Properties
max properties
$.visibility = 0

Thanks as always

Viability back on

The script seems to be working now in it’s much simpler form :

$.visibility = 0

But when I try to use it to turn the visability back to 1 I get the following error :

$.visibility = 1

-- Syntax error: at keyword parameter, expected name
-- In line: $.Edit: Properties

I know there are some scripting nerds out there who can solve this.

Thanks as always

try not to use the $ when scripting: make collections of objects or arrays your working method:

s=selection as array
for i=1 to s.count do(
    if s[i].visibility != undefined do(
            s[i].visibility = 1
    )
)

That way you won’t lose your selection around, but safely have it stored somehow.

Lele

Thank you

Thanks a million, can’t wait to see this in action. I am such a newbie to scripting but can see how it could get addictive very easily. The more I use it :smile:

Thanks as always

I can tell you it’s almost 4 years i toy with it, and i keep discovering new ways to do things…

It’s a wonderful cross between logic and language, a damnable drug!

:wink:

Lele

Adam,

I can definetly recommend Bobo’s maxscript DVD over at CG Academy. Well worth the money.