Notifications
Clear all

[Closed] a couple of easy noob questions

Hey, I’m new to maxscript, but not so new at max… haha

anyway, I’m a student at the Art Institute of Los Angeles, where i major in video game art and design and i’m looking to learn more outside of school.

Anyway, i picked up maxscripting the other day, and i have a couple questions. I’m not new to programming, as i make my money doing freelance webdesign, know actionscript, know a little bit of c++ and java, and, just over all… i pick it up pretty easily.

  1. When i create an object, whats the code to rotate it a certain angle
  2. I’ve set up 2 sliders, one for amount of objects, and one for distance apart. what would be the best way to accomplish this?

and, most importantly
3. Where is the number one place you reccomend for tutorials or possible online courses?

Thanks in advance, and i’m sure you’ll hear more from me in the future!

3 Replies

Ok, well, because your first two posts on this forum have to be monitored, it gave me time to figure that crap out.

Anyway, I was trying to think of something simple to make with my 2 day knowledge of maxscripting and came up with this Simple Rail Creator thingy.
Download:
http://putstuff.putfile.com/66263/591118


rollout benrail "Simple Railings"
(
	label raillabel1 "Main Rail"
	spinner railheight "Rail Length" range:[0,9999,100]
	spinner railradius "Rail Radius" range:[0,9999,5]
	label raillabel2 "Supports"
	spinner supports "Supports" range:[0,100,5] type:#integer
	spinner supportheight "Support Height" range:[0,9999,50]
	spinner supportradius "Support Radius" range:[0,9999,3]
	label raillabel3 "Note: Support radius should"
	label raillabel4 "be smaller than Main Radius"
	label baselabel1 "Base"
	spinner baseheight "Base Height" range:[0,9999,3]
	spinner baseradius "Base Radius" range:[0,9999,4]
	button railbut "Create Rail"
	label raillabel5 "Made by Bennett Gross"
	label raillabel6 "							   2007"
	on railbut pressed do
	(
	newrailobj = cylinder height:railheight.value radius:railradius.value
	rotate newrailobj (angleaxis -90 [1,0,0])
	move newrailobj [0,0,supportheight.value]
	x_offset = 0
	x_offset2 = 0
	spacing = (railheight.value)/(supports.value)
	--baseradius = (supportradius.value)*(1.5)
	--baseheight = (supportheight.value)*(.07)
	for i = 1 to supports.value do
		(
		newrailsup = cylinder height:supportheight.value radius:supportradius.value
		move newrailsup [0,x_offset,0]
		x_offset += spacing
		newbasesup = cylinder height:baseheight.value radius:baseradius.value
		move newbasesup [0,x_offset2,0]
		x_offset2 += spacing
		)
		newrailsup2 = cylinder height:supportheight.value radius:supportradius.value
		move newrailsup2 [0,railheight.value,0]
		newbasesup2 = cylinder height:baseheight.value radius:baseradius.value
		move newbasesup2 [0,railheight.value,0]
	)
)
createdialog benrail

Anyway, I included the code so maybe if you guys have the time to go through it and find things that could make my life easier, or just critique it. I would love to know anyway i can optimize it.

Hi,

  1. rotate $ [90,0,0] wil rotate the selection 90° in X
  2. don’t understand
  3. read up the MaxScript reference, that is the Best ressource you will ever find
    lots of example scripts and howto…

Hey man, awesome work for your second day! My critique is that when doing many different things like this, I would wrap them up in a single undo:


 on railbut pressed do
 (
    undo "Create Rail" on
    (
 	  do stuff
    )
 )
 

Also, when I make my floaters I check to see if they are already open:


 if benrail != undefined do ( closerolloutfloater benrail )
 benrail = newrolloutfloater "Simple Railings" 190 300