Functions and other scripts run only momentarily when invoked from another script

Ask a question related to the QLC+ 5.x usage here.
Provide as much details as you can, especially what you would like to achieve and if available, a sample workspace of your work in progress
Post Reply
priskilla
Posts: 2
Joined: Sun Apr 07, 2024 7:54 am
Real Name: priscilla

New user here, and loving QLC so far. I'm currently writing scripts for an 8-zone light bar. I could use chaser or sequence but I just wanted to try out script writing because it has the potential to be powerful.

To illustrate my issue, I'll use the example of simple chaser where each segment of the light bar lights up red for 1 sec. I think it makes sense to do something like this with multiple simple scripts:

[script_1] - This script turns on the dimmer, zeroes each segment except zone 1, and sets zone 1 red to 255.

Code: Select all

setfixture:2 ch:25 val:40 // 3-Color LED Light Bar #1, Dimmer

setfixture:2 ch:0 val:255 // 3-Color LED Light Bar #1, Zone 1 Red
setfixture:2 ch:1 val:0 // 3-Color LED Light Bar #1, Zone 1 Green
setfixture:2 ch:2 val:0 // 3-Color LED Light Bar #1, Zone 1 Blue

setfixture:2 ch:3 val:0 // 3-Color LED Light Bar #1, Zone 2 Red
setfixture:2 ch:4 val:0 // 3-Color LED Light Bar #1, Zone 2 Green
setfixture:2 ch:5 val:0 // 3-Color LED Light Bar #1, Zone 2 Blue

setfixture:2 ch:6 val:0 // 3-Color LED Light Bar #1, Zone 3 Red
setfixture:2 ch:7 val:0 // 3-Color LED Light Bar #1, Zone 3 Green
setfixture:2 ch:8 val:0 // 3-Color LED Light Bar #1, Zone 3 Blue

setfixture:2 ch:9 val:0 // 3-Color LED Light Bar #1, Zone 4 Red
setfixture:2 ch:10 val:0 // 3-Color LED Light Bar #1, Zone 4 Green
setfixture:2 ch:11 val:0 // 3-Color LED Light Bar #1, Zone 4 Blue

setfixture:2 ch:12 val:0 // 3-Color LED Light Bar #1, Zone 5 Red
setfixture:2 ch:13 val:0 // 3-Color LED Light Bar #1, Zone 5 Green
setfixture:2 ch:14 val:0 // 3-Color LED Light Bar #1, Zone 5 Blue

setfixture:2 ch:15 val:0 // 3-Color LED Light Bar #1, Zone 6 Red
setfixture:2 ch:16 val:0 // 3-Color LED Light Bar #1, Zone 6 Green
setfixture:2 ch:17 val:0 // 3-Color LED Light Bar #1, Zone 6 Blue

setfixture:2 ch:18 val:0 // 3-Color LED Light Bar #1, Zone 7 Red
setfixture:2 ch:19 val:0 // 3-Color LED Light Bar #1, Zone 7 Green
setfixture:2 ch:20 val:0 // 3-Color LED Light Bar #1, Zone 7 Blue

setfixture:2 ch:21 val:0 // 3-Color LED Light Bar #1, Zone 8 Red
setfixture:2 ch:22 val:0 // 3-Color LED Light Bar #1, Zone 8 Green
setfixture:2 ch:23 val:0 // 3-Color LED Light Bar #1, Zone 8 Blue
[run_all] - This script calls script_1 and then waits for 100ms, then calls subsequent similar scripts to light up the other zones one by one.

Code: Select all

startunction:1 // script_1
wait:1000

...

startfunction:68 // script_8
wait:1000

What I end up observing is each segment flashing red quickly, with 1s in between. If I include the wait time inside the script for each zone, I get the behavior I want. But when I call each script and wait 1s in between as described above, I only see a quick flash. Shouldn't the values written to the channels remain the same until overwritten, rather than getting zeroed out immediately upon script exit? This would make scripting so much more intuitive and useful.

Thanks for your help!
User avatar
GGGss
Posts: 2741
Joined: Mon Sep 12, 2016 7:15 pm
Location: Belgium
Real Name: Fredje Gallon

And what timing do you use for the run_all script?
QLC+ needs to have enough time for the script to run through. So the thing what is calling this script, should stay active long enough, otherwise QLC+'s engine shuts off the running script.
IMHO for something this simple, I'd opt to use the built-in chaser or sequence methods, to achieve what you are hard-coding... and afterwards, changing the hold times, or even add fading will be much more enjoyable...
All electric machines work on smoke... when the smoke escapes... they don't work anymore
priskilla
Posts: 2
Joined: Sun Apr 07, 2024 7:54 am
Real Name: priscilla

GGGss wrote: Mon Apr 08, 2024 7:48 am And what timing do you use for the run_all script?
QLC+ needs to have enough time for the script to run through. So the thing what is calling this script, should stay active long enough, otherwise QLC+'s engine shuts off the running script.
IMHO for something this simple, I'd opt to use the built-in chaser or sequence methods, to achieve what you are hard-coding... and afterwards, changing the hold times, or even add fading will be much more enjoyable...
In the run_all script, I call each script to turn on each zone and leave 1000ms in between.
Makes sense to just use the chaser though. I've pivoted my approach!
Post Reply