renoise.song().where_is_cursor ...?

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 :D

You should be looking at things like: ```lua

renoise.song().selected_effect_column_index
renoise.song().selected_line_index
renoise.song().selected_note_column_index
renoise.song().selected_track_index

  
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.

ah, thanks =)

What’s the difference between oprint() and sprint() and just print() ?

…object print? structure print? wild guess =)

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.

Cheers.

Thanks again :D

(and yeah i meant rprint(), not sprint())

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 it’s not a tilde, it’s a sine.
B)

…of the times :lol:/>

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…

That’s because it’s not a function, it’s a variable.

  
renoise.song().transport.playing  
  

:)

And I really wish it was a Tilde so that it would be easy to enter in the Search Box!!!

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?

…so, has this been updated in the 3.0 api?

i mean, is it possible for a lua script to tell if the cursor is on the note, or octave, or volume, etc…?

Would this do?

renoise.song().selected_sub_column_type
→ [read-only, enum = SUB_COLUMN]

-------- Constants

renoise.Song.SUB_COLUMN_NOTE
renoise.Song.SUB_COLUMN_INSTRUMENT
renoise.Song.SUB_COLUMN_VOLUME
renoise.Song.SUB_COLUMN_PANNING
renoise.Song.SUB_COLUMN_DELAY

renoise.Song.SUB_COLUMN_EFFECT_NUMBER
renoise.Song.SUB_COLUMN_EFFECT_AMOUNT

Still read only (you can’t move the cursor) but you can manipulate the pattern data anyway without having to move the cursor.

Seems like it’s exactly what i was looking for, but shame it’s read-only =(