View Full Version : Coding wire parameters

01 January 2008, 04:56 PM
Hi. I'm a certified noobie at MAXScript, and have what may very well be a pretty pedestrian question. I'd like to wire objects' z_rotations together using a MAXScripted rollout rather than the rightclick-quadmenu-buttons-buttons-select-morebuttons-parametersdialog-etc. method. Here's a quick demo of what specifically I'm trying to accomplish...

I'm struggling somewhat picking up the code flow for MAXScript. The MAXScript Reference is comprehensive, but it's literally a reference rather than a manual... a bit like learning to speak a new language armed with a dictionary but no grammar book. A couple of days ago a visual analogy occurred to me:

I'm hot to get a copy of Michele Bousquet's e-book, but have to chase up the cash to invest in a Kindle viewer. :shrug:

Thanks for your time.

01 January 2008, 06:35 PM
Wow. You're skipping to the back of the book already. You must be one of those people that reads the last page of a book first to see how it turns out. Scripted controllers are no "pedestrian" subject. Yep it is like learning a new language because it is a language. Think of functions as verbs and properties as adjectives. Nouns would be your objects. Your logic gates, if, and, =, ==, !=, etc. are your prepositions, sort of... I guess.

Anyway, you'll need to look up "Parameter Wiring" in the reference. Head to the bottom of that page and click on "Rotation Controller"

For specific code on that. I'd have to putter around too long. Pen might know it off the top of his head.

You'll need:

01 January 2008, 06:59 PM
Well you should do the tutorials that ship with Max on Max Script before you do any thing at all.

Also the Max Master, Bobo has done a DVD for beginners at and that might be a good start as well.

01 January 2008, 07:36 PM
I should also add that your visualy idea of learning a scripting language from the help doc is right. But, I wouldn't for instance want a full manual on the english language if I was just trying to find out how to spell a word. I would want the dictionary.

So the tutorials will get you there. Learning to wire one thing to another is easy but knowing what it is doing and how to use it in bigger scripts is not going to come from reading the section on wires.

01 January 2008, 09:20 PM
Thanks for the prompt responses, guys. As it happens, I have worked through the tutorials; enlightening in many ways, in other ways not so much (not that I expect ...or would want... a training venue that wipes my nose and zips my fly for me). Very little on SO manipulation, for instance, and practically nothing on Modifiers. Also worked through 3ds Max MAXScript Essentials (2nd edition).

After doodling around for several days I did manage to sort out Edit_Poly, though I haven't found any other sources to evaluate it against...

c = cylinder radius:20 height:10 heightsegs:1 sides:20


polyop.setFaceSelection c #{21,22}

polyop.setEdgeSelection c #{2}

select c

c.ButtonOp #SelectEdgeRing

max modify mode

ep = Edit_Poly()

addModifier c ep

subobjectlevel = 4

ep.SetOperation #Inset

ep.insetAmount = 10.0

subobjectlevel = 2

ep.SetOperation #ExtrudeEdge

ep.extrudeEdgeHeight = 10.0

ep.extrudeEdgeWidth = 2.0

ep.SetOperation #ChamferEdge

ep.chamferEdgeAmount = 5.0

subobjectlevel = 0

While I'm new to MAXScript, I've been working with JavaScript, ActionScript and XML for years, so MAXScript's syntax, operators, conditionals, etc. aren't a mystery. I have read through the "Parameter Wiring" and "Rotation Wire:RotationController" entries, but all I see is a list of properties and methods, without a simple sample of how these are strung together to make a working routine (and is "i-th" defined somewhere in the Reference?). If there are any examples floating around so I can see the procedure, I'd greatly appreciate it. I've dug aroung on the web without any luck. Thanks.

01 January 2008, 10:04 PM
Hi bhnh! Welcome to the throng!

There are plenty of questions on this subject in the forums...A little bit of searching will help and if you are having particular difficulties with the subject at hand, then makes all our lives eaiser if you have already banged your head against a brick wall for a few can share mine ;)

It also makes people more sympathetic ;)

