Scripts Menu

The Scripts menu contains commands that are provided by script files or plug-ins. Moho includes several scripts for a variety of different tasks, and you can also download more scripts written by other Moho users. These scripts are all written in the Lua programming language - if you're interested in creating your own scripts, feel free to examine the scripts in the scipts/menu sub-folder in the Moho program folder.

The scripts in this menu are divided into several sub-menus, according to their function:

3D

The scripts in this menu are used to create or manipulate 3D models.

Cube

Creates a new 3D layer that contains a simple cube. The color of the cube is determined by the current fill and line colors.

Rotate X

Rotates the current 3D layer 90 degrees around the X axis. This can be useful when importing a 3D model if the model's "up" direction is not the same as Moho's - just use this command (and the other rotate commands) to align the model properly.

Rotate Y

Rotates the current 3D layer 90 degrees around the Y axis.

Rotate Z

Rotates the current 3D layer 90 degrees around the Z axis.

Torus

Creates a new 3D layer that contains a simple torus (donut). The color of the torus is determined by the current fill and line colors.

Camera

These scripts are used to move the camera around and to create camera-related effects.

Handheld Camera

Adds noisy interpolation to the camera animation channels to simulate a handheld camera.

Orbit Camera...

Adds animation to the camera to cause it to rotate around the current scene. You can specify how long this should take, how far out the camera should be, and the direction of rotation.

Draw

These scripts can be used to create vector objects in Moho.

Polygon...

Draws a polygon shape in either the current vector layer, or a new layer. Uses the current fill and line colors to color the polygon.

Star...

Draws a star shape in either the current vector layer, or a new layer. Uses the current fill and line colors to color the star.

Triangle

Draws a triangle in the current vector layer. Uses the current fill and line colors to color the triangle.

Other

Scripts that don't fit any other category can be found here.

Auto Weld

This script looks for points in a vector layer that line up with one another, but that aren't welded. It then tries to weld these points together. This can be useful when importing some types of vector files from other programs.

Credits...

This script can be used to create lists of credits, or other screens of text. The script will prompt you to select a text file containing the text you want to use. In the text file, each "screen" of text should be separated by a blank line. Take a look at the file "sample_credits.txt" in the Moho program folder to see how this text file should be set up.

Layer Trail...

Causes a trailing line to be drawn that follows the movement of the current layer. Be sure that the layer actually has some movement, or this script will appear to do nothing.

Particle Effects

These scripts can be used to create particle effects like smoke, fire, or rain. Many of these effects can be time-consuming to render, so be aware of that if you plan to use several of them in a single animation. Also, even though they can be exported to Flash, these effects can be too complex for the Flash player to play at full speed. Plus, without the blur effects these scripts use, they won't look very good in Flash. These effects are really useful only if you plan to export to a movie or still image format, not Flash.

Energy Cloud...

Creates a blobby glowing cloud effect.

Explosion...

Creates an explosion effect. The explosion starts at the current frame, and will fade to a smoke cloud over time.

Rain

Inserts a falling rain effect.

Smoke...

Inserts a plume or cloud of smoke.

Snow

Creates a falling snow effect.

Sparkles...

Inserts a cluster of spiraling sparkles. This effect is very effective if you bind it to another moving object - for example, the end of a magic wand.

Script Writing

This menu contain utility scripts that can be used as examples for writing your own scripts. If you don't plan to write your own scripts, you can completely ignore this menu.

Alert Test

Demonstrates how a script can use an alert box to provide some information to the user.

Error Test

This script intentionally creates a runtime error. The purpose is to show how the Lua Console appears to display the error. When you write your own scripts, the console window will be very helpful when tracking down errors.

Load Data File...

This script is a demonstration of how a Lua script can read data from an external file. It doesn't do anything useful itself, but it could be used as a starting point if you wanted to write a script to import some kind of custom data.

Print Globals

Prints out all global variables currently defined in Lua.

Print Moho API

Prints out all functions, constants, and global variables that Moho provides through its scripting interface. This is not meant to be the documentation for Moho's scripting interface, but some script writers may find it useful.

Print Test

A simple example that shows how you can print output in a Lua script. The printed output will appear in the Lua Console window. Printing data in the console window is not generally useful when your script is delivered to regular Moho users, but can be very helpful when writing a script to track down bugs.

Sound

The scripts in this menu use sound to control some part of an animation.

Bone Audio Wiggle...

This script uses the volume of a sound file that you select to animate the angle of the currently selected bone. Use this script to make a character or object move in sync with a sound.

Visibility

These scripts affect the visibility of a layer - for example, causing it to fade in and out.

Fade...

Causes the current layer to fade in or out over a specified number of frames. If you want a layer to appear or disappear suddenly, it is better to change the value of the layer's visibility channel. However, this script should be used when you want a layer to appear or disappear more gradually.

Wavy Fade...

This script combines the Fade effect above with the Wavy effect below. It can only be used with vector layers.

Warp

This set of scripts is used to distort the contents of a vector layer, applying various animated warping effects.

Black Hole...

Causes the selected points in a vector layer to swirl around in an inward spiral motion towards the origin point of the layer.

Wavy...

Causes the selected points in a vector layer to move in a wavy or underwater style.