\FML\ScriptBuilder

ManiaScript Builder class

Summary

Methods
Properties
Constants
getLabelImplementationBlock()
escapeText()
getId()
getReal()
getBoolean()
getVec2()
getVec3()
getArray()
getValue()
getInclude()
getConstant()
No public properties found
EMPTY_STRING
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Constants

EMPTY_STRING

EMPTY_STRING

Methods

getLabelImplementationBlock()

getLabelImplementationBlock(string  $labelName, string  $implementationCode, boolean  $isolate = true) : string

Build a script label implementation block

Parameters

string $labelName

Name of the label

string $implementationCode

Label implementation coding (without declaration)

boolean $isolate

(optional) If the code should be isolated in an own block

Returns

string

escapeText()

escapeText(string  $text, boolean  $addApostrophes = true) : string

Escape dangerous characters in the given text

Parameters

string $text

Text to escape

boolean $addApostrophes

(optional) Add apostrophes before and after the text

Returns

string

getId()

getId(\FML\Types\Identifiable  $element) : string

Get the escaped Id of the given Element

Parameters

\FML\Types\Identifiable $element

Element

Returns

string

getReal()

getReal(float  $value) : string

Get the 'Real' string representation of the given value

Parameters

float $value

Float value to convert to a ManiaScript 'Real'

Returns

string

getBoolean()

getBoolean(boolean  $value) : string

Get the 'Boolean' string representation of the given value

Parameters

boolean $value

Value to convert to a ManiaScript 'Boolean'

Returns

string

getVec2()

getVec2(float|array<mixed,float>  $valueX, float  $valueY = null) : string

Get the Vec3 representation for the given values

Parameters

float|array<mixed,float> $valueX

Value X

float $valueY

(optional) Value Y

Returns

string

getVec3()

getVec3(float|array<mixed,float>  $valueX, float  $valueY = null, float  $valueZ = null) : string

Get the Vec3 representation for the given values

Parameters

float|array<mixed,float> $valueX

Value X

float $valueY

(optional) Value Y

float $valueZ

(optional) Value Z

Returns

string

getArray()

getArray(array  $array, boolean  $associative = false) : string

Get the string representation of the given array

Parameters

array $array

Array to convert to a ManiaScript array

boolean $associative

(optional) Whether the array should be associative

Returns

string

getValue()

getValue(mixed  $value) : string

Get the string representation for the given value

Parameters

mixed $value

Value

Returns

string

getInclude()

getInclude(string  $file, string  $namespace = null) : string

Get the include command for the given file and namespace

Parameters

string $file

Include file

string $namespace

(optional) Include namespace

Returns

string

getConstant()

getConstant(string  $name, string  $value) : string

Get the constant command for the given name and value

Parameters

string $name

Constant name

string $value

Constant value

Returns

string