Any hows...back to the question at hand...

Wire parameters is easy...and it's not...I say it's easy because I've worked it out...when I was trying to understand it, it was royal pain in the ... anyway...

One thing you might want to try is the MacroRecorder in the listener window, while it is not always useful, it can be handy to get an idea of what's going on under the hood, so to speak. Again, it's more of reference then anything else...

Here's the code I get for a right-hand connection using the quad the menu between two objects...
paramWire.connect $Box01.rotation.controller[#Z_Rotation] $Box02.rotation.controller[#Z_Rotation] "Z_Rotation*-1"You will HAVE TO do some reading on sub-animation properties to fully understand what is going on, as well as looking into controllers more deeply...but maybe this snipet will help...
(and is "i-th" defined somewhere in the Reference?)Actually, i-th is surprisingly a common term in many language references, although "n-th" might make more sense for you..."i" typically means "index" so you get "index-th", meaning a value from min to max in a list...

Finding EXACTLY what you want is rare, in any language reference and/or tut. You generally need to assemble alot of different ideas from a lot of different sources, I'd also recommend a visit to, great for picking up other people's scripts and disecting them...
and practically nothing on ModifiersReally, I think you're not looking hard enough...there is lots on modifiers. I'd start with "Modifier Common Properties, Operators, and Methods" and work my way around the modifier's from'll find that the ui names and the "class" names aren't always the same though ;)


01 January 2008, 10:21 PM
Thanks, Rusty; that's tremendously helpful. And you're absolutely right, I should've Searched the forum first. Between juggling deadlines and having all three kids home from college (you'd think they'd have outgrown squabbling by this time), coupled with impatience with myself (old dog, new tricks) I confess I jumped the gun.

BTW, thanks for "i-th". I've been writing code for about ten years and, oddly enough, I've never run into the term before.

U.S.S. Speed
01 January 2008, 11:00 PM
I fear there is many many way to do it depending how and where you want your rollout, and the ammount of customization you want.

Here is a quick code :
macroScript QuickWire category:"MyWire" buttonText:"Z Rot Wire" toolTip:"Z Rot Wire"
rollout MyRollout "Quick Connect"
checkbox TwoWay "Two Way Connection" align:#center checked:False triState:0
pickbutton FirstObject "Select First Object" align:#center width:140 toolTip:"Pick the first object to be wired" autoDisplay:True
pickbutton SecondObject "Select First Object" align:#center width:140 toolTip:"Pick the first object to be wired" autoDisplay:True
button Connect "Connect" align:#center width:140 tooltip:"Selection Tool"

on Connect pressed do
O1 = FirstObject.object
O2 = SecondObject.object

if FirstObject.object != undefined
if SecondObject.object != undefined
if TwoWay.state == True
Result = paramWire.connect2way O1.rotation.controller[#Z_Rotation] O2.rotation.controller[#Z_Rotation] "Z_Rotation" "Z_Rotation"

Result = paramWire.connect O1.rotation.controller[#Z_Rotation] O2.rotation.controller[#Z_Rotation] "Z_Rotation"
messagebox "Please select a second object." title:"No Second Object"
messagebox "Please select a first object." title:"No First Object"

if Result == False
messagebox "The connection between the 2 selected object couldn't be made." title:"Connection Failed"

on execute do
CreateDialog MyRollout width:150 height:105 lockHeight:True lockWidth:True

which you put into a .mcr file inside the UI/MacroScripts/ folder.
Once you ran it with the MaxScript > Run Script... menu, the script will show up in your Customize > Customize User Interface... menu, selectable to be bound to a shortcut, menu, button, etc.

Once you called the script, it would show up as a floating window similar to the image linked on this post.

Since you already have some experience in script and code, you should have quite an easy time to understand how it's written.

The MaxScript listener is an amazing tool to find the function you can't seam to find in the help.

01 January 2008, 11:56 PM
Wow. Thanks, USS. Comprehensive and very clear.

CGTalk Moderation
01 January 2008, 11:56 PM
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.