PDA

View Full Version : Checkbutton.Text = arrays info


Deadalus
11-23-2006, 12:53 AM
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 :D

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?

BakerCo
11-23-2006, 12:58 AM
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)

Deadalus
11-23-2006, 01:24 AM
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 :D
THANK AGAIN MrBaker

erilaz
11-23-2006, 01:33 AM
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.

CGTalk Moderation
11-23-2006, 01:33 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.