View Full Version : Simple Question. Very Basic.
Werewolf006 09-12-2005, 08: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...
|
|
Light
09-12-2005, 11:24 AM
Walid,
Either use printAllElements context or change the global variable options.printAllElements.
IE:
with printAllElements on format "%\n" arr
OR
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.
Light
Werewolf006
09-12-2005, 12:22 PM
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
Because:
with printAllElements on format "thelot\n" arr
shoots back
thelot
ok
and not the full list
martinez
09-13-2005, 01: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"
Light
09-13-2005, 03:03 AM
Walid,
You should use this way:
with printAllElements on format "Pyramids: %\n" thelot
Each element after "%...\n" will be placed instead of % respectively.
Light
Werewolf006
09-13-2005, 08: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.
galagast
09-13-2005, 08:49 AM
cool!, I never knew about the printallelements function, this will have to go to my notes folder, thanks light!
Light
09-13-2005, 12:55 PM
Jeff,
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.
Light
galagast
09-14-2005, 02: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!
Light
09-14-2005, 03:28 AM
Jeff,
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 += ")"
)
txt
)
getArrayElements arr
)
You might use it if you want.
Light
CGTalk Moderation
09-14-2005, 03: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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.