Tutorial: A Minimal Example

A Minimal Example

A minimal working script consists of two global functions: getClientInfo() and main().

getClientInfo() is called when the script gets loaded by the host. It is supposed to return an object that describes the name, author, version of the script, and the minimal version number of Synthesizer V Studio required to run the script.

main() is called when the user executes the script.


Example (JavaScript)

function getClientInfo() {
  return {
    "name" : "My Script",
    "category" : "Example",
    "author" : "Bob Alice",
    "versionNumber" : 1,
    "minEditorVersion" : 65540
  };
}

function main() {
  SV.showMessageBox("My Script", "Hello, world!");
  SV.finish();
}

Example (Lua)

function getClientInfo()
  return {
    name = "My Script",
    category = "Example",
    author = "Bob Alice",
    versionNumber = 1,
    minEditorVersion = 65540
  }
end

function main()
  SV:showMessageBox("My Script", "Hello, world!")
  SV:finish()
end

See here for a more involved example that creates a NoteGroup and adds a few notes to it.