I done some scripting before, iv read the documentation, once i have my head working around the basics (syntax stuff) I can get stuff done.
I wish to make a toggle (binded to a key) for switching between pattern edit and mixer view.
This is what I have so far, but even this doesn’t work:
local function switch()
rw = renoise.app().window
if rw.active_middle_frame = renoise.ApplicationWindow.MIDDLE_FRAME_PATTERN_EDITOR then
rw.active_middle_frame = renoise.ApplicationWindow.MIDDLE_FRAME_MIXER
end
-- MIDDLE_FRAME_MIXER
-- keys
renoise.tool():add_keybinding {
name = "Global:View:dunks1980",
invoke = switch
}
-- auto reload
_AUTO_RELOAD_DEBUG = function()
end
Hmm, ok. Well I only mentioned it because I noticed there’s an end missing from your switch() function. You need an end after the if/then statement, and a final end to close out the function.
Also need to use == when doing a comparison on the frame, rather than = which is assigning a new value to it.
This modified function works:
local function switch()
local rw = renoise.app().window
if rw.active_middle_frame == renoise.ApplicationWindow.MIDDLE_FRAME_PATTERN_EDITOR then
rw.active_middle_frame = renoise.ApplicationWindow.MIDDLE_FRAME_MIXER
end
end