Functions (TeaScript)
AudioSet
This function allows you to play sound effects, or play/stop music.
To load a sound effect:
call AudioSet(1, ID, Advanced, Filepath)
| Parameters | Description |
|---|---|
| ID | The sound effect ID. Can be between 0-1024. |
| Advanced | Whether only one 'copy' of this sound effect can be played in the same time. |
| Filepath | The filename of the sound file. The sound file must be in the world map folder. |
To play a sound effect:
call AudioSet(2, ID, 0, "")
| Parameters | Description |
|---|---|
| ID | The ID of the sound effect. Can be between 0-1024. |
To stop a sound effect:
call AudioSet(3, ID, 0, "")
| Parameters | Description |
|---|---|
| ID | The ID of the sound effect. Can be between 0-1024. |
To play music:
call AudioSet(11, FadeIn, 0, Filepath)
| Parameters | Description |
|---|---|
| FadeIn | The duration of the fade-in effect in milliseconds. |
| FilePath | The filename of the music file. The sound file must be in the world map folder. |
To play music:
call AudioSet(12, FadeOut, 0, "")
| Parameters | Description |
|---|---|
| FadeOut | The duration of the fade-out effect in milliseconds. |
EXEScript
This function is used to execute a script. When this function is called, the given script will immediately be executed and the original script will be halted until the execution of the given script completes.
call EXEScript(ScriptName)
| Parameters | Description |
|---|---|
| ScriptName | The script that should be executed. |
Debug
This function will output a string to the debug box. It will only work in the editor, and will not do anything in game mode. It is recommended to delete these functions after debugging for better performance.
call EXEScript(ScriptName)
FXCreate
This function is used to create an effect.
call FXCreate(ID, X, Y, Xsp, Ysp, Frames, AnimationSpeed, Const, Gravity, Advanced)
| Parameters | Description |
|---|---|
| ID | The effect-ID of the effect to create. |
| X | The X-scene coordinate where the effect will be created. |
| Y | The Y-scene coordinate where the effect will be created. |
| Xsp | The X-speed of the effect. |
| Ysp | The Y-speed of the effect. |
| Frames | The number of frames the effect should last. |
| AnimationSpeed | The number of frames each animation frame will last. |
| Const | UNKNOWN, default 0 |
| Gravity | Should the effect be affected by Gravity?
|
| Advanced | UNKNOWN, default 0 |
HUDSet
This function allows you to draw your own HUD. The function serves different purposes with the first parameter.
To erase previous HUD data and initialize the HUD system:
call HUDSet("initialize", 0, 0, 0, 0, 0, 0, 0, 0, 0)
To disable the custom HUD system and erase all the previous custom HUD data.
call HUDSet("destroy", 0, 0, 0, 0, 0, 0, 0, 0, 0)
To add a bitmap to the HUD:
call HUDSet("bitmap", ID, XSource, YSource, Width, Heigth, X, Y, Advanced, Color)
The image source must be in a file called 'scflash.png'.
| Parameters | Description |
|---|---|
| ID | The ID used to identify the HUD bitmap (shares ID with non-HUD bitmaps). |
| XSource | The X-position of the top-left point in scflash.png. |
| YSource | The Y-position of the top-left point in scflash.png. |
| Width | The width of the cropped bitmap. |
| Height | The height of the cropped bitmap. |
| X | The X-scene coordinate where the bitmap will be created. |
| Y | The Y-scene coordinate where the bitmap will be created. |
| Advance | The advanced settings of the HUD bitmap.
|
| Color | A certain color. |
LMove
This function is used to move layers.
call LMove(LayerName, Xsp, Ysp, Type)
| Parameters | Description |
|---|---|
| LayerName | The name of the layer that you want to move. |
| Xsp | The X-distance the layer should move. |
| Ysp | The Y-distance the layer should move. |
| Type | The type of movement that the layer should use.
|
LSet
This function is used to change the visibility of a layer
To Show/Hide/Toggle a layer:
call LSet(LayerName, Type, Smoke)
| Parameters | Description |
|---|---|
| LayerName | The name of the layer that you want to move. |
| Type | The type of layer visibility.
|
| Smoke | Should there be smoke?
|
To change the alpha value of a layer:
call LSet(LayerName, 38, AlphaValue)
| Parameters | Description |
|---|---|
| LayerName | The name of the layer that you want to move. |
| Alpha Value | The alpha value of the layer. This value must be between 0-255. |
LSpin
This function is used to rotate layers. This function only affect NPCs and Blocks.
call LSpin(LayerName, Xcenter, Ycenter, Speed)
| Parameters | Description |
|---|---|
| LayerName | The name of the layer that you want to move. |
| Xcenter | The X-scene coordinate of the center of the circle. |
| Ycenter | The Y-scene coordinate of the center of the circle. |
| Speed | The spin speed. Positive values spin anti-clockwise and negative values spin clockwise. |
PlayNote
This function is used to play a note.
call PlayNote(Command)
| Parameters | Description |
|---|---|
| Command | The command can be:
Patch = ID of the instrument (0-127) Volume = The volume of the note (0-100) Flip = The pitch of the note (0-255) Channel = The channel of the note (0-15) Default:0 |
ShowMsg
This function shows a message using a message box.
call ShowMsg(Message)
| Parameters | Description |
|---|---|
| Message | The message that will be shown. It must be a string. |
Sleep
This function is used to pause the script for a number of frames. It can only be used in scripts called through an event.
call sleep(Delay)
| Parameters | Description |
|---|---|
| Delay | The number of frames the script should be paused. |
TClear
call TClear(Type, EventName)
| Parameters | Description |
|---|---|
| Type | The clear type
|
| EventName | If type is 0, then set the EventName to clear.
If type is 1, then set this to 0. |
TCreate
This function is used to call an event/create an event timer.
call TCreate(EventName, Delay)
| Parameters | Description |
|---|---|
| EventName | The event that should be called. |
| Delay | The number of frames until the event is called. |