random objects in a list

Hello

I have a problem : I know how to make a random action on an objects list,
but I can figure to make an action on all a list randomly :
- I have ten objects (for e.g.)
- I want to rotate each object of the list but in random order (the 2nd, the 8th, ...)

Something like : "for obj in sel in randommanner do"....

Thanks.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Vapourise's picture

Thanks Anubis I was searching

Thanks Anubis I was searching for a solution to this problem and you came up with the goods...again!

titane357's picture

You are right Anubis !!!

You are right Anubis !!! Works great now ! Thanks :-))

Anubis's picture

No Superman, hehe... and for

No Superman, hehe... and for the selection - you need to convert it to array, i.e:
intArray = selection as array

my recent MAXScripts RSS (archive here)

titane357's picture

Thanks Anubis (or do I must

Thanks Anubis (or do I must call you Superman ?)
If I understand well intArray can be declared like this : intArray=selection ?
if so I have a problem : Max don't seems to like "deleteItem intArray rndIndex" , I have an error message : No "deleteItem" function for $selection

Anubis's picture

maybe something like

maybe something like this...

intArray -- all collected objects
while intArray.count > 0 do (
    rndIndex = random 1 intArray.count
    obj = intArray[rndIndex] -- get random obj from array
    -- What TO DO with obj - code here...
    deleteItem intArray rndIndex
)

my recent MAXScripts RSS (archive here)

Marco Brunetta's picture

Well, suppose you have all

Well, suppose you have all the objects on an array. You probably know you can access items on an array using their index number, so all you need is a way of generating a random index number...

I'm sure you can figure it out from that...

titane357's picture

hello Marco, the thing I

hello Marco,
the thing I can't imagine is to acces randomly to these array indexes but one time for each object :
I was thinking to
- make an array for all the objects
- make a random number of the size of the array
- make an action with this object
- make a new array without this object
- make a new random number of the size of this new array
etc...
bur I don't know how..... :-((

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.