Community
3ds Max Programming
Welcome to Autodesk’s 3ds Max Forums. Share your knowledge, ask questions, and explore popular 3ds Max SDK, Maxscript and Python topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Learning MaxScript and can't figure out why this script doesn't work.

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
734 Views, 2 Replies

Learning MaxScript and can't figure out why this script doesn't work.

I followed a Joe Gunn tutorial for writing a script to link objects. I then made a dialog box out of it, but it doesn't work. I've attached the script. It's short and simple. Two objects are selected and linked. Any help would be appreciated.

2 REPLIES 2
Message 2 of 3
Swordslayer
in reply to: Anonymous

The error message in the listener will basically tell you as much, you used myStart and myEnd in the rollout for buttons, use their .object property, not the button itself. Also, pickButtons don't have 'on pressed' event handler, they use 'on picked' but you don't even need it in simple cases like this:

 

try destroyDialog _Link catch()
rollout _Link "Link Objects"
(
	pickbutton myStart "Controllee" autoDisplay:on
	pickbutton myEnd "Controller" autoDisplay:on
	button moveTo "Position"
	button _Go "Link"
	
	on moveTo pressed do
	(
		if isValidNode myStart.object and isValidNode myEnd.object do
			myStart.object.position = myEnd.object.position + [0,0,20]
	)
	on _Go pressed do
	(
		if isValidNode myStart.object and isValidNode myEnd.object do
			myStart.object.parent = myEnd.object
	)		
)
createDialog _Link
Message 3 of 3
Anonymous
in reply to: Swordslayer

Thanks. Appreciate the help

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report