Instead of looping the scene materials, we can just collect all the materials of a class. In the following code you you need to replace standardmaterial with the class name of the VRay materials. You can get the class of a VRay material by applying it to an object and running this snip: classof $.material ( setProperty…
Here's some comments. [COLOR="Green"]--NOTHING WRONG WITH THIS LINE, EXCEPT IN MAXSCRIPT IF YOU HAVE AN ELSE CLAUSE YOU NEED TO USE "THEN" NOT "DO"[/COLOR]for obj in selection do[COLOR="Green"]--THE BRACKET DOESN'T NEED TO BE DOUBLE UP[/color] (([COLOR="Green"] --YOU DON'T DECLARE VARIABLES IN MAXSCRIPT OR END LINES WITH A…