Detect Number_Value (Effect Column) On Playback And Run Function?

Hi, how would I go about detecting number_value (effect column) on playback and run a function?
now, obviously this bit of code doesn’t do anything, but I got around to where it became possible to show a specific row(cursor on top of row)'s state. But how to keep running it for every row during playback? Is it possible with Lua?

  
function accomplishsomething()  
local t=renoise.song().transport  
if renoise.song().selected_effect_column.number_value==248 then  
 renoise.app():show_status("1M4M")   
else  
t:panic()  
 renoise.app():show_status("IMAM")   
end  
end  
  

If I remember discussions on the forums here correctly, the Lua selected_(anything in the pattern editor) lags a good deal behind the actual playback position, so it’s nearly impossible to do any sort of processing based on the row content in real time during playback.

The song_pos properties have no observable so you would need the app idle notifier to call your specific function, but this notifier function only gives your routine a shot every 10msecs at least.

This is pretty unusable in most cases though, when your routine is processed, another row is already being played.
The faster your song runs, the more likely commands will be missed because the line(s) passed within those 10msecs.

I know what you’re aiming for, but the API in Renoise is simply too slow for that kind of required accuracy.

Well, that’s good to know so I don’t get too confused trying to do it :)

The API is not “too slow”. Its operating on a different level: It’s not running as a part of the player, but it’s running as a part of the UI, so it can not apply those commands in realtime.

But yes, if you want to emulate running scripts from pattern commands, this will kinda work, but never be reliable. We would need to allow running scripts in realtime first. This maybe will happen at some point, but definitely opens another really big can of worms, so we have to be very careful here.

Perhaps allowing a queing poll to call routines (like the idle time notifier) to act upon specific requests matching specific area conditions or values could solve the problem as well for the Pattern editor. If a specific command in the pattern editor is given that Renoise automatically probes these queues and fire the Lua routines bound to a match.
that would remove the need for an observable on the song position.

I’d be using it to toggle pattern block loops on and off, hopefully on a “repeat this block loop 4 times, then play THIS blockloop 2 times, then repeat the next blockloop for 4 times and the next 2 times, etc”-basis.
This so far seems to be the only way to mimic the SBx pattern effect

  
SB0 - Set loopback point  
SBx - Loop x times to loopback point  
  

Is it so that since the API can’t be used to change selection, that the patterniterator is the best choice?

Like this:

32 Row Pattern
Cursor on Row 15 (lots of notes on rows 00 and 15) - activate shortcut… 00-15 content is copied to 16-31 content. based on the cursor’s selected_line_index - with the purpose of accomplishing this:
"copy everything above the cursor to below the cursor, once.