-
Notifications
You must be signed in to change notification settings - Fork 4
Scripting Basics
The script for a trial is formatted as a .script
text file containing only the following:
- Non-indented lines beginning with commands, which appear fully capitalized
- Indented lines containing parameters for the previous command
- Comment lines beginning with
//
, which are ignored by the engine
SET_SCENE_TYPE [sceneType]
A script is executed to start with this command to designate what type of scene it should be. Current options for sceneType
are either INVESTIGATION
or TRIAL
END_SCENE
This must be the last command in a .script
file, to notify the engine to go to the next script.
GAME_OVER
If the player has reached a point where the game should be over, this command will bring them to that flow. Currently, this just quits the game.
DEFINE [definitionName]
[definitionScript]
END_DEFINE
Various commands in the game engine will support using a pre-defined script block to trigger a different part of a script when something happens. In each of these cases, the block must start with DEFINE
, end with END_DEFINE
and have a unique definitionName
for the other commands to reference them by.
The commands that definitions are typically used for:
- Dialogue Choices
- Court Examination Presses
The following commands are supported for controlling the background displayed during the game.
JUMPCUT [backgroundFileName]
CLEAR_LOCATION [backgroundFileName]
Note that backgroundFileName
is expected to correspong with a PNG file name in /backgrounds/
, e.g.:
JUMPCUT LOBBY
// This will display the /backgrounds/LOBBY.png image as the background
For convenience, we support both of the following options for switching to a black background, with the only difference being the transition:
JUMPCUT BLACK_SCREEN
FADE_TO_BLACK
// Note: FADE_TO_BLACK also fades out the music
The engine also allows fading into a scene, using the following:
FADE_IN [timeInSeconds] [backgroundFileName]
The following commands are supported for controlling the music played during the game:
PLAY_MUSIC [musicFileName]
STOP_MUSIC
Note that musicFileName
is expected to correspond with an MP3 file name in /music/
, e.g.:
PLAY_MUSIC PRELUDE
// This will play /music/PRELUDE.mp3
If PLAY_MUSIC
is called when the song is already playing, it will not be interrupted. To restart a song, call STOP_MUSIC
first. In case stopping the music suddenly isn't smooth enough, the engine supports the use of fading out music:
FADE_MUSIC
The following commands are supported for playing a sound effect during the game.
SFX [sfxFileName]
Note that sfxFilneName
is expected to correspond with a WAV file name in /sounds/
, e.g.:
SFX lightbulb
// This will play /sounds/lightbulb.wav
At any point, the following commands may also be called for effect:
SCREEN_SHAKE
WAIT [timeInSeconds]
The following must be configured prior to their use.
Characters must first be initialized with CHARACTER_INITIALIZE
before being used.
CHARACTER_INITIALIZE [characterName] [folderName] [gender]
// characterName - The name that this character will be called in other commands // folderName - The name of the folder within /characters/ that contains the
spritesheets for this character
// gender - The voice SFX that should be played during the talk animation. Current options: MALE, FEMALE
Example:
CHARACTER_INITIALIZE Arin arin MALE
Profiles must first be initialized with PROFILE_INITIALIZE
before being used.
EVIDENCE_INITIALIZE [profileName] [profileDisplayName] [age] [description] [pngFileLocation]
// profileName - The name that this evidence will be called in other commands
// profileDisplayName - The name this profile will be shown with in Court Records
// age - The age of the character associated with the profile
// description - The description that should appear in Court Records
// pngFileLocation - Where the engine should look to find the PNG for this profile
Example:
PROFILE_INITIALIZE arin "Arin Hanson" 34 "Half of the Game Grumps Duo. Definitely the same height as Dan." profiles/Arin.png
After initialization, profiles can be added to the Court Records UI with the following:
COURT_RECORD_ADD PROFILE [profileName]
Example:
COURT_RECORD_ADD PROFILE arin
Evidence must first be initialized with EVIDENCE_INITIALIZE
before being used.
EVIDENCE_INITIALIZE [evidenceName] [evidenceDisplayName] [description] [pngFileLocation]
// evidenceName - The name that this evidence will be called in other commands
// evidenceDisplayName - The name this piece of evidence will be shown with in Court Records
// description - The description that should appear in Court Records
// pngFileLocation - Where the engine should look to find the PNG for this evidence
Example:
EVIDENCE_INITIALIZE Attorney'sBadge "Attorney's Badge" "My prized possession." sprites/Attorney'sBadge.png
After initialization, evidence can be added to the Court Records UI with the following:
COURT_RECORD_ADD EVIDENCE [evidenceName]
Exmaple:
COURT_RECORD_ADD EVIDENCE Attorney'sBadge