PDA

View Full Version : utility objects


Fossor
10-10-2003, 10:26 PM
Just Started with maxscript...and get stuck :D

Let's say i need 20 spinners or buttons in my utility
Is it possible to make them with the for loop?

like:
utility test "Test"
(
for i=1 to 20 do
(
spinner......
)
)


Thanx

magicm
10-10-2003, 11:38 PM
it is possible, but not using the 'conventional' way of creating a rollout. you need the execute command to accomplish this. this command allows you to evaluate a string.

so execute "10+10" results in 20

using this same technique you can build rollouts dynamically:

-----------------------------------------------------------------------------------

-- this variable will hold the rollout string
strRollout = ""

-- make sure you escape double quotes inside strings using a backslash character
strRollout += "utility test \"Test\"
(
"
for i=1 to 20 do
(
   -- add a spinner and number it using the i-loop
   strRollout += "   spinner spn" + (i as string) + " \"Caption\"\n"
)
strRollout += "
)"

-- execute the string
execute strRollout

-----------------------------------------------------------------------------------

the string strRollout will contain:

utility test "Test"
(
   spinner spn1 "Caption"
   spinner spn2 "Caption"
   spinner spn3 "Caption"
   spinner spn4 "Caption"
   spinner spn5 "Caption"
   spinner spn6 "Caption"
   spinner spn7 "Caption"
   spinner spn8 "Caption"
   spinner spn9 "Caption"
   spinner spn10 "Caption"
)


the execute then evaluates this string just as if it is a normal script that gets evaluated..


good luck ;)
Martijn

Fossor
10-11-2003, 12:32 AM
:eek: Wow! Thanx man!

Bobo
10-11-2003, 12:39 AM
Originally posted by Fossor
:eek: Wow! Thanx man!

In MAX 5 and higher, there is a set of functions to create dynamic rollouts like that. See "RolloutCreator Functions" in the Online Help. Also see the "How To" - "... Enhance the Morpher Modifier With Floating Controls" tutorial which uses the method magicm suggested...

If you are really just starting with MAXScript, you might find this stuff a bit too advanced for your level.

Cheers,
Bobo the Clown

Fossor
10-11-2003, 01:13 AM
Originally posted by Bobo
In MAX 5 and higher, there is a set of functions to create dynamic rollouts like that. See "RolloutCreator Functions" in the Online Help. Also see the "How To" - "... Enhance the Morpher Modifier With Floating Controls" tutorial which uses the method magicm suggested...


I'm using max 4 :D

If you are really just starting with MAXScript, you might find this stuff a bit too advanced for your level.


Really :) 2 days in fact. Actually I have some experience in programming from Assmbler to C++ and ActionScript. So i don't see any problem.

Cheers,
Bobo the Clown



Always nice to meet some comrades-in-arms!:beer:

Thanx for support! :)

Bobo
10-11-2003, 01:22 AM
Originally posted by Fossor
I'm using max 4 :D


This does not mean that you cannot use the MAXScript tutorials - they are pretty much Max 4 compatible (I wrote them for the VIZ4 edition of the help, so they should work except for the one I just mentioned which relies on an extension formerly only available in the SDK and then added to Max 5).
You can download a copy of the MAXScript 5.1 Help from the official discreet support forum page.
http://www2.discreet.com/support/max/download/download.php3

Fossor
10-11-2003, 01:41 AM
Originally posted by Bobo
This does not mean that you cannot use the MAXScript tutorials - they are pretty much Max 4 compatible (I wrote them for the VIZ4 edition of the help, so they should work except for the one I just mentioned which relies on an extension formerly only available in the SDK and then added to Max 5).
You can download a copy of the MAXScript 5.1 Help from the official discreet support forum page.
http://www2.discreet.com/support/max/download/download.php3

It's good to know! I have not thought of this possibility :shrug:

Thanx!:)

CGTalk Moderation
01-16-2006, 07:00 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.