It occurred to me that we might all benefit from a single, easy-to-use action for enabling debug messages, rather than distributing separate debug versions of our scripts or asking users to edit the script themselves. So:
Lokasenna_Run Lua script in debug mode
Lokasenna_Run last Lua script in debug mode
(also on ReaPack)
All it does is prompt the user to select another script, sets a global variable,
debug_mode, to
true, and then runs the script they chose. If your script is set up to check for
debug_mode then it can start printing debug messages with no fuss on the end-user's part.
For example, most of us use some variation of:
Code:
function Msg(str)
reaper.ShowConsoleMsg(str)
end
Just change it to this, and you're good to go:
Code:
function Msg(str)
if debug_mode then reaper.ShowConsoleMsg(str) end
end
The second script is a replacement for "ReaScript: Run last ReaScript (EEL or Lua)". Why? The last script is stored in
REAPER.ini, which ReaScripts can access, but the filename is overwritten as soon as you run the Debug Mode script, so the Debug Mode script can't see what the actual last script was.
Hopefully this is useful for someone. Cheers.