Using Data Types

  Previous  Next

Primitive Data Types

Overview

Variables offer the possibility to store data. The kind of data depends on the data type. MADRIX Script supports the following primitive data types:

Data Type

Sample Values

Description

int

0, 3, -345, 234,
0x7f, 0xC001CAFE

32-bit data type (signed binary integer). It stores integral numbers between -2,147,483,648 and 2,147,483,647 (inclusive).
Numbers starting with 0x are interpreted as hexadecimal values.

float

0.0, -12.45, 3.1415

32-bit data type. It stores floating-point numbers.

string

"Hello World!", "-3"

Stores character strings of variable length.

bool

true (1), false (0)

Used for implicit use of logical values and comparisons.

 

Data Type Bool

The data type bool is only used internally and cannot be used to declare a variable. This data type only has to possible values, true or false. It is used for logical operations and for different statements like the »if statement. For example, the following expression results in a bool data type and false as its value.

3 > 4
int i = 3 > 4 //results in 0
int i = 3 < 4 //results in 1
 
//usually it is used like this
if(3 > 4)
{
 do something
}
 
 

True And False

As stated above, a boolean expression results only in true or false.

Furthermore, the keywords true and false are used within MADRIX Script as function parameters or return values. Those parameters and values are of the type int. In such cases true and false represent 1 and 0, respectively. They can be used in upper case (TRUE / FALSE) or lower case (true / false).

 

Non-Primitive Data Types (Structures)

Complex data types, so-called structures, consist of different elements. The elements of a structure are accessed by their names in the following way: nameOfVariable.nameOfElement. For example, col.r, if col is a variable of data type color. The following table is an overview of the structures MADRIX Script provides.

Structure

Elements

Description

color

int r

int g

int b

int w

int a

color stores a color value.

 

There are 5 channels (red, green, blue, white, alpha) with values between 0 and 255.

 

Example: color c = {255, 255, 0, 0};

Member examples: c.r, c.g, c.b, c.w, c.a

 

Learn more »List Of Global Variables And Constants

 

»Script Example
 

date

int day

int weekday

int month

int year

date stores a date.

 

Values for day include 1 to 31 for a single day of the month.

Values for weekday include: 0 = Sunday, 1 = Monday, ..., 6 = Saturday.

Values for month include 1 to 12 for every single month of the year.

Values for year include year dates.

 

Example: date d = {24, 11, 1980};

Member examples: d.day, d.weekday, d.month, d.year

 

»Script Example

time

int hour

int min

int sec

time stores a certain time.

 

Valid values are: hours: 0 .. 23, minutes: 0 .. 59, seconds: 0 .. 59.

 

Example: time t = {12, 05, 00};

Member examples: t.hour, t.min, t.sec

 

»Script Example

timecode

int hours

int minutes

int seconds

int frames

timecode stores a certain timecode.

 

Valid values are: hours: 0 .. 23, minutes: 0 .. 59, seconds: 0 .. 59., frames 0 .. 23/24/29 [depending on the set format/frame rate]

 

Example: timecode tc = {12:15:10:12};

Member examples: tc.h, tc.m, tc.s, tc.f

font

int height

int width

int escapement

int orientation

int weight

int italic

int underline

int strikeOut

int charset

int outprecision

int clipprecision

int quality

int pitch

int family

string fontname

 

font stores a specific font face.

 

height specifies the size of the font and requires an integer value.

width specifies the wideness of the font and requires an integer value.

escapement specifies the desired rotation angle in tenths of a degree and requires an integer value.

orientation should be set to the same value as escapement and requires an integer value.

 

weight specifies the weight of the font. Valid values are:
FONT_WEIGHT_DONTCARE

FONT_WEIGHT_THIN

FONT_WEIGHT_EXTRALIGHT

FONT_WEIGHT_LIGHT
FONT_WEIGHT_NORMAL

FONT_WEIGHT_MEDIUM

FONT_WEIGHT_SEMIBOLD

