Notifications
Clear all

[Closed] Checkbutton.Text = arrays info

okay i feel realing dumb with this one. Its for the maxscript challenge.

For those who dont know the subject, you have to make a script to get Info for your scene.

So what i made is a script that go trought the scene and get object of the same class and slap ‘hem in respective array.
Everything’s fine now but i keep hitting the same prob And i’m sure i already found the answer some time ago but i memory is a thing that forget

Problem: Be able to get the number of Object in an array and return the corresponding number to a checkbutton.
Something like

 checkbutton OBjCount " Object Counter"
   on ObjCount changed state do
     if state  ==on
      then ObjCount.text = ""
      else  ObjCount.Text =  number of object in array -- <-- i'm stuk here
  

man i’m sure its just too easy.
WHo think i gonna find the answer on my own as soon as i send the tread?

3 Replies

have you tried

checkbutton OBjCount " Object Counter"
  on ObjCount changed state do
        if state  ==on
         then ObjCount.text = ""
         else  ObjCount.Text = (array.count as string)

yes and i look to me like it was the logical way but u got
–unknown property: “Count” in checkbuttoncontrol:LightCount
anyways i’ll have to go in the maxscript ref again.

thanks for trying

[edit] i modify array name to ObjCount and i got
–unknow property: “COUNT” in 5.
weird but i think i’m getting closer.

[edit again] find it. it was some stoopid typo mistake. that what happen when youre tired and tried to script
THANK AGAIN MrBaker

Can I suggest for a start that you bracket your code so it’s easier to read, like so:

 on objCount changed state do
   (
       if state == on then
       (
         objCount.text = ""
       )
       else
      ( 
         objCount.text =  (myArray.count as string)
      )
   )

If you modify your array name to the same name as the button object, you’re going to run into problems. You have to use unique names for each variable.