[Solved] Help: button and repeat a function with mouse click

From where you’re at now, maybe it’s simplest to make a “wrapper function” for it, switching from first to second timer after one run. I have not tried the code below, but the principle should be clear.

pressed = function() repeat_wrapper() end,
released = function() repeat_wrapper(true) end
      
      
function repeat_wrapper(release)

if not release then
if renoise.tool():has_timer(repeat_wrapper) then
wmp_fn_bt_vol()
-- switch to fast timer on second run
renoise.tool():remove_timer(repeat_wrapper)
renoise.tool():add_timer(wmp_fn_bt_vol, 100)
else
-- first run
wmp_fn_bt_vol()
renoise.tool():add_timer(repeat_wrapper, 500)
end
else -- release all timers
if renoise.tool():has_timer(repeat_wrapper) then
renoise.tool():remove_timer(repeat_wrapper)
elseif renoise.tool():has_timer(wmp_fn_bt_vol) then
renoise.tool():remove_timer(wmp_fn_bt_vol)
end
end
  
end

PS. A little bit of warning: in case you MIGHT trigger more than one button at a time (for example via midi?) the code might become a bit more complicated. Not 100% sure it’s enough to localize the functions in the correct scope in that case, or if it’s needed to put them in a global table, for example. Anyway, I am guessing you’re only pushing one button at a time here.

Thank you for this!It works perfectly! Yes, repeating buttons are only used with the mouse. I have reduced the values to 40 and 400 respectively to fine tune. I am very happy with this tool, the module that includes the virtual piano for write with the mouse.I love!

Too bad that the keys do not light when playing notes in the pattern editor, would be great…

I have already shared the GT16-Colors tool in beta.You can try it here: GT16-Colors v1.2b

Could you try tool module 8 in Advanced Tools Selector (WMP), using the mouse to the beast?What do you think?

Many thanks for the help joule! :slight_smile: