Sample Scripts in the Scripts/Examples Directory

This page describes some of the files found in the Scripts/Examples directory. Most sources are well-commented and can be used as addition to this document.

Example Scripts:

Example_StartHere.ms

This file was formerly known as Demo.ms and was written by the original developer of MAXScript to provide the first steps in learning the capabilities of the language. It can be very helpful for new users and also has a certain historical value for advanced users!

From the source code comments: "This script is intended to give an interactive walk-through of some of MAXScript's main features. The best way to view this file is to step through it in the MAXScript listener window." See code comments for details!

Example_Bank and Turn.ms

A bank-and-turn function that takes any animated object (not just one that is animated along a path) and will generate bank and turn keyframes, with controls similar to those in the path controller.

Example_BasicCommands.ms

Demonstrates basic object creation operations like array of objects, changing properties, randomizing values etc.

Example_BendHose.ms

A tutorial demonstrating the use of script controllers.

Example_BoxArrayAnimation.ms

Creates a pattern of boxes.

Example_ExcelChart.ms

Creates an Excel OLE object and an Excel chart. Opens Excel, creates a spreadsheet and animates a 3d chart. Requires Excel to run.

Example_FLOCKING.ms

This script takes a prototype object animated along a bezier spline path and creates randomized copies of it to generate an approximated flocking motion. You can set radnomizing values beliow that control how much the path and timing of each cone is perturbed

Function_FLOCKFNS.ms

The flocking-by-path functions required by the file Example_FLOCKING.ms

Example_ParticleObjects.ms

this is a utility that lets you pick a particle system and a source of scene objects and will make copies of the source, 1 for each particle and then animate them to follow particle movement - essentially turning any of the legacy MAX particle systems into a geometry-based system.

Example_RandObjects.ms

This is a scripted utility that can be used to generate a random set of copies of a picked object. Once created, you can twiddle the spinners to make live changes to the copy count and position and rotation spreads. It also has a prune-overlaps button which using an intersection pruning function you might find generally useful.

Example_Reset Xform.ms

A scripted function that does the same as the Reset Transform Utility.

Note:

3ds Max 6 and higher provide direct access to the Reset XForm Utility functionality, but this function can be very useful to learn the ways object transformations work under the hood in 3ds Max!

Example_RuledMesh.ms

This function generates a mesh bounded by the 1st curves in the two given splines and that has the given number of segments along curves. 

Example_SphereHelix.ms

This script creates and moves a set of spheres on a helical path. Each sphere accelerates with different magnitudes as they move.

Example_SplineDesigner.ms

Spline Designer / Function Parsing script. Shows how to use the Execute command to parse a maths function and plot a graph (and then build a spline) with it.

Example_Tutorial1.ms

Example_Tutorial9.ms

Example Functions

Function_DetachMesh.ms

A utility function that will generate a new scene object by detaching the currently selected faces in the given object. You could modify this to take or compute the faces to detach as you need.

Function_DumpProperties.ms

This function generates a 'dump' of all the accessible properties on the object or objects you give it.

Function_Objects.ms

This file contains a set of utility functions for working with objects by name in a scene.

Function_RoundTo.ms

Rounds a value to n decimal places.

Bitmap Drawing Functions

Example_BitmapCircle.ms

Bcircle Function - This function draws a circle in a bitmap.

Example_BitmapEllipse.ms

BEllipse Function - This function draws an ellipse in a bitmap.

Example_BitmapLine.ms

BLine Function - This function draws a line in a bitmap.

Reading ASCII Files

Example_ASCII Read.ms

ASCII.dat

Demonstrates the import of animation from an external ASCII file (ASCII.dat) using MAXScript.

Simple Rollouts, Dialogs and Floaters

1Example_DialogBox.ms

Shows the very basic form of a Dialog definition.

2Example_FloatingWindow.ms

Shows the very basic form of a Rollout Floater definition.

3Example_Utility.ms

Shows the very basic form of a Utility definition.

Sample Painter Tools

PaintCylinders.ms

PaintCylindersConnect.ms

PaintCylindersInsidePoly.ms

PaintCylindersMotion.ms

PaintLotsCylinders.ms

PaintMeshSel.ms

PaintToolsDoc.ms

PlacementTool.ms

Sample files showing practical usage of the PainterInterface : ReferenceTarget

Sample Utilities

LODTester.ms

Utility for establishing/previewing near/far switching distance on discrete LOD object representations