PDA

View Full Version : [HELP]Arrays


wmsmith
09-26-2005, 01:21 PM
Could someone provide me with a good example of using an array.

i wish to use them for some of the buttons on my project, to save on the masses of code executed for each, which is the same code, just different object name it references.

Thanks Guys.

antonv
09-26-2005, 02:46 PM
In maxscript reference you can find anything you need for Arrays.
What do you need the array to do? Give as a specific need and we can help. If this is for your script with the planes, from what I remember, you might need "for" loops not arrays...

Light
09-26-2005, 03:32 PM
William,

Wrap the code in a fn and call it for each button, but I am not sure if you want to initiate these events indirectly [without pressing the buttons].




Light

wmsmith
09-26-2005, 03:44 PM
ok, maybe you could show me how to do this, Light, i am at work just now see, and i dont have access to the internet at home : /. So anyhelp would be mega appreciated.

Thanks!

Light
09-26-2005, 04:00 PM
Sure,

(
-- rollout definition
fn createNow theButton =
(
local theBox = box()
...
print theButton.text
)
on vOK pressed do createNow vOK
on vCancel pressed do createNow vCancel
)

But this kind of stuff depends alot on the code, so sometimes I access rollout controls from an array like:

local arr = #(vOK, vCancel, vExit, ...)
for i in arr do i.visible = not i.visible




Light

wmsmith
09-26-2005, 04:26 PM
Thanks ill have a good look at it when i go home.

Cheers.

CGTalk Moderation
09-26-2005, 04:26 PM
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.