Overview (Storage Place Macro)

   Print  Previous  Next

Introduction

Storage Place Macros affect effects placed in Storage Places.
That means the complete effect including all of its Layers is affected.
Storage Place Macros are stored together with a MADRIX Setup file.
Moreover, it is possible to save macros as separate files. The file extension of a macro is *.mms. The extension of a compiled macro is *.mcm.

Storage Place Macro

 
Storage Place Macro ButtonEditor - Controls the corresponding Macro Editor.

 

Storage Place Macro Button

Macro - Allows you to configure and manage a Macro. At the same time this means that no Macro is running or included.

Storage Place Macro Button

Deactivated [Macro Included] - A macro is included/inserted in the Macro Editor, but the macro is currently not running.

Left Mouse Click - Click once to activate the Macro.

Storage Place Macro Button

Activated - A macro has been compiled and is currently running.

Left Mouse Click - Click once to deactivate the Macro.

Right Mouse Click - Opens the context menu.

Edit... - Opens the Macro Editor to write, edit, include, and compile Macros.

Open... - Allows you to load a Macro from an external file [of the file type *.mms and *.mcm]. Once loaded, the Macro will automatically be activated.

Copy - Allows you to copy the Macro to the clipboard of the computer.

Paste - Allows you to paste the Macro from the clipboard into the currently selected Macro Editor. If the copied Macro is running, the new Macro will be automatically activated as well. If the copied Macro is deactivated, the new Macro will be automatically deactivated as well.

Clear - Deletes all content of the Macro Editor and thereby deactivates and erases any Macro.

 

Functions Called By MADRIX

Overview

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

void InitEffect() 
void PreRenderEffect()
void PostRenderEffect()
void MatrixSizeChanged() 

 

 

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

 

InitEffect

(Automatically included in a new macro)

InitEffect is called by MADRIX whenever the macro needs to be initialized. This is the case after compiling and starting a new macro or when the user pressed the Start button of the »Script Editor. A macro 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 a 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 macro.

 

PreRenderEffect

(Automatically included in a new macro)

PreRenderEffect is called before the Storage Place is going to be rendered. Changes done here affect the current frame, but may be overwritten by the Storage Place itself.

 

PostRenderEffect

(Automatically included in a new macro)

This function is called after the Storage Place has been rendered. Here, the result of the Storage Place can be manipulated. You could use a filter on it, for example.

void InitEffect()

{

    

}

void PreRenderEffect()

{

}

void PostRenderEffect()

{

    color c = {random(0, 255), random(0, 255)};

    Clear(c);

}

 

This example uses the function PostRenderEffect to fill the matrix after initializing a random color for this task.

Note: The matrix, which the macro manipulates, is the same matrix that the Storage Place uses to calculate itself. The Storage Place may rely on the output being the input for the next frame with undefined behavior.

Also note: Mapping operations done in PostRenderEffect will affect the next frame, but not the current one. To control the current frame, please use PreRenderEffect.

 

MartrixSizeChanged

(Automatically included in a new macro)

MatrixSizeChanged 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

When you open the Storage Place Macro Editor, the empty standard macro will look like this:

@scriptname="";

@author="";

@version="";

@description="";

 

void InitEffect()

{

 

}

 

void PreRenderEffect()

{

 

}

 

void PostRenderEffect()

{

 

}

 

void MatrixSizeChanged()

{

 InitEffect();

}

 

MADRIX Version: 5.1b | Script Version: 3.10
[Ctrl & +/-] = Zoom In/Out | [Ctrl & 0] = 100%
Print   Previous   Next