-
Notifications
You must be signed in to change notification settings - Fork 0
/
getNextFreeSeq.lua
26 lines (25 loc) · 1.03 KB
/
getNextFreeSeq.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
---------------------------- getNextFreeSeq v1.0 ----------------------------
-- martin [at] klangbild [dot] lighting --
-------- Script to set uservar nextFreeSeq to the next free sequence --------
-- nextFreeSeq will be set to zero if nothing is free in the defined range --
-----------------------------------------------------------------------------
function getNextFreeSeq()
local startSeq = 3000 -- first sequence to check
local endSeq = 3990 -- last sequence to check
local setvar = gma.user.setvar -- gma.user.setvar or gma.system.setvar
local gmasleep = gma.sleep (0.1)
local nextFreeSeq = 0 -- don't change
for i = startSeq, endSeq do
if (gma.show.getobj.handle ("seq " .. i)) then
else
nextFreeSeq = i;
break;
end
end
if (nextFreeSeq == 0) then
gma.feedback("Error! No free sequences in defined range between " .. startSeq .. " and " .. endSeq);
end
setvar("nextFreeSeq" , nextFreeSeq);
gmasleep();
end
return getNextFreeSeq;