Skip to content

Style guide

Ben Smith edited this page Mar 15, 2021 · 1 revision

Header Tags

-- @description [Name of script in sentence case]
-- @author Ben Smith
-- @link bensmithsound.uk
-- @version [1.0]
-- @about Description of what the script does

-- @changelog
--   v2.0  + features
--   v1.0  + init

Changelog is optional for v1.0

Customisable variables

-- User customisation area ----------------

[enter variables here]

--------- End of user customisation area --

Use 43 columns for these headings, and 2 blank lines either side.

If the script requires editing after the functions (for example, the script defines functions and the user decides which to use and how) then add the following before "end of user customisation area"

-- ENTER YOUR SCRIPT AT THE END -----------

Functions

Highlight the functions section with

---- Functions

You can give descriptions of each one if you wish, or you can leave them without if the names are self explanatory.

-- Description of this function

function theFunction(variables)
  functions
end

Main Script

Highlight the start of the script with a 2 line gap and the following

-- Run Script -----------------------------

Add notes to signpost the script with a blank line either side, like this.


-- What the script is doing

To signpost larger sections, you can use 4 hyphens.


---- A new section

Try to put them in the most logical places. For example, if one section is optional depending on a user defined variable, you can put the notes before the "if".

---- Do the thing

if theVariable == "" then

Undo Blocks

Where relevant, inlcude undo blocks.

Before the start of the script's actions, add reaper.Undo_BeginBlock()

After the end of the script's actions, add reaper.Undo_EndBlock("Description for the undo list", 0)

Clone this wiki locally