Overview (MAS Script Effect)

   Print  Previous  Next

Introduction

The MAS Script Effect provides the potential to create your own effects. That could be a completely new effect that MADRIX does not offer in its stock library of effects.
Basically, the MAS Script effect is an effect like any other effect in MADRIX, except that it interprets a script written in MADRIX Script to calculate the effect.
In this way, the MAS Script effect has full control over the effect matrix. It is called continuously to render the effect onto the matrix.
Scripts are stored as part of the effect. This means they are part of a stored Storage Place file or Setup file.
It is possible to save scripts as separate files. The file extension of a MAS script is *.mas. The extension of a compiled script is *.macs.
The MAS Script Effect is an effect of MADRIX. For that reason, its result can be controlled and manipulated by a »Macro For Effects like all the other effects as well.
The MAS Script Effect can be selected from the effect list like all the other effects.

MAS Script Effect Selection

 

 

Functions Called By MADRIX

Overview

There are several functions called by MADRIX in order to let the script react to different events.

void InitEffect() 
void RenderEffect() 
void MatrixSizeChanged() 

 

 

If a function is not needed by a script, it is not necessary to implement it. Regarding InitEffect and RenderEffect a message is printed out if one of them is missing. This is not an error, but only an information for the developer of the script.

 

InitEffect

(Automatically included in a new script)

InitEffect is called by MADRIX whenever the script needs to be initialized. This is the case after compiling and starting a new script or when the user pressed the Start button of the »Script Editor. A script can assume that any global variable is initialized with 0 and that any global array is empty as long as it has not been initialized with any value.

This function is the right place to initialize global variables, reset any arrays, set the speed of an effect, or whatever is necessary to (re)start the script.

 

RenderEffect

(Automatically included in a new script)

This function is called whenever the effect needs to be rendered. This is the right place to calculate the effect and draw it onto the matrix.

 

MartrixSizeChanged

(Automatically included in a new script)

MatixSizeChanged is called after the size of the matrix has been changed. This may be due to a change to the matrix settings or because a new map setting was set, e.g. caused by the call of a map function.

 

Standard Outline

A newly created macro for an effect will look like this:

@scriptname="";

@author="";

@version="";

@description="";

 

void InitEffect()

{

 

}

 

void RenderEffect()

{

 

}

 

void MatrixSizeChanged()

{

 InitEffect();

}

 

MADRIX Version: 3.6j | Script Version: 2.22
[Ctrl & +/-] = Zoom In/Out | [Ctrl & 0] = 100%
Print   Previous   Next