So, searching for this, i only found some old posts from 2011.
What i’d like to do is add keybindings that move the cursor to the note column or last fx column of selected track IF not already on it, ELSE move elsewhere, etcetc…
Doesn’t seem like it was possible to script this in lua 2-3 years ago. Has such functionality been added to the API since then? It would be greatly appreciated
You can also manipulate the pattern editor selection with: ```lua
renoise.song().selection_in_pattern
A nice tip: To get a list of all the properties and methods available in the Renoise song object, open up the scripting Terminal and input: ```lua
oprint(renoise.song())
You can also do this for any other object, for example: ```lua
oprint(renoise.song().selected_instrument)
oprint(renoise.song().selected_sample)
oprint(renoise.song().transport)
...
I find this a great way to look through the API and remind myself where everything is. Even if you don’t know the exact name for something (or you simply forgot), you can start at the top level by examining the song, then find the thing you want, then dig a bit deeper by examining that object and its properties, and so on…
As always, you should refer to the full documentation to find out exactly how everything works, what values they expect, etc.
I’m assuming you meant rprint() and not sprint()? Yeah, pretty much I recommend just using this function:
--------------------------------------------------------------------------------
-- Debug print
--------------------------------------------------------------------------------
function dbug(msg)
local base_types = {
["nil"]=true, ["boolean"]=true, ["number"]=true,
["string"]=true, ["thread"]=true, ["table"]=true
}
if not base_types[type(msg)] then oprint(msg)
elseif type(msg) == 'table' then rprint(msg)
else print(msg) end
end
Where dbug(foo) will print out something useful every time.
Is there a quick reference for which functions get called by which keybindings? For example, if i wanted to write a function that did “Play current line” or “Jump to master track” …how could i quickly tell what the function call in lua would be, if it exists?
Not easy, all tool links start with a tilde sign (~) which makes tool specific shortcuts recognisable but search turns up nothing if you enter this sign in the searchbox.
Actually, i really should write a xmodmap file that maps this character to a key and paste it here, for other linux users -)
/* EDIT */
On a related (actually back on) topic, this may seem retarded, but i can’t seem to find the function that tells your script whether the song is playing or not :? :? i tried renoise.song():song_is_playing() and variants thereof…
This is very, very useful indeed. Question: where would i put this so i don’t have to copy/paste it into renoise’s scripting term window every time i load up renoise?
For bonus points, another question about scope of functions/variables: how, if possible, would i directly call “tool_function_x” in script “mytool”, from the scripting terminal?