-
Notifications
You must be signed in to change notification settings - Fork 1
Core functions
The functions on this page are available by loading the core.lua extension. It is loaded by default.
These functions are more generic and don't necessarily fit under other categories, for they involve events independent of rooms, rows, etc.
Creates a Call Custom Method event at beat beat
with the code code
, execution time extime
and sort offset sortoffset
.
extime
can be OnBar
or OnPrebar
and defaults to OnBar
.
Example:
level:rdcode(2, 'i0 = 2', 'OnBar', 0) -- Create a CCM event that sets i0 to 2, on bar and with offset 0.
Creates a Tag Action event set to Run at beat beat
that calls the tag tag
.
Example:
level:runtag(2, 'Hi') -- Call the tag 'Hi' at beat 2
Creates a dialogue box at beat beat
with the text text
, on the side panel
and portrait side portrait
, with speed speed
.
sounds
is a boolean, dictating whether the box has text sounds.
panel
can be "Top"
or "Bottom"
and defaults to "Bottom"
, and portrait
can be "Left"
or "Right"
and defaults to "Left"
.
Speed currently has no effect, but defaults to 1.
Has an alias, level:dialogue
.
Example:
level:dialog(2, 'Samurai_Happy: This is nice!', true, Bottom, Left) -- Dialogue at beat 2 showing Samurai being happy, with the box on the bottom and his portrait on the left
Shorthand for level:dialog(beat, '', false, nil, nil, nil)
.
Stops the current dialogue, does nothing if there is no dialogue at the time of execution.
Has an alias, level:hidedialogue
.
Example:
level:hidedialog(2)
Creates a comment on beat beat
with text text
, color color
, in the tab tab
.
color
is in hexadecimal format and defaults to F2E644
if omitted.
tab
can be either Actions
, Song
, Sprites
or Rooms
, and defaults to Actions
if omitted.
If tab
is Sprites
, then target
must be set to a decoration id. Otherwise, it can be omitted.
Example:
level:comment(4, 'I like this part :)', 'FF0000', 'Song') -- Create a red comment in the Song tab at beat 4
Creates a comment on beat beat
with text text
, default color and tab.
Prefixes the text with ()=>
, because all comment methods start with that.
E.g. passing "trueCameraMove"
for text results in "()=>trueCameraMove"
.
Example:
level:ccode(4, 'aCoolThing') -- Creates a comment at beat 4 saying `()=>aCoolThing` which calls `aCoolThing` on playback. (aCoolThing is not a real method)
Toggles the comment-show-on-execute option for all comments in the level, except for those created through level:ccode
.
Every comment passed by the playbar will be shown in the inspector. Only does something in the editor.
Example:
level:showcomments() -- show all the funnies!
Creates a Set Speed event at beat beat
with speed speed
, ease ease
and duration
duration in beats.
If dmult
is not omitted, it multiplies the duration of all events by this value.
Example:
level:speed(4, 2, nil, 'Linear', 1) -- At beat 4, speed the game up to 2x its base speed linearly over one beat. Omit the duration multiplier
If keeplisted
is omitted or set to false
, clears all events whose type is found in eventtypes
.
Otherwise, keep all events whose type is found in eventtypes
, clearing the rest.
eventtypes
is a list of strings.
Example:
level:clearevents({"SetTheme"}, false) -- Begone, theme events!
Shorthand for `level:clearevents(eventtypes, true).
Creates multiple Finish Level events at beat beat
with delay
beats between them.
delay
can be omitted, and doing so will result in only one event being created.
Example:
level:finish(16, 2) -- Finish the level at beat 16 with a delay of 2 beats between events