-- SEPTEMBER 2022 - Removed the Church At Work Banner Displaying -- DECEMBER 2022 - Removed Church At Work since there is no automation needed -- - Added option to set the soloist for piano or organ -- - ADVENT VERSION - Invocation moves LEFT to the Advent Wreath -- obs = obslua sf = string.format automation = true logging = true function log (item) if logging then print (item) end end -- Dispatch function -- This function uses an anonymous function to pass in the count to -- the automation routines -- It also clears the current callback function dispatch (func, count) return function() func(count) obs.remove_current_callback() end end function show_hide_source(source,action) -- Turn on or off sources within a scene local scene = obs.obs_frontend_get_current_scene() local scene1 = obs.obs_scene_from_source(scene) local sceneitem = obs.obs_scene_find_source(scene1, source) if sceneitem ~= nil then if action == 1 then status = obs.obs_sceneitem_set_visible(sceneitem, true) else status = obs.obs_sceneitem_set_visible(sceneitem, false) end end obs.obs_source_release(scene) --obs.obs_scene_release(scene1) end -- Function to get the name of the current scene function get_current_scene_name() local scene = obs.obs_frontend_get_current_scene() local cur_scene_name = obs.obs_source_get_name(scene) obs.obs_source_release(scene) return cur_scene_name end -- this function is called when the scene is changed function sceneChange(event) if (automation) then if event == obs.OBS_FRONTEND_EVENT_SCENE_CHANGED then local cur_scene = get_current_scene_name() -- log ("in sceneChange scene is --> " .. cur_scene) -- Find which scene is active from our list local sc_index = 0 for i = 1, table.getn(scenes) do if scenes[i] == cur_scene then sc_index = i end end -- Call the correct callback function based on the scene -- using the "dispatch" function if sc_index > 0 then cb_routine = callback_routines[sc_index] obs.timer_add (dispatch(cb_routine,0),500) end end end end -- Automation for Prelude-1 Scene -- Both cameras are active in this scene and are preset in the -- OpeningSplash scene function pre1(count) local delay = 0 -- Stop the automation if the scene has changed local scene_name = get_current_scene_name() if scene_name ~= "Prelude-1" then log ("Scene has changed. Stopping automation for Prelude-1") return end if count == 0 then log ("Begin Prelude-1 routine") -- Display Image of the Cross (should be on but just make sure) -- Make sure both cameras are off show_hide_source ("Cross-RIGHT",1) show_hide_source ("LEFT-Live", 2) show_hide_source ("RIGHT-Live", 2) delay = 4000 elseif count == 1 then -- Turn on Prelude-1 Banner show_hide_source("Prelude-1 Banner",1) -- Move LEFT and RIGHT cameras to their starting position show_hide_source ("LEFT to Flowers",1) show_hide_source ("RIGHT to Congregation",1) delay = 6000 elseif count == 2 then -- Turn off Prelude Banner and camera moves show_hide_source("Prelude-1 Banner",2) show_hide_source ("LEFT to Flowers",2) show_hide_source ("RIGHT to Congregation",2) delay = 5000 elseif count == 3 then -- Switch to RIGHT camera (CONGREGATION) show_hide_source ("RIGHT-Live", 1) show_hide_source ("Cross-RIGHT", 2) delay = 10000 elseif count == 4 then -- Switch to LEFT camera (FLOWERS) show_hide_source ("LEFT-Live", 1) show_hide_source ("RIGHT-Live", 2) delay = 5000 elseif count == 5 then -- Turn on Worship Sunday Banner -- Move Right Camera show_hide_source("Sunday Banner", 1) if prelude1 == "Organ" then show_hide_source("RIGHT to Organ",1) else show_hide_source("RIGHT to Piano",1) end delay = 7000 elseif count == 6 then -- Turn off Sunday Banner show_hide_source("Sunday Banner", 2) -- Turn on Flowers Banner if applicable if show_flowers == "Yes" then show_hide_source("Flowers Banner", 1) end show_hide_source ("RIGHT to Organ",2) show_hide_source ("RIGHT to Piano", 2) delay = 10000 elseif count == 7 then -- Turn OFF Flowers Banner show_hide_source("Flowers Banner", 2) delay = 3000 elseif count == 8 then -- Switch to RIGHT, turn off LEFT show_hide_source("RIGHT-Live",1) show_hide_source("LEFT-Live",2) delay = 2000 elseif count == 9 then -- Move LEFT to full front view show_hide_source ("LEFT to Full-Front",1) delay = 13000 elseif count == 10 then show_hide_source ("LEFT-Live",1) show_hide_source("RIGHT-Live",2) show_hide_source ("LEFT to Full-Front",2) delay=4000 elseif count == 11 then show_hide_source("RIGHT to Pulpit",1) delay = 1000 elseif count == 12 then show_hide_source("RIGHT to Pulpit",2) log ("Ending automation for Prelude-1 Routine") return end -- Set callback for next iteration obs.timer_add(dispatch(pre1,count+1),delay) end -- Automation for Church At Work Scene function caw(count) local delay = 0 -- Stop the automation if the scene has changed local scene_name = get_current_scene_name() if scene_name ~= "Church At Work" then log ("Scene has changed. Stopping automation for Church At Work") return end if count == 0 then delay = 2000 log ("Begin Church at Work routine") elseif count == 1 then -- Move LEFT camera to WIDE Chancel Table show_hide_source ("LEFT to WIDE Chancel Table", 1) delay = 1000 elseif count == 2 then -- Turn off the camera move and end automation for this scene show_hide_source ("LEFT to WIDE Chancel Table", 2) log ("End automation for church at work") return end -- Set callback for next iteration obs.timer_add(dispatch(caw,count+1),delay) end -- Automation for Prelude-2 Scene -- Both cameras are active in this scene function pre2(count) local delay = 0 -- Stop the automation if the scene has changed local scene_name = get_current_scene_name() if scene_name ~= "Prelude-2" then log ("Scene has changed. Stopping automation for Prelude-2") return end if count == 0 then log ("Begin Prelude-2 routine") -- Turn on LEFT camera, wait 4 sec show_hide_source ("LEFT-Live", 1) show_hide_source ("RIGHT-Live", 2) -- Additional 13 seconds added for Trinity Chimes delay = 4000 + 13000 elseif count == 1 then -- Turn on Prelude-2 Banner show_hide_source("Prelude-2 Banner",1) -- Move RIGHT camera to instrument if prelude2 == "Organ" then show_hide_source("RIGHT to Organ",1) else show_hide_source("RIGHT to Piano",1) end delay = 8000 elseif count == 2 then -- Turn off Prelude-2 Banner and camera move show_hide_source("Prelude-2 Banner",2) show_hide_source("RIGHT to Organ",2) show_hide_source("RIGHT to Piano",2) delay = 35000 elseif count == 3 then -- Switch to RIGHT camera show_hide_source ("RIGHT-Live", 1) show_hide_source ("LEFT-Live", 2) delay = 2000 elseif count == 4 then -- Move LEFT camera to Choir Loft show_hide_source ("LEFT to Choir Loft", 1) delay = 1000 elseif count == 5 then -- Turn OFF LEFT camera move - End this automation show_hide_source("LEFT to Choir Loft", 2) log ("Ending automation for Prelude-2 Routine") return end -- Set callback for next iteration obs.timer_add(dispatch(pre2,count+1),delay) end -- Automation for Hymn 1 Scene -- Camera LEFT-Live is the source for this scene function h1(count) local delay = 0 -- Stop the automation if the scene has changed local scene_name = get_current_scene_name() if scene_name ~= "Hymn 1" then log ("Scene has changed. Stopping automation of Hymn 1") return end if count == 0 then log ("Begin Hymn 1 routine") delay = 6000 elseif count == 1 then -- Turn on Hymn 1 banner, Move RIGHT to Pulpit show_hide_source("Hymn-1 Banner", 1) show_hide_source("RIGHT to Pulpit", 1) delay = 8000 elseif count == 2 then -- Turn off Hymn 1 banner and camera move and end automation show_hide_source("Hymn-1 Banner", 2) show_hide_source("RIGHT to Pulpit", 2) log ("End automation for Hymn 1") return end -- Set callback for next iteration obs.timer_add(dispatch(h1,count+1),delay) end -- Automation for Litany Scene function lit(count) local delay = 0 -- Stop the automation if the scene has changed local scene_name = get_current_scene_name() if scene_name ~= "Litany" then log ("Scene has changed. Stopping automation of Litany") return end if count == 0 then log ("Begin litany routine") delay = 3000 elseif count == 1 then -- Turn on Litany Banner, Move LEFT camera show_hide_source("Litany Banner", 1) show_hide_source("LEFT to Lectern",1) delay = 6000 elseif count == 2 then -- Turn OFF Litany Banner and camera move and end automation show_hide_source("Litany Banner", 2) show_hide_source("LEFT to Lectern",2) log ("Ending automation for litany") return end -- Set callback for next iteration obs.timer_add(dispatch(lit,count+1),delay) end -- Automation for the Invocation scene -- ADVENT VERSION - Move LEFT camera to Advent Wreath function inv(count) local delay = 0 -- Stop the automation if the scene has changed local scene_name = get_current_scene_name() if scene_name ~= "Invocation" then log ("Scene has changed. Stopping automation of Invocation") return end if count == 0 then log ("Begin Invocation routine") delay = 2000 elseif count == 1 then -- Move LEFT camera to Advent Wreath show_hide_source("LEFT to Advent Wreath", 1) delay = 1000 elseif count == 2 then -- Turn OFF camera move and end automation show_hide_source("LEFT to Advent Wreath", 2) log ("Ending automation for Invocation") return end -- Set callback for next iteration obs.timer_add(dispatch(inv,count+1),delay) end -- Automation for Scripture Scene -- Camera RIGHT-Live is the source for this Scene function scr(count) local delay = 0 -- Stop the automation if the scene has changed local scene_name = get_current_scene_name() if scene_name ~= "Scripture" then log ("Scene has changed. Stopping automation of Scripture") return end if count == 0 then log ("Begin Scripture routine") delay = 8000 elseif count == 1 then -- Turn on Scripture Banner show_hide_source("Scripture Banner", 1) -- Move LEFT to lectern -- Note that it might already be there if no childrens sermon show_hide_source("LEFT to Lectern",1) delay = 8000 elseif count == 2 then -- Turn OFF Scripture Banner, camera move, and end automation show_hide_source("Scripture Banner", 2) show_hide_source("LEFT to Lectern", 2) log ("Ending automation for scripture") return end -- Set callback for next iteration obs.timer_add(dispatch(scr,count+1),delay) end -- Automation for Hymn 2 Scene -- Camera LEFT is the source for this scene function h2(count) local delay = 0 -- Stop the automation if the scene has changed local scene_name = get_current_scene_name() if scene_name ~= "Hymn 2" then log ("Scene has changed. Stopping automation of Hymn 2") return end if count == 0 then log ("Begin Hymn 2 routine") delay = 6000 elseif count == 1 then -- Turn on Hymn 2 Banner show_hide_source("Hymn-2 Banner", 1) -- Move Camera RIGHT to Back Wall if worship music is Instrumental --if worship_music == "Instrumental" then --show_hide_source ("RIGHT to Back Wall", 1) --end delay = 8000 elseif count == 2 then -- Turn OFF Hymn 2 Banner show_hide_source("Hymn-2 Banner", 2) -- Turn off the right-camera-move source if necessary if worship_music == "Instrumental" then show_hide_source ("RIGHT to Back Wall", 2) end -- End the automation log ("Ending automation for Hymn 2") return end -- Set callback for next iteration obs.timer_add(dispatch(h2,count+1),delay) end -- Automation for Doxology -- Camera LEFT is the source for this scene function dox(count) local delay = 0 -- Stop the automation if the scene has changed local scene_name = get_current_scene_name() if scene_name ~= "Doxology" then log ("Scene has changed. Stopping automation of Doxology") return end if count == 0 then log ("Begin Doxology routine") delay = 2000 elseif count == 1 then -- Move Camera RIGHT to Back Wall if worship music is Instrumental if worship_music == "Instrumental" then show_hide_source ("RIGHT to Back Wall", 1) end -- Move Camera RIGHT to Choir Loft if worship music is Choir Anthem if worship_music == "Choir" then show_hide_source ("RIGHT to Choir Loft", 1) end delay = 2000 elseif count == 2 then -- Turn OFF both moves show_hide_source("RIGHT to Back Wall", 2) show_hide_source("RIGHT to Choir Loft", 2) -- End the automation log ("Ending automation for Doxology") return end -- Set callback for next iteration obs.timer_add(dispatch(dox,count+1),delay) end -- Automation for Worship Music Scene function wmus(count) local delay = 0 -- Stop the automation if the scene has changed local scene_name = get_current_scene_name() if scene_name ~= "Worship Music" then log ("Scene has changed. Stopping automation of Worship Music") return end if count == 0 then log ("Begin Worship Music routine") -- If the music is Instrumental or Choir, switch to RIGHT if worship_music == "Instrumental" or worship_music == "Choir" then show_hide_source ("RIGHT-Live", 1) show_hide_source ("LEFT-Live", 2) delay = 3000 else -- Worship music is solo so set the correct camera if solo-location == "Pulpit" then show_hide_source ("RIGHT-Live",1) show_hide_source ("LEFT-Live",2) else show_hide_source ("LEFT-Live", 1) show_hide_source ("RIGHT-Live", 2) end delay = 6000 end elseif count == 1 then -- If soloist, turn on the banner if worship_music == "Soloist" then show_hide_source ("Soloist Banner", 1) end -- If Instrumental, turn on the choir anthem banner -- Move LEFT to back wall if worship_music == "Instrumental" then show_hide_source ("Choir Banner", 1) show_hide_source ("LEFT to Back Wall", 1) end -- If Choir, turn on the choir anthem banner -- Move LEFT to choir loft if worship_music == "Choir" then show_hide_source ("Choir Banner", 1) show_hide_source ("LEFT to Choir Loft", 1) end delay = 5000 elseif count == 2 then -- Turn off the banners and the camera move show_hide_source ("Soloist Banner", 2) show_hide_source ("Choir Banner", 2) show_hide_source ("LEFT to Back Wall", 2) show_hide_source ("LEFT to Choir Loft", 2) delay = 30000 elseif count == 3 then -- If Instrumental or Choir, switch to LEFT if worship_music == "Instrumental" or worship_music == "Choir" then show_hide_source ("LEFT-Live", 1) show_hide_source ("RIGHT-Live", 2) end delay = 2000 elseif count == 4 then -- If Instrumental or Choir move RIGHT to Pulpit if worship_music == "Instrumental" or worship_music == "Choir" then show_hide_source ("RIGHT to Pulpit", 1) end delay = 2000 elseif count == 5 then -- One last clean up - turn off the RIGHT to Pulpit move and end automation show_hide_source ("RIGHT to Pulpit", 2) log ("Ending automation for Worship Music") return end -- Set callback for next iteration obs.timer_add(dispatch(wmus,count+1),delay) end -- Automation for Sermon Scene -- Camera RIGHT is the source for this scene function ser(count) local delay = 0 -- Stop the automation if the scene has changed local scene_name = get_current_scene_name() if scene_name ~= "Sermon" then log ("Scene has changed. Stopping automation of Sermon") return end if count == 0 then log ("Begin Sermon routine") delay = 4000 elseif count == 1 then -- Turn on Sermon Title Banner show_hide_source("Sermon Title Banner", 1) -- If worship music was Instrumental or choir, need to move LEFT back to Lectern if worship_music == "Instrumental" or worship_music == "Choir" then show_hide_source ("LEFT to Lectern", 1) end delay = 5000 elseif count == 2 then -- Turn OFF Sermon Title Banner and LEFT camera move show_hide_source("Sermon Title Banner", 2) show_hide_source ("LEFT to Lectern", 2) delay = 3000 elseif count == 3 then -- Turn on Sermon Speaker Banner if sermon_speaker ~= "Other" then banner = sermon_speaker .. " Banner" show_hide_source(banner, 1) delay = 5000 end elseif count == 4 then -- Turn OFF Sermon Speaker Banner and end automation if sermon_speaker ~= "Other" then show_hide_source(banner, 2) end log ("Ending automation for Sermon") return end -- Set callback for next iteration obs.timer_add(dispatch(ser,count+1),delay) end -- Automation for Hymn 3 Scene -- Camera LEFT is the source for this scene function h3(count) local delay = 0 -- Stop the automation if the scene has changed local scene_name = get_current_scene_name() if scene_name ~= "Hymn 3" then log ("Scene has changed. Stopping automation of Hymn 2") return end if count == 0 then log ("Begin Hymn 3 routine") delay = 9000 elseif count == 1 then -- Turn on Hymn 3 Banner, Move RIGHT camera to Floor show_hide_source("Hymn-3 Banner", 1) show_hide_source("RIGHT to Floor Middle", 1) delay = 8000 elseif count == 2 then -- Turn OFF Hymn 3 Banner and camera move show_hide_source("Hymn-3 Banner", 2) show_hide_source("RIGHT to Floor Middle", 2) -- End the automation log ("Ending automation for Hymn 3") return end -- Set callback for next iteration obs.timer_add(dispatch(h3,count+1),delay) end function pben(count) local delay = 0 -- Stop the automation if the scene has changed local scene_name = get_current_scene_name() if scene_name ~= "Pastoral Benediction" then log ("Scene has changed. Stopping automation of Pastoral Benediction") return end if count == 0 then log ("Begin Pastoral Benediction routine") delay = 2000 elseif count == 1 then -- Move the LEFT camera to the choir loft show_hide_source("LEFT to Choir Loft",1) delay = 2000 elseif count == 2 then -- Turn OFF camera move show_hide_source("LEFT to Choir Loft", 2) log ("Ending automation for Pastoral Benediction") return end -- Set callback for next iteration obs.timer_add(dispatch(pben,count+1),delay) end -- Automation for Musical Benediction Scene -- Camera LEFT is the source for this scene function mben(count) local delay = 0 -- Stop the automation if the scene has changed local scene_name = get_current_scene_name() if scene_name ~= "Musical Benediction" then log ("Scene has changed. Stopping automation of Musical Benediction") return end if count == 0 then log ("Begin Musical Benediction routine") delay = 2000 elseif count == 1 then show_hide_source("RIGHT to Congregation",1) delay = 1000 elseif count == 2 then show_hide_source("RIGHT to Congregation", 2) log ("Ending automation for Musical Benediction") return end -- Set callback for next iteration obs.timer_add(dispatch(mben,count+1),delay) end -- Automation for Postlude Scene -- Both Cameras are active in this scene function pos(count) local delay = 0 -- Stop the automation if the scene has changed local scene_name = get_current_scene_name() if scene_name ~= "Postlude" then log ("Scene has changed. Stopping automation of Postlude") return end if count == 0 then log ("Begin Postlude routine") -- Start with RIGHT show_hide_source ("RIGHT-Live", 1) show_hide_source ("LEFT-Live", 2) -- Move LEFT camera if postlude == "Piano" or postlude == "Both" then show_hide_source ("LEFT to Piano", 1) else show_hide_source ("LEFT to Organ",1) end delay = 15000 elseif count == 1 then show_hide_source("LEFT-Live",1) show_hide_source("RIGHT-Live",2) show_hide_source("LEFT to Organ",2) show_hide_source("LEFT to Piano",2) delay = 1500 elseif count == 2 then show_hide_source ("RIGHT to Organ",1) delay = 1000 elseif count == 3 then -- Turn on Postlude Banner show_hide_source("Postlude Banner", 1) show_hide_source("RIGHT to Organ",2) delay = 5000 elseif count == 4 then -- Turn OFF Postlude Banner show_hide_source("Postlude Banner", 2) delay = 2000 elseif count == 5 then -- Switch to SPLIT Screen if postlude is "BOTH" if postlude == "Both" then show_hide_source ("RIGHT-LEFT-Split Screen",1) show_hide_source ("LEFT-Live",2) elseif postlude == "Organ" then show_hide_source ("RIGHT-Live",1) show_hide_source ("LEFT-Live",2) end delay = 30000 elseif count == 6 then -- Switch to image of Cross show_hide_source ("Cross-RIGHT",1) show_hide_source ("RIGHT-Live",2) show_hide_source ("LEFT-Live",2) show_hide_source ("RIGHT-LEFT-Split Screen",2) log ("Ending automation for Postlude") return end -- Set callback for next iteration obs.timer_add(dispatch(pos,count+1),delay) end -- A function named script_properties defines the properties that the user -- can change for the entire script module itself function script_properties() local props = obs.obs_properties_create() -- This property defines whether or not to display the flowers banner local flowerbanner = obs.obs_properties_add_list( props,"flower-on-off","Show Flower Dedication Banner", obs.OBS_COMBO_TYPE_EDITABLE, obs.OBS_COMBO_FORMAT_STRING) obs.obs_property_list_add_string(flowerbanner,"No","No") obs.obs_property_list_add_string(flowerbanner,"Yes","Yes") -- This property defines which instrument(s) play the Prelude 1 local prelude1 = obs.obs_properties_add_list( props,"prelude1-instrument","Prelude 1 Instrument", obs.OBS_COMBO_TYPE_EDITABLE, obs.OBS_COMBO_FORMAT_STRING) obs.obs_property_list_add_string(prelude1,"Organ","Organ") obs.obs_property_list_add_string(prelude1,"Piano","Piano") obs.obs_property_list_add_string(prelude1,"Both","Both") -- This property defines which instrument(s) play the Prelude 2 local prelude2 = obs.obs_properties_add_list( props,"prelude2-instrument","Prelude 2 Instrument", obs.OBS_COMBO_TYPE_EDITABLE, obs.OBS_COMBO_FORMAT_STRING) obs.obs_property_list_add_string(prelude2,"Organ","Organ") obs.obs_property_list_add_string(prelude2,"Piano","Piano") -- This property defines whether or not there is a children's sermon local childrensermon = obs.obs_properties_add_list( props,"children-sermon","Childrens Sermon", obs.OBS_COMBO_TYPE_EDITABLE, obs.OBS_COMBO_FORMAT_STRING) obs.obs_property_list_add_string(childrensermon,"Yes","Yes") obs.obs_property_list_add_string(childrensermon,"No","No") -- This property defines what the Worship Music will be local wormus = obs.obs_properties_add_list( props, 'wor-music', 'Worship Music Type', obs.OBS_COMBO_TYPE_EDITABLE, obs.OBS_COMBO_FORMAT_STRING) obs.obs_property_list_add_string(wormus, "Soloist", "Soloist") obs.obs_property_list_add_string(wormus, "Instrumental", "Instrumental") obs.obs_property_list_add_string(wormus, "Choir", "Choir") -- This property defines where the soloist will sing local solo_loc = obs.obs_properties_add_list( props,"solo-location","Soloist Location", obs.OBS_COMBO_TYPE_EDITABLE, obs.OBS_COMBO_FORMAT_STRING) obs.obs_property_list_add_string(solo_loc,"Pulpit","Pulpit") obs.obs_property_list_add_string(solo_loc,"Lectern","Lectern") -- This property defines who will deliver the Sermon local sersp = obs.obs_properties_add_list( props,'ser-speaker','Sermon Speaker', obs.OBS_COMBO_TYPE_EDITABLE, obs.OBS_COMBO_FORMAT_STRING) -- Populate the church-at-work and sermon speaker properties for i = 1,5 do obs.obs_property_list_add_string(sersp, speakers[i], speakers[i]) end -- This property defines which instrument(s) play the Postlude local postlude = obs.obs_properties_add_list( props,"postlude-instrument","Postlude Instrument", obs.OBS_COMBO_TYPE_EDITABLE, obs.OBS_COMBO_FORMAT_STRING) obs.obs_property_list_add_string(postlude,"Organ","Organ") obs.obs_property_list_add_string(postlude,"Piano","Piano") obs.obs_property_list_add_string(postlude,"Both","Both") obs.obs_properties_add_button(props, "button", "Init Scenes", init_scenes) return props end -- A function named script_update will be called when settings are changed function script_update(settings) show_flowers = obs.obs_data_get_string(settings,"flower-on-off") worship_music = obs.obs_data_get_string(settings, "wor-music") solo_loc = obs.obs_data_get_string(settings, "solo-location") sermon_speaker = obs.obs_data_get_string(settings, "ser-speaker") childrensermon = obs.obs_data_get_string(settings, "children-sermon") prelude1 = obs.obs_data_get_string(settings, "prelude1-instrument") prelude2 = obs.obs_data_get_string(settings, "prelude2-instrument") postlude = obs.obs_data_get_string(settings, "postlude-instrument") end -- A function named script_defaults will be called to set the default settings function script_defaults(settings) obs.obs_data_set_default_string(settings,"flower-on-off","No") obs.obs_data_set_default_string(settings, "ser-speaker", "Freeman") obs.obs_data_set_default_string(settings, "wor-music", "Soloist") obs.obs_data_set_default_string(settings, "solo-location", "Pulpit") obs.obs_data_set_default_string(settings, "children-sermon", "Yes") obs.obs_data_set_default_string(settings, "prelude1-instrument", "Organ") obs.obs_data_set_default_string(settings, "prelude2-instrument", "Organ") obs.obs_data_set_default_string(settings, "postlude-instrument", "Organ") end -- script_load is called when the script is loaded -- Set it up to call "sceneChange" on a scene event function script_load(settings) obs.obs_frontend_add_event_callback(sceneChange) end function script_description() return 'Automate camera movement and banners within worship scenes\n' .. 'by Pat Lewallen 2020' end function init_scenes() -- This function sets all the scenes to their initial state log("Initializing Scenes. PLEASE WAIT." ) automation = false for i = 1,#scenes do local source = obs.obs_get_source_by_name(scenes[i]) obs.obs_source_release(source) obs.obs_frontend_set_current_scene(source) for j = 1,source_count[i] do show_hide_source(sources_by_scene[i][j],scene_initial_state[i][j]) end end source = obs.obs_get_source_by_name("BLANK SCREEN") obs.obs_source_release(source) obs.obs_frontend_set_current_scene(source) automation = true log("Initializing COMPLETED") end scenes = {"Prelude-1", "Church At Work", "Prelude-2", "Hymn 1", "Litany", "Invocation", "Scripture", "Hymn 2", "Doxology", "Worship Music", "Sermon", "Hymn 3", "Pastoral Benediction", "Musical Benediction", "Postlude"} callback_routines = {pre1, caw, pre2, h1, lit, inv, scr, h2, dox, wmus, ser, h3, pben, mben, pos} speakers = {"Freeman", "Harner", "Gessner", "Guest Speaker", "Other"} source_count = {14,6,6,4,4,3,3,2,3,7,7,3,2,3,8} sources_by_scene = { -- Sources in Prelude-1 Scene {"LEFT to Full-Front","LEFT to Organ","LEFT to Piano","LEFT to Flowers", "RIGHT to Piano","RIGHT to Organ","RIGHT to Pulpit","RIGHT to Congregation", "Prelude-1 Banner","Sunday Banner","Flowers Banner", "RIGHT-Live","LEFT-Live","Cross-RIGHT"}, -- Sources in Church At Work Scene {"LEFT to WIDE Chancel Table","Guest Speaker Banner","Gessner Banner", "Harner Banner","Freeman Banner","RIGHT-Live"}, -- Sources in Prelude-2 Scene {"RIGHT to Organ","RIGHT to Piano","LEFT to Choir Loft", "Prelude-2 Banner","RIGHT-Live","LEFT-Live"}, -- Sources in Hymn 1 {"RIGHT to Pulpit", "Hymn-1 Banner","Gessner Banner","LEFT-Live"}, -- Litany {"LEFT to Lectern","Litany Banner","LEFT-Live","RIGHT-Live"}, -- Invocation {"LEFT to Advent Wreath","RIGHT-Live", "LEFT-Live"}, -- Scripture {"Scripture Banner","LEFT-Live","RIGHT-Live"}, -- Hymn 2 {"Hymn-2 Banner","LEFT-Live"}, -- Doxology {"LEFT-Live","RIGHT to Choir Loft","RIGHT to Back Wall"}, -- Worship Music {"LEFT to Choir Loft","LEFT to Back Wall","RIGHT to Pulpit","Choir Banner", "Soloist Banner","RIGHT-Live","LEFT-Live"}, -- Sermon {"LEFT to Lectern","Sermon Title Banner","Harner Banner","Gessner Banner", "Freeman Banner","Guest Speaker Banner","RIGHT-Live"}, -- Sources in Hymn 3 {"RIGHT to Floor Middle", "Hymn-3 Banner","LEFT-Live"}, -- Pastoral Benediction {"LEFT to Choir Loft", "RIGHT-Live"}, -- Musical Benediction {"RIGHT to Congregation","Benediction Banner","LEFT-Live"}, -- Postlude {"LEFT to Piano","LEFT to Organ","RIGHT to Organ","Postlude Banner", "RIGHT-LEFT-Split Screen","RIGHT-Live","LEFT-Live", "Cross-RIGHT"} } scene_initial_state = { -- Initial state for each routine (2 is "off", 1 is "on") -- Prelude 1 {2,2,2,2,2,2,2,2,2,2,2,2,2,1}, -- Church at Work {2,2,2,2,2,1}, -- Prelude-2 {2,2,2,2,2,1}, -- Hymn-1 {2,2,2,1}, -- Litany {2,2,2,1}, -- Invocation {2,1,2}, -- Scripture {2,2,1}, -- Hymn 2 {2,1}, -- Doxology {1,2,2}, -- Worship Music {2,2,2,2,2,2,1}, -- Sermon {2,2,2,2,2,2,1}, -- Hymn 3 {2,2,1}, -- Pastoral Benediction {2,1}, -- Musical Benediction {2,2,1}, -- Postlude {2,2,2,2,2,1,2,2} }