Hello all, I am having trouble with my background script. I don't know if i didn't write it correctly or if it isn't setup correct but here is what i have:
void Start() {
while (true)
{
Off (All);
DateTime now = DateTime.Now;
DateTime start = new DateTime(now.Year, now.Month, now.Day, 17, 30, 00);
DateTime end = new DateTime(now.Year, now.Month, now.Day, 23, 00, 00);
while (now.CompareTo(start) >= 0 && now.CompareTo(end) <= 0)
{
On (All, At(100));
now = DateTime.Now;
}
Off (All);
}
}
I'm trying to get it to turn all lights on solid at 5:30 and turn them off at 11, every day without me having to restart it.
I checked the standard.dll, imported the channels from my profile, and attached the renard pugin. I selected compile, nothing appeared to happen, so saved it, set it as the background sequence. When restarting vixen, i just get an error stating "There was a problem starting the background sequence" , and the background music begins playing. Is this code correct? I'm having trouble finding documentation on the vixen methods. Any Idea what I am doing wrong? thanks in advance
-Brad
Your code appears to be in a while (true) state right from the beginning without having anything to declare true..
Try this;
void Start()
{
DateTime now = DateTime.Now;
DateTime start = new DateTime(now.Year, now.Month, now.Day, 17, 30, 00);
DateTime end = new DateTime(now.Year, now.Month, now.Day, 23, 00, 00);
while (now.CompareTo(start) >= 0 && now.CompareTo(end) <= 0)
Off (All);
while (true)
{
On (All, At(100));
}
now = DateTime.Now;
}
Also I found that when you want to edit the script, turn off the "Enable background sequence" option in Tools>Preferences , Clear the "Set Background Sequence" under the Sequence menu, Close Vixen, Start Vixen and THEN edit the script.
I don't see how that code would turn the lights on at 5:30 and off after 11 but My C# is a little rusty.
void Start() {
Off (All);
DateTime now = DateTime.Now;
DateTime start = new DateTime(now.Year, now.Month, now.Day, 17, 30, 00);
DateTime end = new DateTime(now.Year, now.Month, now.Day, 23, 00, 00);
while (now.CompareTo(start) >= 0 && now.CompareTo(end) <= 0)
{
On (All, At(100));
now = DateTime.Now; //update the current time
}
Off (All);
}
If I remove the while (true) loop I don't get the error anymore, thanks for clearing that up. One question, Does Vixen automatically loop the background sequence or will i have to restart it at around 5:30 everyday? Thanks
-Brad
Vixen does loop the background sequence. As long as you keep vixen open, it will run the script. I leave my show computer on 24/7 and leave power to the display as well. Every day at 12 my background sequence starts, and it ends at 10:30. Some people here have setups that turn on thier computer and supply power to the display every day just before the show starts, but im not that savvy.
well my show ran once at 5:30 as scheduled, background music started but... no lights came on and vixen stopped responding (but background music continues playing). since vixen loops the sequence i tried this
void Start()
{
DateTime now = DateTime.Now;
DateTime start = new DateTime(now.Year, now.Month, now.Day, 17, 30, 00);
DateTime end = new DateTime(now.Year, now.Month, now.Day, 22, 00, 00);
if (now.CompareTo(start) >= 0 && now.CompareTo(end) <= 0)
{
On (All, At(100));
}
else {
Off (All);
}
}
Nothing Happens. I just want the lights to come on between shows if is between 5:30 and 10 (not 11 as previously stated)
Now What? thanks
