djDecks Scripting
To allow you to perform a number of actions at once,
djDecks has a scripting system to perform multiple actions at once.
Scripts can be started when djDecks starts, or by pressing a keyboard or midi
button.
Script Basics
Scripts are regular text files with the extension .djscript. Each line of the file can define one
command. If a line contains a command that is not recognized, it is ignored.
You can store these files either in the global settings directory, the users' settings directory,
or the skins' folder.
Each command can have parameters, which are separated by spaces.
Specifying a player is usually optional. If not specified, it will default to the active player.
It it is specified, it ranges from 0 (deck 1) to 3 (deck 4)
- setRel, setAbs
Set the value of a parameter, either relative (always between 0 and 1) or
absolute (depends on parameter)
Arguments:
setRel ValueName Value
setRel ValueName Value Player
setRel ValueName,ValueSpecifier Value Player
For values for which no valuespecifier is required, use the first type, if
you need to specify a value specifier, use the second type. Make sure that you
don't add spaces between the comma and the valuespecifier.
Example:
setRel Volume_Player 1 0
This will set the volume of the first deck to its maximum value.
- setDefault
Sets the value of a parameter back to its default value.
Arguments:
setDefault ValueName
setDefault ValueName Player
setDefault ValueName,ValueSpecifier Player
Both ValueSpecifier and Player are optional.
- click
Does the same as clicking on a button with the same value and
valuespecifier
click ValueName
click ValueName Player
click ValueName,ValueSpecifier Player
Both ValueSpecifier and Player are optional
- wait
Wait for a specified time or number of beats before continuing with the
next command in the script
wait time ms
wait time beats Player
wait time beats player accurate
Waits either 'time' milliseconds if followed by 'ms', or 'time' beats if
followed by 'beats'.
If time is specified in beats, Player specifies the deck to get the bpm
from.
If 'accurate' is added, accuracy will be improved, at the cost of slightly higher cpu usage
- loadskin SkinName
Loads the skin with the name SkinName
- loadvst player slot vstplugin.dll
Loads the plugin with filename vstplugin.dll from c:\program files\steinberg\vstplugins\
If you store your plugins in a different location, you can also enter a complete path
(don't forget double quotes if the path contains spaces)
player is the player number starting from 0, slot is the vst slot number, also from 0 to 3
- loadsong player "filename"
Loads the song with given filename to the deck specified by player
The filename is allowed to contain spaces, but it is recommended to put double quotes around it.
- executescript name
Executes the script with specified name. If you want to call another script from within a script,
it is recommended to use this command instead of 'click ExecuteScript,name'.
- %player%
You can use this variable instead of defining a specific player.
When the script is bound to a button, keyboard or midi shortcut, it will be replaced
by the selected player number.
- %value%
You can use this variable instead of defining a fixed value for setrel.
When the script is bound to a midi slider or knob, this variable will be replaced
by the midi slider's value.
For a list of possible ValueNames and ValueSpecifiers, see the
skinning documentation
Advanced scripting
- if, ifnot
Executes a command if the value is true
if ValueName command
if ValueName,ValueSpecifier command
if ValueName,,Player command
if ValueName,ValueSpecifier,Player command
ifnot ValueName command
ifnot ValueName,ValueSpecifier command
ifnot ValueName,,Player command
ifnot ValueName,ValueSpecifier,Player command
if ValueName,ValueSpecifier,Player>nr command
command is any other valid script command
comparissons can be made using >, <, >=, <= or = without any space between the comparator and the value
- keyup:
Any command after this will only be executed when releasing the button (if
the script is bound to a button on a skin, a midi button or a keyboard
button)
- keydown:
Any command after this will only be executed when pressing the button - Before keydown/keyup sections
Any
command that is entered before the keydown/keyup section is executed
when appropriate. For most commands this means on keydown. Keyboard
shortcuts that have a different behaviour for keydown/keyup will be
executed as expected.
- setvar name value
Sets the variable name to value value. Values can be used anywhere in a script by
using %VARNAME% wherever you want to use the variable's value.
- setvar2 name ValueName
setvar2 name ValueName,ValueSpecifier
setvar2 name ValueName,ValueSpecifier Player
setvar2 name ValueName,ValueSpecifier Player Type
Sets the variable named 'name' to the current value of any djDecks value.
Type is either text for a string representation, value for the current value,
or valuerel for the relative value (always between 0 and 1). For on/off values, you can use type boolean
- setpersistent varname
setpersistent varname default
Sets the variable with name 'varname' persistent. This means that it's value will be remembered
when restarting djDecks.
You can also set a default value here, which will be set only if the variable is new and doesn't have a value yet.
- status ValueName,ValueSpecifier player
status ValueName,ValueSpecifier player Type
If you want to use a script on a button in a skin or midi mapping, use this command to set
when the button should be in the active state.
If you want to use a script on a slider in a skin or midi mapping, Type should be valuerel
to indicate that the relative value should be used on the slider.
- executescript script.djscript player
Use this command to start another script from within a script.
Specifying player is optional.
- stopscript script.djscript
Use this command to stop another script that is currently running.
If this script wasn't running then this command has no effect.
- addtrigger name count type ValueName,ValueSpecifier,Player scriptcommand
A Trigger can be used to watch a specific value and be notified when it changes.
You can then take a certain action.
name: This is the name of the trigger, if a trigger still exists with this name, it is replaced by the new trigger
count: This is the number of times you want the trigger to work. Use -1 for always, and 1 for once.
type: This can be either bool, value or string. Which of these you want will depend on the value you are watching.
ValueName,ValueSpecifier,Player: These define the value to watch.
scriptcommand: Any single-line script command can be specified here. This will be executed whenever the value changes.
You can use the executescript command if you want to run an entire script.
- removetrigger name
Removes the trigger with name 'name' if it exists.
- wait 1 nextbeat player
wait 1 nextmeasure player
Wait until the start of the next beat or the next measure
Startup scripts
If you want a script to be executed at djDecks startup, simply name it 'startup.djscript'
and save it in djDecks\settings or djDecks\settings\username
You can also start a script by adding a command line parameter:
-script:scriptname.djscript
This will execute the script 'scriptname.djscript' that should be located in
djDecks\settings or djDecks\settings\username
Binding scripts to a keyboard shortcut
Bind a key to the command 'executescript'. Enter the name of the script in
the parameter field.
Binding scripts to a midi command
Select 'Button' for command type, 'ExecuteScript' for Command, and enter the
filename of the script in the additional parameter field.
The script should be located either in djDecks\settings or
djDecks\settings\username
Using scripts in a skin
You can use a script in a skin by using the 'ExecuteScript' value, and
specify the name of the script in the valuespecifier. The script will be
searched for in the skin's directory, in the user's settings folder, and in the
main settings folder.
If your script is just one line, you can also type it directly in the valuespecifier field,
preceded by the string script:, for example:
<VALUE>ExecuteScript</VALUE>
<VALUESPECIFIER>script:setAbs Effect,eq_lowfreq 350 %player%</VALUESPECIFIER>
djDecks (c)2003-2023 Adion