Functions avaiable in MBScript that return a value. Used in MBScript by: 'Func.Type.Name'

MB Variable

Name

Type

Description

Get Variable

MB Variable

Stored Entities Data

Name

Type

Description

New(Entity, Bool)

Stored Entities Data

New With Entities(Entity List, Bool)

Stored Entities Data

Play Time

Name

Type

Description

Time

Play Time

Time since start of the world's play mode

Range

Name

Type

Description

New(Number, Number)

Range

Zero

Range

Zero To One

Range

Color

Name

Type

Description

White

Color

Solid White

Black

Color

Solid Black

Cyan

Color

Clear

Color

Grey

Color

Gray

Color

Magenta

Color

Red

Color

Yellow

Color

Green

Color

Blue

Color

Lerp(Color, Color, Number)

Color

Linearly interpolates between colors a and b by t

Lerp Unclamped(Color, Color, Number)

Color

New(Number, Number, Number, Number)

Color

Random

Color

Generates a random color from HSV and alpha ranges

Date Time

Name

Type

Description

Now

Date Time

Today

Date Time

Utc Now

Date Time

New(Whole Number, Whole Number, Whole Number, Whole Number, Whole Number, Whole Number)

Date Time

Mathf

Name

Type

Description

PI

Number

Infinity

Number

Negative Infinity

Number

Deg2Rad

Number

Degrees-to-radians conversion constant

Rad2Deg

Number

Radians-to-degrees conversion constant

Abs

Number

Returns the absolute value

Acos

Number

Returns the arc-cosine - the angle in radians whose cosine is f

Asin

Number

Returns the arc-sine - the angle in radians whose sine is f.

Atan

Number

Returns the arc-tangent - the angle in radians whose tangent is f.

Atan2(Number, Number)

Number

Returns the angle in radians whose Tan is y/x.

Ceil

Number

Returns the smallest integer greater to or equal to f.

Clamp(Number, Number, Number)

Number

Clamps the given value between a range defined by the given minimum integer and maximum integer values. Returns the given value if it is within min and max.

Clamp01

Number

Clamps value between 0 and 1

Cos

Number

Returns the cosine of angle f

Delta Angle(Number, Number)

Number

Calculates the shortest difference between two given angles given in degrees

Exp

Number

Returns e raised to the specified power.

Floor

Number

Returns the largest integer smaller than or equal to f.

Lerp(Number, Number, Number)

Number

Linearly interpolates between a and b by t.

Lerp Angle(Number, Number, Number)

Number

Same as Lerp but makes sure the values interpolate correctly when they wrap around 360 degrees.

Log(Number, Number)

Number

Returns the natural (base e) logarithm of a specified number.

Log10

Number

Returns the base 10 logarithm of a specified number.

Max(Number, Number)

Number

Returns the largest value.

Min(Number, Number)

Number

Returns the smallest of two values.

Move Towards(Number, Number, Number)

Number

Moves a value current towards target.

Move Towards Angle(Number, Number, Number)

Number

Same as MoveTowards but makes sure the values interpolate correctly when they wrap around 360 degrees.

Pow(Number, Number)

Number

Returns f raised to power p.

Sign

Number

Returns the sign of f.

Sin

Number

Returns the sine of angle f.

Smooth Step(Number, Number, Number)

Number

Interpolates between min and max with smoothing at the limits.

Sqrt

Number

Returns square root of f.

Tan

Number

Returns the tangent of angle f in radians.

Log Base(Number, Number)

Number

Returns the logarithm of a specified number in a specified base.

Round

Number

Round To(Whole Number)

Number

Random

Name

Type

Description

Value

Number

Returns a random number between 0.0 [inclusive] and 1.0 [inclusive]

Range(Number, Number)

Number

Return a random float number between min [inclusive] and max [inclusive]

On Unit Sphere

Vector3

Returns a random point on the surface of a sphere with radius 1

Inside Unit Circle

Vector2

Returns a random point inside a circle with radius 1

Inside Unit Sphere

Vector3

Returns a random point inside a sphere with radius 1

Time

Name

Type

Description

Realtime Since Startup

Number

Real time in Seconds since Modbox started

Delta Time

Number

Time in Seconds since last frame

Fixed Delta Time

Number

Interval which physics updates

World Play Time

Number

Time since play mode began in World

Text

Name

Type

Description

New Line

Text

Transform Part

Name

Type

Description

Can See Other Transform(Transform Part)

Bool

Angle To Other Transform(Transform Part)

Number

MB Type

Name

Type

Description

Get MB Type

MB Type

As Type(MB Type)

Object of any Type

Returns as the given Type (if it is the type / can convert to type)

Is Type(MB Type)

Bool

Vector2

Name

Type

Description

Zero

Vector2

One

Vector2

Up

Vector2

Down

Vector2

Right

Vector2

Left

Vector2

Distance(Vector2)

Number

Returns the distance between a and b.

Dot(Vector2)

Number

Dot Product of two vectors.

Lerp(Vector2, Number)

Vector2

Linearly interpolates between vectors a and b by t.

Move Towards(Vector2, Number)

Vector2

Moves a point current towards target.

Angle(Vector2)

Number

Returns the unsigned angle in degrees between from and to.

Signed Angle(Vector2)

Number

Returns the signed angle in degrees between from and to.

Scale(Vector2)

Vector2

Multiplies two vectors component-wise.

Reflect(Vector2, Vector2)

Vector2

Reflects a vector off the vector defined by a normal.

New(Number, Number)

Vector2

Vector3

Name

Type

Description

Zero

Vector3

One

Vector3

Up

Vector3

Down

Vector3

Right

Vector3

Left

Vector3

Forward

Vector3

Back

Vector3

Distance(Vector3)

Number

Returns the distance between a and b.

Dot(Vector3)

Number

Dot Product of two vectors.

Lerp(Vector3, Number)

Vector3

Linearly interpolates between vectors a and b by t.

Move Towards(Vector3, Number)

Vector3

Moves a point current towards target.

Angle(Vector3)

Number

Returns the unsigned angle in degrees between from and to.

Signed Angle(Vector3, Vector3)

Number

Returns the signed angle in degrees between from and to.

Rotate Towards(Vector3, Number, Number)

Vector3

Rotates a vector current towards target.

Scale(Vector3)

Vector3

Multiplies two vectors component-wise.

Reflect(Vector3, Vector3)

Vector3

Reflects a vector off the vector defined by a normal.

Project(Vector3, Vector3)

Vector3

Projects a vector onto another vector.

Project On Plane(Vector3, Vector3)

Vector3

Projects a vector onto a plane defined by a normal orthogonal to the plane.

Slerp(Vector3, Vector3, Number)

Vector3

Spherically interpolates between two vectors.

New(Number, Number, Number)

Vector3