Functions (TeaScript)

From Moondust Wiki
Revision as of 22:12, 7 May 2017 by Yoshi021 (talk | contribs) (Sleep, Tcreate and playNote)
Jump to navigation Jump to search


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?
  • 0: Yes
  • 1: NO
Advanced UNKNOWN, default 0

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.
  • 0: Use speed movement. (The layer will move with the given direction)
  • 1: Use shift movement. (The layer will warp with the given direction)

LSet

This function is used to change the visibility of a layer

LSet(LayerName, Type, Smoke)
Parameters Description
LayerName The name of the layer that you want to move.
Type The type of layer visibility.
  • 1: Show
  • 2: Hide
  • 3: Toggle
  • 38: Alpha Value
Smoke Should there be smoke?
  • 0: Yes
  • 1: No

If the type is set to 38, then this value will set 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 angular speed [INSERT BETTER DESC.]

PlayNote

This function is used to play a note.

call PlayNote(Command)
Parameters Description
Command The command can be:
  • To play a note
    • Volume*65536 + Flip*256 + 192 + Channel
  • To stop a note
    • Volume*65536 + Flip*256 +128 + Channel
  • To change the instrument
    • Patch*256 + 192 + Channel

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 nuber 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.

TCreate

This function is used to call an event.

TCreate(EventName, Delay)
Parameters Description
EventName The event that should be called.
Delay The number of frames until the event is called.