Notifications
Clear all

[Closed] [HELP]Arrays

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.

5 Replies

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…

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

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!

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

Thanks ill have a good look at it when i go home.

Cheers.