README_EVENTS.markdown

# Events

Level event scripts can be used to control the game parameters and to do more cool stuff during gameplay. They make every level unique and more interesting. Here's a list of commands:

`"event_time_stop" ("duration")` Stops the game timer for "duration" frames.

`"timeline_wait" ("duration")` Stops the pattern timeline for "duration" frames.

`"timeline_clear"` Clears the pattern timeline, stopping all the patterns.

`"message_add" ("duration", "message")` Queues a text message with the string "message" that lasts for "duration" frames.

`"message_clear"` Clears the screen from messages.

`"level_float_add" ("value_name", "value")` `"level_float_set"` `"level_float_subtract"` `"level_float_multiply"` `"level_float_divide"` `"level_int_add"` `"level_int_set"` `"level_int_subtract"` `"level_int_multiply"` `"level_int_divide"` Adds, sets, subtract, multiplies or divides a level JSON value by the name "value_name" by "value".

`"style_float_add" ("value_name", "value")` `"style_float_set"` `"style_float_subtract"` `"style_float_multiply"` `"style_float_divide"` `"style_int_add"` `"style_int_set"` `"style_int_subtract"` `"style_int_multiply"` `"style_int_divide"` Adds, sets, subtract, multiplies or divides a style JSON value by the name "value_name" by "value".

`"style_set" ("id")` Changes the current style to "id".

`"music_set" ("id")` Changes the current music to "id", with a random segment.

`"music_set_segment" ("id", "segment_index")` Changes the current music to "id", at the segment number "segment_index".

`"music_set_seconds" ("id", "seconds")` Changes the current music to "id", starting at "seconds".

`"level_change" ("id")` Changes the level to "id", saving progress.

`"side_changing_stop"` Stops random side number changes on level up.

`"side_changing_start"` Resumes random side number changes on level up.

`"increment_stop"` Stops level up increments.

`"increment_start"` Resumes level up increments.

`"play_sound" ("id")` Plays sound with id "id".

`"menu"` Returns to menu, saving progress.

`"event_exec" ("id")` Executes event file with id "id" immediately.

`"event_enqueue" ("id")` Enqueues event file with id "id" in the event queue.

`"script_exec" ("value_name")` Runs LUA script with filename "value_name". Example usage: `{ "type": "script_exec", "value_name": "test.lua" }`