simple quistion

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  03 March 2013
simple quistion

Hi everybody ...
im starting to learn maxscript ...
and i got this question :

for x = 1 to 5 do
(
??????????
)

i want inside the loop to create variable called (a+the x value from the loop)

a1
a2
a3
a4
a5
 
  03 March 2013
You can't do it. Try with arrays - in loop fill the array and use its elements as variables.
 
  03 March 2013
The more important answer is "there is no reason you should want to do it".
 
  03 March 2013

codeTxt = ""
for x = 1 to 5 do
(
codeTxt += "a" + ( i as string) + " = undefined \n"
)

execute codeTxt
 
  03 March 2013
arrays are your friend
multi-dimensional arrays are your girlfriend


(
varr = for a = 1 to 5 collect #(a,a*(random 4 10)) 
for v = 1 to varr.count do format "% <-- value of a\t product of a*% --> %\n" varr[v][1] (varr[v][2]/varr[v][1]) varr[v][2]
)


beware: girlfriends can drive you mad
__________________
www.davetyner.com
 
  03 March 2013
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 01:18 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.