r/Maxscript • • Mar 26 '15

MAXScripting multiple iterations of buttons optimally?

 on btn1 pressed do
 (
 objectSelection = selection as array
 clearSelection()
 for obj in objectSelection do
 (
 	select obj
 	currentObject = $
 	$.modifiers[#ID].materialID =1
 	)
 	select objectSelection
 )

For the above sample I press button 1 and apply material 1 to an object (or multiple objects.)
If I need to do this for 30 buttons, 1 = 1, 2 = 2 etc, how do I do this without typing it all out?
Is that a function?
I'm still learning MAXScript.

3 Upvotes

9 comments sorted by

View all comments

Show parent comment

1

u/lucas_3d Mar 26 '15

Edit: Yes, that's awesome!
Thank you, I'm gonna look into that, to get things rolling I already did it the manual way like a loser.

2

u/Phew1 Mar 26 '15

As long as it works it doesn't really matter.