Bird's-eye view of a PuzzleScript file

A puzzlescript file is divided into 8 sections:

Adding Sounds

The SOUNDS section

This is where you hook up sounds to in-game actions.

There are sound buttons above the console, that produce sound seeds that you can use in this section.

These numbers are saved representations of the sounds, and you use them in the sound section by associating an event with a seed. The possible events will be described in the next section of this documentation page.

Useful tip: just click on a seed to play the sound, in the editor or in the console!

Example SOUNDS section

A sound section could look like the following:

player move up 142315
Player Move down 142313
Player Move right 142311
Crate Move 412312
Player CantMove up 41234
Crate CantMove 41234
Crate Create 41234123
CloseMessage 1241234
Sfx0 213424
Sfx3 213424

Adjusting the volume of a sound

You can specify a volume after the seed and a colon, like that:

player move up 142315:12

This will boost the sound effect's volume by 12 tenths, i.e. 120%. The default sound volume is thus 10, and you can use any integer value between 1 and 39 included.

Note that increasing the volume of a sound can add distortion to it, and conversely, decreasing the volume of a sound can make it sound smoother. The reason is that the volume setting directly multiply the soundwave's amplitude before it is capped to 1, and this capping causes distortion.

Events that can trigger a sound

here are the possible sound events declarations:

Object-related sound events

Crate Create 123414
Triggers when a crate is created.
Crate Destroy 123414
Triggers when a crate is destroyed.
Crate Action 123414
Triggers when a crate is subject to the 'action' during a movement phase.
Player Move 4123412
Triggers when that object successfully moves, in any direction.
Player Move Down Left 4123412
Triggers when that object successfully moves either down or left.
Player Move Horizontal 4123412
Triggers when that object successfully moves horizontally. Vertical is also valid here.
Player CantMove 4123412
Triggers when that object unsuccessfully moves, in any direction.
Player CantMove Down Left 4123412
Triggers when that object unsuccessfully moves, either down or left.

Rule-triggered sound events

Cancel 123413
Played when a rule triggers the CANCEL command.
SFX0 123434
Can be anything from SFX0 to SFX10. These are custom sound events that can be triggered from rules.

Feedback on player actions

Restart 123413
Played when the player presses the restart button (R).
Undo 123413
Played when the player presses the undo button (Z).
PauseScreen 123414
Triggers when the player presses Escape and the pause-screen is loaded.

UI events

GameScreen 123414
Triggers when the game is loaded and the title screen is displayed.
StartGame 123413
When you start a new game from the title screen.
EndGame 123413
When you finish the game, and end up back at the title screen.
Startlevel 123413
Played at the start of each level.
EndLevel 123413
When you finish a level.
ShowMessage 123434
makes a sound when a message appears
CloseMessage 123434
makes a sound when the player closes a message window