Old 08-14-2023, 01:57 PM   #241
DreamDisease
Human being with feelings
 
Join Date: Jun 2017
Posts: 248
Default

Great, thanks for the quick reply!

In this example:
_, _, needed_value = my_function()

the _'s would overwrite the other in order of reading left to right, right? We just don't care about that because the value would never be needed again? But they don't have to be different names for the function to work?


Also is it possible to change the IDE to point to this https://www.extremraym.com/cloud/reascript-doc

dictionary instead of the default one when you hit F1 on a function? I like that one better, but the F1 pointing is very helpful.

And I guess spaces don't matter to LUA, you could have everything on one line if you wanted?

How do you loop through a table with a for? Is using pairs(table) the go to method? I notice this works for consoledisplaymsgs so does pairs return strings?


Like this

Code:
numbers = {"one", "two", "three", "four"}
j= {}
for key, value in pairs(numbers) do
  table.insert(j,reaper.ShowMessageBox(key, value, 1))
  --reaper.ShowConsoleMsg(j)
end

Also this was driving me crazy the past hour, how come this didn't work?

Code:
function inttobool(int)
 reaper.ShowConsoleMsg("int is :" .. int .. "\n")
    if int == true then r = 1 else r = 0 end
    return r
end
Does 1 = true and 0 = false? I was passing the value of 'playalltakes' into this function, and the playalltakes value was either 0.0 or 1.0, which I thought was just 'true' or 'false'. No?

It works now that I did

Code:
function inttobool(int)
 reaper.ShowConsoleMsg("int is :" .. int .. "\n")
    if int == 1.0 then r = 1 else r = 0 end
    return r
end
But why did I have to do that? It didn't even work with 1 I had to put 1.0
__________________
You got the music in you

Last edited by DreamDisease; 08-14-2023 at 03:57 PM.
DreamDisease is offline   Reply With Quote
Old 01-11-2024, 12:05 AM   #242
dimtok
Human being with feelings
 
Join Date: Dec 2019
Location: sthlm, swe
Posts: 147
Default

How could one stuff a midi note on/off to selected track?
dimtok is offline   Reply With Quote
Old 01-11-2024, 01:35 AM   #243
cool
Human being with feelings
 
Join Date: Dec 2017
Location: Sunny Siberian Islands
Posts: 957
Default

Quote:
Originally Posted by dimtok View Post
How could one stuff a midi note on/off to selected track?
If you are the same guy from the RMM forum, then I have already fulfilled your request, haha.


If not, then:

Code:
-------------------------------------- MK Send All Note Offs on Track Changing (Defer)-----------------------

local r = reaper

function Main()
local trackx = track

            track = r.GetSelectedTrack(0, 0)

            if trackx ~= track then  
               r.Main_OnCommand(40345, 0) -- 
            end

         reaper.defer(Main)
end

Main()


-----------------------------------------------------------------------------------
-- Set ToolBar Button ON
function SetButtonON()
  local is_new_value, filename, sec, cmd, mode, resolution, val = r.get_action_context()
  r.SetToggleCommandState( sec, cmd, 1 ) -- Set ON
  r.RefreshToolbar2( sec, cmd )
end

-- Set ToolBar Button OFF
function SetButtonOFF()
  local is_new_value, filename, sec, cmd, mode, resolution, val = r.get_action_context()
  r.SetToggleCommandState( sec, cmd, 0 ) -- Set OFF
  r.RefreshToolbar2( sec, cmd )
end
-----------------------------------------------------------------------------------
SetButtonON()


function OnExit()
SetButtonOFF()
end

r.atexit(OnExit)
cool is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:20 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.