PDA

View Full Version : Create a background sequence



mkess
12-08-2008, 05:30 PM
I want to have a sequence between shows where all lights are on on 8 channels. How do I do that? I have no idea about code

jeff.ott
12-08-2008, 09:13 PM
Here is some code I plagerized (sorry for forgetting who to give credit to)from others that starts the background sequence at 4:50 and shuts off at 11:00. (the shut down is not working) and turns on various channels with constant ons and some ramps. You need to place this code in the code section of the "script project" work space. You need to create a new sequence using the "script project" option. When you save the "script project" you need to add .vsp to the name or you will not be able to retrieve the script project under the open sequence menu item. (remember to select script project undet the type). You will need to import your channels (from a already defined sequence), define your plug-ins and select the standard.dll for the module. I think that is everything you need to do. Here is the code i started with: (you will need to update the channel seletions wiht your own)

void Start() {
// The compiler will ignore anything after two forward slashes, like these comments.
// I've placed comments in the code to try to explain what I'm doing.
// Since each thing we're controlling is made up of multiple channels,
// we're going to build collections of channels to control, one for each
// entity.
Off(All);
ChannelCollection MegaTreeRed;
ChannelCollection MegaTreeWhite;
ChannelCollection MegaTreeBlue;
ChannelCollection UpperIcicles;
ChannelCollection LowerIcicles;
ChannelCollection Reindeers;
MegaTreeRed = Channels(MegaTreeRed1,MegaTreeRed2, etc );
MegaTreeWhite = Channels(MegaTreeWhite1,MegaTreeWhite2, etc );
MegaTreeBlue = Channels(MegaTreeBlue1,MegaTreeBlue2, etc );
UpperIcicles = ChannelRange(1,8);
LowerIcicles = Channels(ChannelRange(9,3), ChannelRange(20,3));
Reindeers = Channels();

DateTime now = DateTime.Now; //get the current time

//The DateTime constructor goes (YYYY, MM, DD, HH, MM, SS)
DateTime start = new DateTime(now.Year, now.Month, now.Day, 16, 50, 00);
DateTime end = new DateTime(now.Year, now.Month, now.Day, 23, 00, 00);

//We only want the channels to turn on while the current time is
//between 4:50 and 11 pm
while (now.CompareTo(start) >= 0 && now.CompareTo(end) <= 0)
{

// These are static, they will not change, so we will turn them on and
// leave them.
On(UpperIcicles, At(100)); // At 100%
On(LowerIcicles, At(100));
// Ramp from 0-100% over the span of one second and wait for it to complete.
Ramp(MegaTreeRed, 25, 100, Over(1).Second, Wait);
// Have the channels on at full intesity for 5 seconds and wait for it to complete.
On(MegaTreeRed, For(5).Seconds, Wait);
// Fade from 100-0% over the span of one second and wait for it to complete.
Ramp(MegaTreeRed, 100, 0, Over(1).Second, Wait);
Ramp(MegaTreeWhite, 25, 100, Over(1).Second, Wait);
On(MegaTreeWhite, For(5).Seconds, Wait);
Ramp(MegaTreeWhite, 100, 0, Over(1).Second, Wait);
Ramp(MegaTreeBlue, 25, 100, Over(1).Second, Wait);
On(MegaTreeBlue, For(5).Seconds, Wait);
Ramp(MegaTreeBlue, 100, 0, Over(1).Second, Wait);
Ramp(Reindeers, 25, 100, Over(1).Second, Wait);
On(Reindeers, For(8).Seconds, Wait);
Ramp(Reindeers, 100, 0, Over(1).Second, Wait);

now = DateTime.Now; //update the current time
}
Off(All);
}