Skip to content

Commit

Permalink
Now Accepts No Page/Seq Argument
Browse files Browse the repository at this point in the history
  • Loading branch information
hossimo committed May 17, 2020
1 parent db8a49b commit 502f2ec
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 21 deletions.
57 changes: 37 additions & 20 deletions grandMA3/shared/resource/lib_plugins/Fade Master.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,28 +56,45 @@ local function Main (display_handle, argument)
local v = UserVars()
local gVarName = ""


if argument == nil or #arguments ~= 4 then
ErrPrintf("Incorrect number of arguments")
ErrPrintf("Plugin \"Fade Master\" \"<Page|Sequence>, <Page#.Executor# | Sequence#>, <Level>, <Seconds> \"")
return
end

faderEnd = Drt.clamp(tonumber(arguments[3]), 0.0, 100.0)
faderTime = Drt.clamp(tonumber(arguments[4]), 0.0, 3600.0)

if string.lower(arguments[1]):sub(1, 3) == "seq" then -- Operate on a Sequence
op = "Sequence"
destSeq = tonumber(arguments[2])
elseif string.lower(arguments[1]):sub(1, 3) == "pag" then -- Operate on a Page
op = "Page"
local x = Drt.split(arguments[2], ".")
if #x == 2 then
if argument == nil then
elseif #arguments == 3 then
faderEnd = Drt.clamp(tonumber(arguments[2]), 0.0, 100.0)
faderTime = Drt.clamp(tonumber(arguments[3]), 0.0, 3600.0)

local x = Drt.split(arguments[1], ".")
if #x == 1 then
op = "Sequence"
destSeq = tonumber(x[1])
elseif #x == 2 then
op = "Page"
destPage = tonumber(x[1])
destExec = tonumber(x[2])
else
ErrPrintf("Incorrect Page Identifier; Page.Ecexutor")
ErrPrintf("Incorrect Sequence/Page Identifier")
return
end
elseif #arguments == 4 then
faderEnd = Drt.clamp(tonumber(arguments[3]), 0.0, 100.0)
faderTime = Drt.clamp(tonumber(arguments[4]), 0.0, 3600.0)

if string.lower(arguments[1]):sub(1, 3) == "seq" then -- Operate on a Sequence
op = "Sequence"
destSeq = tonumber(arguments[2])
elseif string.lower(arguments[1]):sub(1, 3) == "pag" then -- Operate on a Page
op = "Page"
local x = Drt.split(arguments[2], ".")
if #x == 2 then
destPage = tonumber(x[1])
destExec = tonumber(x[2])
else
ErrPrintf("Incorrect Page Identifier; Page.Ecexutor")
return
end
end
else
ErrPrintf("Incorrect number of arguments")
ErrPrintf("Plugin \"Fade Master\" \"<Page|Sequence>, <Page#.Executor# | Sequence#>, <Level>, <Seconds> \"")
return
end


Expand Down Expand Up @@ -122,9 +139,9 @@ local function Main (display_handle, argument)

if faderTime > 0 and math.abs(distance) > 0 then
if op == "Sequence" then
Printf("Running Fade Master on Sequence %d for %d Seconds. To abort fade execute - DelUserVar \"%s\"", destSeq, faderTime, gVarName)
Printf("Running Fade Master on Sequence %d for %d Seconds. To abort - DelUserVar \"%s\"", destSeq, faderTime, gVarName)
elseif op == "Page" then
Printf("Running Fade Master on Page %d.%d for %d Seconds. To abort fade execute - DelUserVar \"%s\"", destPage, destExec, faderTime, gVarName)
Printf("Running Fade Master on Page %d.%d for %d Seconds. To abort - DelUserVar \"%s\"", destPage, destExec, faderTime, gVarName)
end
local interval = (distance * tick)/faderTime
repeat
Expand Down
2 changes: 1 addition & 1 deletion grandMA3/shared/resource/lib_plugins/Fade Master.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<GMA3 DataVersion="1.0.0.3">
<Plugin Name="Fade Master" Author="Hoss" Version="1.1.0.1">
<Plugin Name="Fade Master" Author="Hoss" Version="1.1.0.2">
<ComponentLua Name="Fade Master" FileName="Fade Master.lua" Installed="Yes" LoadOnDemand="Yes" />
<ComponentLua Name="DRT-Utilities" FileName="DRT-Utilities.lua" Installed="Yes" LoadOnDemand="Yes" />
</Plugin>
Expand Down

0 comments on commit 502f2ec

Please sign in to comment.