loop through objects
Hi.
I no doubt know this is a easy fix but and help would be most apreciated.
I can apply and randomise a UVW map easily enough but I'm having trouble counting the objects selected and looping through the script for each object.
The general idea is to say randomise a stone texture over several tiles.
My poor ass script is as follows :
arr = $.count
mapSize = 500
for i = 1 to arr do
(
modPanel.addModToSelection (Uvwmap ()) ui:off
$.modifiers[#UVWMapping].maptype = 4
$.modifiers[#UVWMapping].length = mapSize
$.modifiers[#UVWMapping].width = mapSize
$.modifiers[#UVWMapping].height = mapSize
$.modifiers[#UVWMapping].gizmo.rotation = (quat (random -20 20) (random -20 20) (random -20 20) (random -20 20))
maxOps.CollapseNode $ off
)
Any Help would be most apreciated.

Comments
2 loop manners exist
You can loop through in any collection in 2 ways - by-item and by-index. If you use by-index for selection w'd looks like:
for i=1 to selection.count do ( selection[i]... )But if you like to use
modPanel.addModToSelectionthen you'd need to select only 1 object at a time. So in this case more appropriate w'd be to loop by-item.hope this help
my recent MAXScripts RSS (archive here)