XM Magdalena 3D print, GGeorgy (3D)
LC #42 Pipers Alley

View Full Version : Simple Question. Very Basic.

09-12-2005, 07:13 AM
Any one please knows how to force listener to return the entire array, instead of the first 20 items then goes ,....)
I can't find a way. I looked in preferences but there is no option there...

09-12-2005, 10:24 AM

Either use printAllElements context or change the global variable options.printAllElements.


with printAllElements on format "%\n" arr


options.printAllElements = true; format "%\n" arr

I would recommend using the context as it is safer. Also note that this will only work in max 7. So if you want to save the array to a file, you should write your own fn to make it compatible with previous versions.


09-12-2005, 11:22 AM
Thanks Light for answering my question! :)

But you went too advanced on me. in the ABCs of scripting I'm at the B now. But I got the idea.

Your line:
with printAllElements on format "%\n" arr

I didn't understand quite well but When saying:
with printallelements on thelot --thelot is the array.
I don't get all my array elements(basicly just testing 25 pyramids)
so it's not as simple as I thought. but thanks a lot, I can now switch it on take what I need then switch it off

but Maybe if you have time you can explain what you meant by the

format "%/n" arr


with printAllElements on format "thelot\n" arr

shoots back


and not the full list

09-13-2005, 12:18 AM
printAllElements on format "thelot\n" arr -- You are using the format command wrong. Look it up in the MaxScript Reference. I'll try to give a simple explaination.

Lets say

a = 1
b = 2
c = 3

If you do this:
format "% % %" a b c
it will return:
1 2 3

if you do this
format "a b c" a b c
it will return:
"a b c"

09-13-2005, 02:03 AM

You should use this way:
with printAllElements on format "Pyramids: %\n" thelot

Each element after "%...\n" will be placed instead of % respectively.


09-13-2005, 07:22 AM
Thanks Martinz for the explanation (thats what I needed, to be explained like I'm an 8 year old :) )

Thanks light it worked very well. saves on time and code once you learn it. I didn't exepect less from the writer of Orionflame.
Good luck.

09-13-2005, 07:49 AM
cool!, I never knew about the printallelements function, this will have to go to my notes folder, thanks light!

09-13-2005, 11:55 AM

Keep in mind that this method was introduced in max 7, so you will need to write your own fn if you want to make a script compatible with pre max 7.


09-14-2005, 01:50 AM
i see, too bad, im using max 6... and i forgot that im using max 7 maxscript reference. but writing a fn is not a bad thing either. thanks again light!

09-14-2005, 02:28 AM

Here is what I use to store arrays in INI key strings:

local arr = for i = 1 to 100 collect i

fn getArrayElements arr =
local txt = "#("
for i = 1 to arr.count do
txt += arr[i] as string
if i < arr.count then txt += ", " else txt += ")"

getArrayElements arr

You might use it if you want.


CGTalk Moderation
09-14-2005, 02:28 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.