Writing A Script

   Print  Previous  Next

Introduction

Generally, a script consists of many instructions, which you can enter in any desired editor. The result is called source code or script.

In MADRIX a Script Editor is included, too. You can use it to program new scripts or to edit scripts that already exist. Like said before, the following examples mostly refer to the MAS Script effect.

Loading a ScriptBefore a script can be run, it has to be loaded into MADRIX. Please use the "Load" button in the dialog of the MAS Script effect. The script will start automatically when loading was successful.

 

The First Example

A first example of a MADRIX Script can be seen below. You can simply copy the source code and execute it. At the moment, it is not so important to understand all the details. The example repeatedly writes a certain text line in the output window of the editor.

Please open the Script Editor of the MAS Script Effect. Simply copy the whole example into the Editor (and replace the existing code):

@scriptname="";

@author="";

@version="";

@description="";

 

void InitEffect()

{

 

}

 

void RenderEffect()

{

    WriteText("Hello World");

}

 

void MatrixSizeChanged()

{

 InitEffect();

}

 

 

Then, "Complile" the script (to be found in menu "Script" or use the key F5). The function WriteText(string text) writes a given character string into the output window of the Script Editor. In this case it is "Hello World". You should see this message in the output area.

You can save the script by choosing "File > Save as ...".