Forum Groups
  All forums
    Help & Feedback
      Questions
      Work in progress
      Finished Art
      Non-Max related
    Community
      Offtopic
      News
    Hardware
    Photography


Featured Threads
  Indespensible MaxScripts, Plugins and 3rd Party Tools
(18 replies)
  Jokes!
(506 replies)
  The allmighty FREE Resources Thread !
(17 replies)
  The Life of a Sea Turtle - Tutorial by mrgrotey
(146 replies)
  So what are you working on? =)
(5032 replies)
  Maxforums member photo gallery index
(114 replies)
  Maxforums Member Tutorials
(89 replies)
  spam alert!!!
(4617 replies)
  three cheers to maxforums...
(220 replies)
  101 Things you didnt know in Max...
(197 replies)
  A Face tutorial from MDB101 :D
(95 replies)
  Maxforums.org Members Gallery
(516 replies)
  SON OF POST YOURSELF
(634 replies)
  Dub's Maxscript Tutorial Index
(119 replies)

Maxunderground news unavailable

 
First page  Go to the previous page   [01]  [02]  Go to the next page  Last page
 
Very introductory Maxscript tutorial 1
show user profile  Dub.
This tut should take about 5 mins to complete.

I'll hopefully do a few of these over the next while. I'll start off really really basic for those who have always wanted to learn maxscript but haven't been able to get started. (that was me for a long time!)

The best way to learn maxscript is to learn a few basic tricks that you can use in your everyday work. You can then extend your knowledge as you come across tasks that you can *almost do with your current knowledge.

Intro

Ok, first of all I'll go over a few basics.

To follow allong with these tuts, open the maxscript listener by hitting F11.

The pink area up the top is the listener where if you enable the macrorecorder, it will tell you what max is doing in maxscript terms as you do regular tasks in max. We won't pay attention to this area in this tut.

The white area is where everything will be happening. Delete the "Welcome to maxscript" message so we have a blank slate to start with.

The Basics

Create a sphere in the scene so we have an object to talk to.

There are two simple ways to refer to an existing scene object in max. You can select it and refer to the selection or you can refer to it by name. The way maxscript refers to objects is by their name with a $ in front. So to refer to the sphere you just created, type:

$Sphere01

Now, with the cursor at the end of that, hit the enter on the numeric keypad. That will execute the current line. If you want to execute more than one line, select them all and hit numeric enter.

once you hit enter, maxscript will return the following in blue:
$Sphere:Sphere01 @ [10,-5,0]

The last numbers will vary depending on where you created the sphere in the scene.
This is confirmation that you are talking about the sphere and that your syntax is correct.

Object Attributes

Now lets try something slightly more useful. Type:

$Sphere01.radius

and hit numeric enter to execute. maxscript will return the radius of the sphere!
Notice how there is a hierarchy to the command. You started with the object itself then a period (.) then the parameter belonging to the object. You can refer to other parameters the same way. ie;

$Sphere01.segments will return the segments value.

Setting attribute values

Now what we want to do is change the values not just look at them.

Simply type:

$Sphere01.segments = 35

You'll notice as soon as you execute the line, the sphere changes it's segments to 35!
Well you could have done that faster with the GUI right? What if you have 25 spheres all with different radii and you want to just change their segment count? (a common problem)

Working on selections of many objects

I referred earlier to the fact we can refer to objects by referring to the current selection. In maxscript the shortcut to this is to simply select an object (select your sphere) and type:

$

When you execute this, you'll get the same result as if you had typed $Sphere01
Now we are going to exploit the power of "mapped functions"

Create 10 spheres of random radii and position. Select them all. Now type the following and execute it:

$.segments = 10

All the spheres will retain all their setting except the segments on all of them will be set to 10.

Thats it for now!

Conclusion

Play around with other objects and other attributes.
if you want to know what parameters are availiable to you on a given object, type:

showproperties $

For the sphere, that will return the following list:

.smooth : boolean
.radius : float
.segs : integer
.mapcoords : boolean
.slice : boolean
.hemisphere : float
.sliceFrom : angle
.sliceTo : angle
.chop : integer
.recenter : boolean
.realWorldMapSize : boolean
false

