Notifications
Clear all

[Closed] utility objects

Just Started with maxscript…and get stuck

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

6 Replies

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”

)
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

😮 Wow! Thanx man!

Originally posted by Fossor
😮 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

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

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!

Thanx for support!

Originally posted by Fossor
I’m using max 4

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

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!