Trying to run the BlurScript called RandomSelect in Max 8 and getting an error -- Type error: Call needs function or class, got: undefined. :evil:
Anyone know what the deal is or can point me to a script that randomly selects objects in a scene?
Thanks in advance,
Brian
percentage = 50
for i = 1 to (geometry.count*percentage/100) do
(
randomnumber = random 1 geometry.count
selectmore geometry[randomnumber]
)
a quick one to work on geometry. change the percentage according to your needs.
myobjects = #()
percentage = 50
for i = 1 to ($.count*percentage/100) do
(
randomnumber = random 1 $.count
append myobjects $[randomnumber]
)
select myobjects
This one takes your selection. Change percentage value accordingly.
enjoy.
Michael
try (destroydialog rndm) catch()
rollout rndm "random select"
(
spinner percentage "percentage" range:[0,100,50] type:#integer
button selectit "select"
on selectit pressed do
(
objs = $ as array
newsel = #()
for i = 1 to (objs.count*percentage.value/100) do
(
n = random 1 objs.count
append newsel objs[n]
deleteitem objs n
)
select newsel
destroydialog rndm
)
)
createDialog rndm 130 50
something more userfriendly
ok - now it’s really finished, but just one other nice approach
try (destroydialog rndm) catch()
rollout rndm "random select"
(
local objs = $ as array
slider percentage "percentage" range:[1,22,12] type:#integer
on percentage changed value do
(
newsel = #()
for i = 1 to (objs.count*percentage.value^2/100) do
(
n = random 1 objs.count
append newsel objs[n]
)
select newsel
)
)
createDialog rndm 500 60
THANKS!!
Michael,
THANKS A BUNCH!!! I tried the first two and they work like a charm

The other two polished versions you posted later give me a -- Type error: DestroyDialog requires Rollout Class, got: undefined. By NO means am I complaining just don’t want your hard work go to waste!! You need to get these posted on ScriptSpot or added to the BlurScripts page. I searched for a while, since I have no script writing skills
, and could not find anything. Hopefully I’m not messing anything up on my end…
THANKS AGAIN!!!

well’they’re far from beeing worth to be posted on scriptspot… glad i could help, edited the last two so that they should work now too!
best regards,
michael
THANKS
now it says -- Unable to convert: undefined to type: Array 
Hopefully I’m not wearing out my welcome…
THANKS AGAIN FOR HELPING ME OUT!!!

You need to select the objects first, should have said that! The scripts will then remove objects from the selection.
best regards,
Michael
OOPS
Knew I was going to screw something simple up on my end!! 
WORKS PERFECT!!!