Enjoy!






read 46122 times
11/21/2006 2:50:48 PM (last edit: 11/6/2009 3:51:32 PM)
show user profile  TiMoN
Never even tried to write any max-scripts, so "really basic" sounds good.

*saved*

Terribly boring signature.
read 46101 times
11/21/2006 3:12:21 PM (last edit: 11/21/2006 3:12:21 PM)
show user profile  -=LeadMagnet=-
same here timon.

Nice one Dub. I'll have a go at this later when my headache subsides.



Do A Barrel Roll!!!

read 46096 times
11/21/2006 3:14:06 PM (last edit: 11/21/2006 3:14:06 PM)
show user profile  horizon
woot tried it...when can we expect the next one, it's great but a bit short, need more need more now that I started


read 46078 times
11/21/2006 3:55:56 PM (last edit: 11/21/2006 3:55:56 PM)
show user profile  Dub.
haha :-)
I hoped it would have that effect.

I'll do another tomorrow.

I want it to be very simple so that people won't get scared off and instead have their appetite whetted for other more difficult tutorials.


read 46075 times
11/21/2006 4:01:57 PM (last edit: 11/21/2006 4:01:57 PM)
show user profile  horizon
I'm scared of nuttin!!!
give me a tut


read 46071 times
11/21/2006 4:09:40 PM (last edit: 11/21/2006 4:09:40 PM)
show user profile  Galadrim
good stuff man!
I keep tellin myself that I should learn scripts one day; and you have given me a much needed push.

read 46067 times
11/21/2006 4:15:41 PM (last edit: 11/21/2006 4:15:41 PM)
show user profile  paconavarro
GREAT DUB... I really want to learn MXS :)


--- http://www.exododw.com

read 46052 times
11/21/2006 4:56:40 PM (last edit: 11/21/2006 4:56:40 PM)
show user profile  Nik Clark
Nice one, Dub. Maxscript is awesome, and is an invaluable tool.





Click here to send me an emailClick here to visit my websiteClick here to visit my photo gallery on Flickr

read 46045 times
11/21/2006 5:02:24 PM (last edit: 11/21/2006 5:02:24 PM)
show user profile  jbrophy
/me sends a hit squad to Dub's house for giving away the secrets :P

j/k man. Good job




Jesse Brophy
jesse_brophy@hotmail.com


Fry Monkey

read 46032 times
11/21/2006 5:47:18 PM (last edit: 11/21/2006 5:47:18 PM)
show user profile  horizon
I think this is Dubs subtle plan to run Boomer labs out of bussiness


read 46025 times
11/21/2006 6:32:41 PM (last edit: 11/21/2006 6:32:41 PM)
show user profile  Dub.
haha

Nope!

As people reach the limits of maxscript, they will realise where C++ code is the better way to go and thats where Boomer comes in :-)


read 46017 times
11/21/2006 7:38:04 PM (last edit: 11/21/2006 7:38:04 PM)
show user profile  markoid
Real nice of you to do this Dub, cheers.
Maxscript looks sooo useful and it's an area of Max I never got to...'til now :)...........more, more

WEBSITE


read 45998 times
11/21/2006 10:49:11 PM (last edit: 11/21/2006 10:49:11 PM)
show user profile  vlady.
Just logged in to thank you very much. I'm working as a programmer, dreaming of getting a job in 3ds someday and raising money so I could go to college somewhere where it's beying thought.
Great thanks for this , please keep it up, I will follow the series =)
Vlad


I have somewhat changed the fluffy avatar.
read 45924 times
11/23/2006 2:57:54 AM (last edit: 11/23/2006 2:57:54 AM)
show user profile  Manolo
Really nice, Dub. After some years of maxing, 1st time I open the thingy -on purpose-. Looks highly promising.

Cheers,

Manolo
read 45890 times
11/23/2006 8:09:05 PM (last edit: 11/23/2006 8:09:05 PM)
 
First page  Go to the previous page   [01]  [02]  Go to the next page  Last page
 
#Maxforums IRC
Open chat window


Support Maxforums.org