View Single Post
# 1 14-12-2008 , 11:39 AM
bendingiscool's Avatar
Subscriber
Join Date: Jul 2006
Location: London
Posts: 567

select random object in selection

Hey, ok this should be dead simple, but I can't work out the syntax.

Basically I want to be able to be able to select a bunch of geometry, cubes, cylinders, etc, then go through a loop randomly instancing one of them each time through.

So far I have...

string $sel[] = `ls -sl`;

for ($i=0; $i<10; $i++)
{
select $sel[1];
instance;
}

now this is just going to select a specified object from the selection, what I want is to be able to select a random object of the selection each time it loops through.

Many thanks, Chris