FONT_WEIGHT_BOLD

FONT_WEIGHT_EXTRABOLD

FONT_WEIGHT_HEAVY

 

italic specifies the sloping of the font and requires an integer value:
0 (off) or 1 (on).

 

underline draws a line under the font and requires an integer value:
0 (off) or 1 (on).

 

strikeOut draws a line through the middle of the font and requires an integer value:
0 (off) or 1 (on).

 

charset specifies the character set of the font. Valid values are: 
CHARSET_ANSI

CHARSET_DEFAULT

CHARSET_SYMBOL

CHARSET_SHIFTJIS

CHARSET_HANGEUL

CHARSET_HANGUL

CHARSET_GB2312

CHARSET_CHINESEBIG5

CHARSET_OEM

CHARSET_JOHAB

CHARSET_HEBREW

CHARSET_ARABIC

CHARSET_GREEK

CHARSET_TURKISH

CHARSET_VIETNAMESE

CHARSET_THAI

CHARSET_EASTEUROPE

CHARSET_RUSSIAN

CHARSET_MAC

CHARSET_BALTIC

 

outprecision specifies how closely the output must match the requested height, weight, and other attributes of a font. Valid values are:
PRECIS_OUT_DEFAULT

PRECIS_OUT_STRING

PRECIS_OUT_CHARACTER

PRECIS_OUT_STROKE

PRECIS_OUT_TT

PRECIS_OUT_DEVICE

PRECIS_OUT_RASTER

PRECIS_OUT_TT_ONLY

PRECIS_OUT_OUTLINE

PRECIS_OUT_SCREEN_OUTLINE 
PRECIS_OUT_PS_ONLY

 

clipprecision specifies how to clip characters that are partially outside the clipping region. Valid values are:
PRECIS_CLIP_DEFAULT

PRECIS_CLIP_CHARACTER

PRECIS_CLIP_STROKE

PRECIS_CLIP_MASK

PRECIS_CLIP_LH_ANGLES

PRECIS_CLIP_TT_ALWAYS

PRECIS_CLIP_DFA_DISABLE

PRECIS_CLIP_EMBEDDED

 

quality specifies the quality of the font. Valid values are: 

QUALITY_DEFAULT

QUALITY_DRAFT

QUALITY_PROOF

QUALITY_NONANTIALIASED

QUALITY_ANTIALIASED

QUALITY_CLEARTYPE

QUALITY_CLEARTYPE_NATURAL

 

pitch specifies the pitch of the font. Valid values for  are:
PITCH_DEFAULT

PITCH_FIXED

PITCH_VARIABLE
PITCH_MONO_FONT

 

family specifies the font family that describes the font in a general way. Valid values are:

FONT_FAMILY_DONTCARE

FONT_FAMILY_ROMAN

FONT_FAMILY_SWISS

FONT_FAMILY_MODERN

FONT_FAMILY_SCRIPT

FONT_FAMILY_DECORATIVE

 

fontname requires a string. For example "MS Sans Serif".

 

»Script Example

shape

int renderingMode

int shapeAlignment

int shapeRotation

int blendingMode

int originType

float border

float innerGlow

float outerGlow

int innerGlowInterpolation

int outerGlowInterpolation

float proportion

float diagonalLength

shape stores specific information for shapes.

 

Valid values for renderingMode are:

RENDERING_MODE_EXTENDED

RENDERING_MODE_SIMPLE

 

Valid values for shapeAlignment are:

LOOKAT_FRONT

LOOKAT_BACK

LOOKAT_LEFT

LOOKAT_RIGHT

LOOKAT_TOP

LOOKAT_BOTTOM

LOOKAT_RANDOM

 

Valid values for shapeRotation are:

ROTATION_CCW_0

ROTATION_CCW_90

ROTATION_CCW_180

ROTATION_CCW_270

ROTATION_CW_0

ROTATION_CW_90

ROTATION_CW_180

ROTATION_CW_270

 

