The snippets panel lets you create and manage code snippets. These are intended to let you keep and curate a collection of small fragments of code that you might use often. The panel also lets you access the boilerplate templates for the various script event handlers, making it easy to add support for an event to an existing script.

Opus maintains multiple sets of snippets for different languages - the dropdown at the top of the panel lets you select the language you want. You can add your own languages by duplicating one of the standard language files in the /dopusdata/Script Snippets folder.

Adding snippets

To add your own snippet, copy it to the clipboard, and then right-click on the list background (or on the Your Snippets heading, if it's visible), and choose the Paste New Snippet command. You can rename and delete existing snippets using the context menu as well.

Using snippets

To use a snippet, you can either:

  • Right-click on it and choose Copy to copy it to the clipboard
  • Double-click it to copy it to the clipboard
  • Drag and drop it onto a code editor