Novelty scripting reference > Global functions

Global script functions

These are global functions that can be called from any script.

CreateObject
GetMousePosition
GetObject
HideObject
PlayBGM
PlaySound
PlayVideo
Print
SeekVideo
StopBGM
StopAllSounds
StopVideo
ShowObject
UserInput


Object@ CreateObject(string AssetName)

Create a new object in the current scene.
Returns a handle to the new object or null on failure.

Remarks:
Asset must be an available resource - meaning it either has to be used elsewhere in the game or be explicitly added to the project resources.


Vector2 GetMousePosition()

Returns the current mouse position (relative to window).


Object@ GetObject(string Name)

Get handle to object in the current scene (by name).
Returns null on failure.

See also:
Object


void HideObject(string Name, float Time)
void HideObject(Object@ Handle, float Time)

Hide an object in the current scene (by name or handle).

Remarks:
This function activates the object's OnHide event.

See also:
Object, Scripted object events


bool PlayBGM(string AssetName)
bool PlayBGM(string AssetName, float Volume, float Balance, bool Loop)

Plays an audio asset as background music.
AssetName must be a name of an asset that has been added to the project.
Returns true if successful.

Remarks:
Only one BGM track may play at any moment. If BGM is already playing this will fade in and replace it.
Audio asset must be an available resource - meaning it either has to be used elsewhere in the game or be explicitly added to the project resources.


bool PlaySound(string AssetName)
bool PlaySound(string AssetName, float Volume, float Balance)

Plays sound effect.
AssetName must be a name of an asset that has been added to the project.
Returns true if successful.

Remarks:
Audio asset must be an available resource - meaning it either has to be used elsewhere in the game or be explicitly added to the project resources.


bool PlayVideo(uint Channel, string FileName)
bool PlayVideo(uint Channel, string FileName, float Volume, bool Loop)

Loads and plays video in a channel. Channel must be either 1,2 or 3. Volume is between 0 to 1.
Returns true if the video started successful.


void Print(string Text)

Print text to the console window (is also logged in log file).


bool SeekVideo(uint Channel, double Position)

Seeks to a position (in seconds) in a playing video. Channel must be 1,2 or 3.
Returns true if the video started successful.


void StopBGM()
void StopBGM(float FadeTime)

Stop playing current BGM.


void StopAllSounds()

Stops any currently playing sound effects.


void StopVideo()
void StopVideo(uint Channel)

Stops a video playing in one or all channels. Channel must be 1,2 or 3.


void ShowObject(string Name, float Time)
void ShowObject(Object@ Handle, float Time)

Show an object in the current scene (by name or handle).

Remarks:
This function activates the object's OnShow event.

See also:
Object, Scripted object events


string UserInput(string Message)
string UserInput(string Message, string DefaultValue, uint MaxLength, bool AllowEmpty)

Show a user input dialog. Returns the entered text.


Back to top