BECOME PART OF THE COMMUNITY - Sign up here
  • Hey All,

    im by no means a Lua master, I got this one from some kind person who posted it. I use it all the time but after doing the update to 2.0 it no longer works.

    any ideas of what i can change to make this work again??

    ( this is a past of the actually lua code from my showfile)

    Thanks



    ------------------------------------------------------------------------
    -- shortcuts
    ------------------------------------------------------------------------
    local input = TextInput
    ------------------------------------------------------------------------
    -- local variables
    ------------------------------------------------------------------------
    local totalfixture,indexfixture,handlefixture,a,b,answer
    ------------------------------------------------------------------------
    -- Functions,tables
    ------------------------------------------------------------------------
    local fixturetable,selector,reset,invert,descTable,run,Cleanup
    local myfixtures={}
    ------------------------------------------------------------------------

    ------------------------------------------------------------------------
    function fixturetable()

    indexfixture = SelectionFirst()

    -- Cancel the plugin if no fixture is selected
    assert(indexfixture,"No fixture selected! Please select a fixture first.")

    repeat
    handlefixture=GetSubfixture(indexfixture)
    table.insert(myfixtures,handlefixture.FID)
    indexfixture = SelectionNext(indexfixture)
    until not indexfixture;

    selector()

    end
    ------------------------------------------------------------------------

    ------------------------------------------------------------------------
    function selector()

    descTable = {
    title = " INVERTOR ",
    caller = GetFocusDisplay(),
    items = {"PAN DMX INVERT","PAN ENC INVERT","TILT DMX INVERT","TILT ENC INVERT","RESET"},
    selectedValue = "RESET",
    }

    a,b = PopupInput(descTable)
    if a==4 then reset() else invert() end
    end
    ------------------------------------------------------------------------

    ------------------------------------------------------------------------
    function reset()

    for index,value in pairs(myfixtures) do
    local fi=('fi '..value)
    Cmd('set '..fi..' '..'PANDMXINVERT 0' )
    Cmd('set '..fi..' '..'TILTDMXINVERT 0' )
    Cmd('set '..fi..' '..'PANENCINVERT 0' )
    Cmd('set '..fi..' '..'TILTENCINVERT 0' )
    end

    Cleanup()

    end
    ------------------------------------------------------------------------

    ------------------------------------------------------------------------
    function invert()
    for index,value in pairs(myfixtures) do
    local fi=('fi '..value)
    Cmd('next')
    indexfixture=SelectionFirst()
    handlefixture = GetSubfixture(indexfixture)

    if a==0
    then handlefixture = (handlefixture.PANDMXINVERT)
    if handlefixture then Cmd('set '..fi..' PANDMXINVERT 0') else Cmd('set '..fi..' PANDMXINVERT 1') end

    elseif a==1
    then handlefixture = (handlefixture.PANENCINVERT)
    if handlefixture then Cmd('set '..fi..' PANENCINVERT 0') else Cmd('set '..fi..' PANENCINVERT 1') end

    elseif a==2
    then handlefixture = (handlefixture.TILTDMXINVERT)
    if handlefixture then Cmd('set '..fi..' TILTDMXINVERT 0') else Cmd('set '..fi..' TILTDMXINVERT 1') end

    elseif a==3
    then handlefixture = (handlefixture.TILTENCINVERT)
    if handlefixture then Cmd('set '..fi..' TILTENCINVERT 0') else Cmd('set '..fi..' TILTENCINVERT 1') end
    end
    end
    Cmd('toggle selection matricks')
    Cleanup()
    end
    ------------------------------------------------------------------------

    ------------------------------------------------------------------------
    function run()
    Printf('INVERTOR started');
    fixturetable();
    end
    ------------------------------------------------------------------------

    ------------------------------------------------------------------------
    function Cleanup()
    Printf('INVERTOR finished');
    myfixtures={}
    end
    ------------------------------------------------------------------------
    return run, Cleanup;

  • for v2.0 compatibility you will also have to shift all comparisons for the variable a with +1, e.g.

    a,b = PopupInput(descTable)

    if a==4 then reset() else invert() end
    end
    --->
    if a==5 then reset() else invert() end
    end

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!