Notifications
Clear all

[Closed] Maxscript at the most basic level

Hi all!

Just started to look at maxscript, The maxscript listener to be exact. So im thinking, ok ive always wanted a poly plane primitive, lets start with that. So i make a plane, set the height and with segments to 1. Convert it to Poly move the two lines of code to my freshly made custom toolbar. Click the button and voila, a poly plane.

Problem is this, eventhough my plane has lengthsegs:1 widthsegs:1 set, the script seems to skip this and use the last used length and with segments from the plane primitive.

Why will it not use what i define in the script? is there a command i can use to clear all segments before i define my own in the script?

Cheers!!

Media

5 Replies

Thats strange, I`ve tried it here and it works?

That is strange indeed. Have you tied to create a plane primitive with multiple height and length segments and then tried the script after that? And it still spits out a single segmented plane?

This is the script:

macroScript Macro1
category:“DragAndDrop”
toolTip:“Create an editable Poly plane”
(
Plane length:70 width:70 pos:[-5.81223,-12.3896,0] isSelected:on lengthsegs:1 widthsegs:1
macros.run “Modifier Stack” “Convert_to_Poly”
)

It works as long as the last plane primitive i created has height and with seg at 1. But if the plane has multiple segments my script wil inherit that number ans skip the script defined number.

Cheers.

try these:


(
myPlane = Plane length:70 width:70 pos:[0,0,0] isSelected:on lengthsegs:1 widthsegs:1
convertToPoly myPlane
)

or


(
myPlane = Plane length:70 width:70 pos:[0,0,0] lengthsegs:1 widthsegs:1
myPlane.length = 70
myPlane.width = 70
myPlane.pos = [0,0,0]
myPlane.lengthsegs = 1
myPlane.widthsegs = 1
convertToPoly myPlane
select myplane
)

but your code seems to work fine here…

hope it helps

I found out that i need to restart max to make my scripts work… If i make any changes to the script i.e. add a line of code it wont work untill ive restarted max… Think i need to reinstall it… Or maybe sp1 will fix it.

Thanx anyways guys!!

There are two types of scripts you can create in Max. MAXScripts (.ms files) and Macroscripts (.mcr files). Both scripts share the same language and syntax and are generally refered to by the default description of “MAXScript”.

Without getting into too much of the history of the language know that at first MAXscripts couldn’t be executed from hot keys, toolbars or menus. A later revision of Max introduced Macroscripts, which got around that limitation.

So, when you write some code in the Listener and then drag it to a toolbar you are creating a Macroscript. Macroscripts are buffered in memory. When you execute them you get the most recent version of the script that is in the buffer. That may not be the most recent version of the script on your HD, though, especially if you have made a change to a Macroscript after Max has started.

To refresh the buffer with the latest code you can either quit and restart Max (as you have discovered) or do a macros.load() command in the Listener window. macros.load() will flush the buffer and reload all Macroscripts from the HD.