Announcement

Collapse
No announcement yet.

RandomSelect Script ERROR???

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • RandomSelect Script ERROR???

    Trying to run the BlurScript called RandomSelect in Max 8 and getting an error -- Type error: Call needs function or class, got: undefined.
    Anyone know what the deal is or can point me to a script that randomly selects objects in a scene?

    Thanks in advance,

    Brian

  • #2
    Code:
    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.

    Code:
    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
    This signature is only a temporary solution

    Comment


    • #3
      Code:
      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
      This signature is only a temporary solution

      Comment


      • #4
        ok - now it's really finished, but just one other nice approach
        Code:
        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
        This signature is only a temporary solution

        Comment


        • #5
          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!!!!!!!!!!!!!!

          Comment


          • #6
            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
            This signature is only a temporary solution

            Comment


            • #7
              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!!!

              Comment


              • #8
                You need to select the objects first, should have said that! The scripts will then remove objects from the selection.

                best regards,
                Michael
                This signature is only a temporary solution

                Comment


                • #9
                  OOPS

                  Knew I was going to screw something simple up on my end!!

                  WORKS PERFECT!!!

                  Comment

                  Working...
                  X