blendingMode is only available for RENDERING_MODE_EXTENDED. Valid values are:

BLENDING_MODE_NONE

BLENDING_MODE_ALPHA

 

Valid values for originType are:

ORIGIN_CENTER

ORIGIN_GEOMETRIC_CENTER

ORIGIN_FRONT

ORIGIN_BACK

ORIGIN_LEFT

ORIGIN_RIGHT

ORIGIN_TOP

ORIGIN_BOTTOM

ORIGIN_TOP_LEFT

ORIGIN_TOP_RIGHT

ORIGIN_BOTTOM_LEFT

ORIGIN_BOTTOM_RIGHT

ORIGIN_FRONT_LEFT

ORIGIN_FRONT_RIGHT

ORIGIN_BACK_LEFT

ORIGIN_BACK_RIGHT

ORIGIN_FRONT_TOP

ORIGIN_FRONT_BOTTOM

ORIGIN_BACK_TOP

ORIGIN_BACK_BOTTOM

ORIGIN_FRONT_TOP_LEFT

ORIGIN_FRONT_TOP_RIGHT

ORIGIN_FRONT_BOTTOM_LEFT

ORIGIN_FRONT_BOTTOM_RIGH

ORIGIN_BACK_TOP_LEFT

ORIGIN_BACK_TOP_RIGHT

ORIGIN_BACK_BOTTOM_LEFT

ORIGIN_BACK_BOTTOM_RIGHT

 

border is only available for RENDERING_MODE_EXTENDED.
Valid values range from 0.01 to 1.00.

 

innerGlow is only available for RENDERING_MODE_EXTENDED.
Valid values range from 0.01 to 1.00.

 

outerGlow is only available for RENDERING_MODE_EXTENDED.
Valid values range from 0.01 to 1.00.

 

Valid values for innerGlowInterpolation are:

INTERPOLATION_TYPE_LINEAR

INTERPOLATION_TYPE_EASE_BOUNCE_IN

INTERPOLATION_TYPE_EASE_BOUNCE_OUT

INTERPOLATION_TYPE_EASE_BOUNCE_INOUT

INTERPOLATION_TYPE_EASE_CIRC_IN

INTERPOLATION_TYPE_EASE_CIRC_OUT

INTERPOLATION_TYPE_EASE_CIRC_INOUT

INTERPOLATION_TYPE_EASE_CUBIC_IN

INTERPOLATION_TYPE_EASE_CUBIC_OUT

INTERPOLATION_TYPE_EASE_CUBIC_INOUT

INTERPOLATION_TYPE_EASE_SINE_IN

INTERPOLATION_TYPE_EASE_SINE_OUT

INTERPOLATION_TYPE_EASE_SINE_INOUT

INTERPOLATION_TYPE_EASE_EXPO_IN

INTERPOLATION_TYPE_EASE_EXPO_OUT

INTERPOLATION_TYPE_EASE_EXPO_INOUT

 

Valid values for outerGlowInterpolation are:

See innerGlowInterpolation

 

proportion is only available for RENDERING_MODE_EXTENDED and for SHAPE_TYPE_CROSS, SHAPE_TYPE_CROSS_STRAIGHT, SHAPE_TYPE_STAR, SHAPE_TYPE_3D_CROSS, SHAPE_TYPE_3D_CROSS_STRAIGHT, and SHAPE_TYPE_3D_STAR.
Valid values range from 0.01 to 1.00.

 

diagonalLength is only available for RENDERING_MODE_EXTENDED and for SHAPE_TYPE_CROSS, SHAPE_TYPE_STAR, SHAPE_TYPE_3D_CROSS, and SHAPE_TYPE_3D_STAR.
Valid values range from 0.01 to 1.00.

 

»Script Example

 

MADRIX Version: 5.7 | Script Version: 3.23
[Ctrl & +/-] = Zoom In/Out | [Ctrl & 0] = 100%
 Previous   Next

 


Enable automatic translation | Activer la traduction automatique |